The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

Hi,

I have 1 server with 2 databases on it. How can I stop both database? This would seem easy but for me to stop a database I have to connect to one first. So when I connect to db1 on server x I can stop db2 and vice versa. But this would mean that I always have to be connected to at least 1 db and thus can never stop both...

asked 06 Jun '12, 06:17

Galactico076's gravatar image

Galactico076
76338
accept rate: 0%


Two options. You can use the -d switch on dbstop, which tells it to stop the database rather than the server:

dbstop -d -c "links=tcpip;eng=server_name;DBN=database1;uid=dba;pwd=sql"
dbstop -d -c "links=tcpip;eng=server_name;DBN=database2;uid=dba;pwd=sql"

Alternatively, you can connect to the utility database and issue stop database statements. You will need to use the -su switch when starting the server:

dbisql -c "links=tcpip;eng=server_name;dbn=utility_db;uid=dba;pwd=sql" 
> stop database database1
> stop database database2
permanent link

answered 06 Jun '12, 06:42

Graeme%20Perrow's gravatar image

Graeme Perrow
8.3k369106
accept rate: 52%

dbstop.exe -c "commlinks=tcpip;eng=MYSERVER;uid=DBA;pwd=SQL"

permanent link

answered 06 Jun '12, 06:22

Dmitri's gravatar image

Dmitri
1.5k41132
accept rate: 11%

1

Note that this will stop the entire server, not just the two databases.

(06 Jun '12, 06:36) Graeme Perrow
Replies hidden

If you have a server with 2 databases, stopping both of them is the same as stopping the server.

(06 Jun '12, 07:08) Dmitri
2

Not necessarily, you can still have a running server - though the question is not clear about whether the database server should be stopped, as well, and I would assume that stopping the server is part of the requirement, too...

(06 Jun '12, 07:40) Volker Barth
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×18

question asked: 06 Jun '12, 06:17

question was seen: 970 times

last updated: 06 Jun '12, 07:42