Hi,
Using the db2stop command always stops the instance set in the DB2INSTANCE variable. If you need to stop different instances and need to know which applicatations are still active the best way to go is:
 
db2 terminate
 
set DB2INSTANCE=INST1
 
<any other command>
 
db2stop force
 
db2 terminate
 
set DB2INSTANCE=INST1
 
<any other command>
 
db2stop force
 
 
Hope this helps
 
Kind regards, Gert
 
 
----- Original Message -----
Sent: Thursday, May 17, 2001 8:40 PM
Subject: DB2EUG: Shutting down a DB2 NT server cleaning

We are trying to develop a batch file that will cleanly stop all of the DB2 instances and services, so we can do maintenance on the box.  The servers have multiple instances on the box.  I can shut down the first instance with no problems but when I try attaching to the second instance it fails.  Any help would be greatly appreciated.  Here is a copy of the code in the batch file:

** Stopping the Cool-Gen services to DB2  **
!NET STOP TE-AD-51-1;
!NET STOP TE-UF-51-1;

!NET STOP TE-AD-51-2;
!NET STOP TE-UF-51-2;

!NET STOP TE-AD-51-CRID1;
!NET STOP TE-UF-51-CRID1;

ATTACH TO NRDEVL1 USER XXXXXXXX USING XXXXXXXXXXX;

LIST APPLICATIONS FOR DATABASE NRDAIRD1 SHOW DETAIL;
LIST APPLICATIONS FOR DATABASE NRDHPPD1 SHOW DETAIL;

DB2STOP FORCE;

ATTACH TO NRTEST1 USER XXXXXX USING XXXXX;

LIST APPLICATIONS FOR DATABASE NRDAIRT1 SHOW DETAIL;

DB2STOP FORCE;

DB2ADMIN STOP;

Here is what is returned


!NET STOP TE-AD-51-1

!NET STOP TE-UF-51-1

!NET STOP TE-AD-51-2

!NET STOP TE-UF-51-2

!NET STOP TE-AD-51-CRID1

!NET STOP TE-UF-51-CRID1

ATTACH TO NRTEST1 USER XXXXXXXX USING        

   Instance Attachment Information

 Instance server        = DB2/NT 6.1.0
 Authorization ID       = XXXXXXXXXX
 Local instance alias   = NRTEST1


LIST APPLICATIONS FOR DATABASE NRDAIRT1 SHOW DETAIL

Auth Id  Application Name     Appl.      Application Id                 Seq# Number of  Coordinating Coordinator     Status                         Status Change Time         DB Name  DB Path
                              Handle                                         Agents     Node Number  pid/thread
-------- -------------------- ---------- ------------------------------ ---- ---------- ------------ --------------- ------------------------------ -------------------------- -------- --------------------
XXXXXXX  NR34S201.exe         21         *LOCAL.NRTEST1.010516123102    0001 1          0            336             UOW Waiting                    Not Collected                       NRDAIRT1 F:\NRTEST1\NODE0000\SQL00001\
XXXXXXX  NR34S202.exe         22         *LOCAL.NRTEST1.010516123113    0001 1          0            344             UOW Waiting                    Not Collected                       NRDAIRT1 F:\NRTEST1\NODE0000\SQL00001\


DB2STOP FORCE
DB20000I  The DB2STOP command completed successfully.

ATTACH TO NRDEVL1 USER XXXXXXX USING        
SQL1032N  No start database manager command was issued.  SQLSTATE=57019

LIST APPLICATIONS FOR DATABASE NRDAIRD1 SHOW DETAIL
SQL1032N  No start database manager command was issued.  SQLSTATE=57019

LIST APPLICATIONS FOR DATABASE NRDHPPD1 SHOW DETAIL
SQL1032N  No start database manager command was issued.  SQLSTATE=57019

DB2STOP FORCE
SQL1032N  No start database manager command was issued.  SQLSTATE=57019

DB2ADMIN STOP
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL1024N  A database connection does not exist.  SQLSTATE=08003

Any help would be greatly appreciated.  This script is being used by the network team to shut down the server, so DB2 doesn't have to do a crash recovery.

Ron Draper
Computer Information Technology Specialist I
Missouri Department of Natural Resources
MIS Program
526-1077

[EMAIL PROTECTED]
Microsoft Certified Professional

Reply via email to