How to stop and start instences from batch?


I'm having some difficulty trying to do cold backups of my Oracle8
databases. I have two instances that I would like backed up. When I shut
one down from my backup program, it shut down just fine, except that 1)
the password I was using was now embedded in the backup log and 2) I
needed to shut the other instance down, too. So I moved the command to a
Windows NT .CMD file and have discovered that, even though the shut down
log indicates that the instance was shut down, the instance remains open
and my backup complains that the files are in use. I was trying to use
the orashut.bat file that is in my database folder. The batch file
describes how it is called from the NT service manager so I coded my
file with two calls to this batch file properly encoded. Indeed,
shutting down from the command line seems to work. Any ideas on how I
can rework my command file to actually shut down the instances?


Ans1:

Without looking at the actual code this may be difficult.
Are you using oradim?? to accomplish the shutdown. If you shut both the
instance and the service, this should work without problem.
The other solution is calling svrmgr?? using a command line like
svrmgr23 @shutdown.sql
However, in this case, the services will still be running, and files left
open.



Ans2:

As far as Oracle suppport tolds and AFAIK they're closed when instance
is shut down. Tested this also by using the NT-copy command to copy
db-files to another destination without any sharing violation. Yes,
listener related files will be open, 'cause service is running.



Ans3:

Try:

Call server manager to run the SQL-script:

c:\programm\orant\bin\SVRMGR23.EXE @c:\cmd\sql\down_bac.sql
 

SQL-script would look like:

CONNECT <dba>/<pwd>
SHUTDOWN IMMEDIATE;
STARTUP RESTRICT; -- instance recovery
alter rollback segment rb1 SHRINK;
alter rollback segment rb2 SHRINK;
alter rollback segment rb3 SHRINK;
alter rollback segment rb4 SHRINK;
alter rollback segment rb5 SHRINK;
alter rollback segment rb6 SHRINK;
alter rollback segment rb7 SHRINK;
alter rollback segment rb8 SHRINK;
alter rollback segment rb9 SHRINK;
alter rollback segment rb10 SHRINK;
alter rollback segment rb11 SHRINK;
alter rollback segment rb12 SHRINK;
alter rollback segment rb13 SHRINK;
alter rollback segment rb14 SHRINK;
alter rollback segment rb15 SHRINK;
alter rollback segment rb16 SHRINK;
alter rollback segment rbbig SHRINK;

ALTER SYSTEM SWITCH LOGFILE;    -- number of logfiles in group times
ALTER SYSTEM SWITCH LOGFILE;
ALTER SYSTEM SWITCH LOGFILE;
ALTER SYSTEM SWITCH LOGFILE;
ALTER SYSTEM SWITCH LOGFILE;
ALTER SYSTEM SWITCH LOGFILE;
ALTER SYSTEM SWITCH LOGFILE;
ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
SHUTDOWN;

Then run your backup. The cmd-file could also be run as the pre-job of
your backup-software.
 
 
 

Hosted by www.Geocities.ws

1