Link to home
Start Free TrialLog in
Avatar of mingichu
mingichu

asked on

automatic shutdown and startup

Hi all exports:

Our oracle db has  NONarchive log. We backup the files in NT server night without shutting down oracle db. So if oracle down due to corrupted datafiles, the only solution we  have is to restore the tape for NT as of the previous date and we have to re-run today's work.
Now we'd like find a way to shut down the oracle automatically. After the NT backup is  completed, we'd like to start up oracle automatically. Is there anyway to do that? Or, if it is possible, how to put the SVRMGR scripts into a file (batch file?) and put it in our scheduler program?

Thanks!!!
ASKER CERTIFIED SOLUTION
Avatar of kouke
kouke

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rahulak
rahulak

Try using the Oradim utility as you are using NT.
Here's something about ORADIM

Command :
ORADIM ?STARTUP ?SID sidname [?USRPWD password ]
[-STARTTYPE srvc|inst|srvc,inst ] [?PFIFLE filename ]

ORADIM ?SHUTDOWN ?SID sidname [-USRPWD password ]
[-SHUTTYPE srvc|inst|srvc,inst ] [?SHUTMODE a|i|n ]

oradim : The command for starting and stopping a database.

STARTUP : Indicates that you want to start a service or an instance.

SID sidname : Specifies the instance whose service you
want to start.

USRPWD password : Specifies the password for the internal user. You won?t
need this parameter if you are logged on to NT as an administrator.

STARTTYPE srvc|inst|srvc,inst : Indicates what to start. Your choices
are as follows:
? srvc ?Starts just the service.
? inst ?Starts the instance. The service must already be running for
this to work.
? srvc,inst ?Starts both the service and the instance.

SHUTTYPE srvc|inst|srvc,inst : Indicates what to stop. Your choices are
the same as for STARTTYPE .

PFILE filename : Points to the parameter file for the instance. You don?t need
this if the parameter file is in the default location where Oracle expects it to be.

SHUTMODE a|i|n : Indicates the shutdown mode to use when stopping the
instance. Your choices are as follows:
? a ?An abort
? i ?An immediate shutdown
? n ?A normal shutdown


heres the code which could be a part of a batch file that would do the same for you.

oradim ?startup ?sid yourSID

oradim ?shutdown ?sid yourSID

all the best !!
There has been no activity in this question in quite some time, and it looks like it has been abandoned. As part of our ongoing mission to clean up the topic areas, a Moderator will finalize this question within the next seven (7) days. At that time, either I or one of the other Moderators will force/accept the comment of kouke.

DO NOT ACCEPT THIS COMMENT AS AN ANSWER. If you have further comments on this question or the recommendation, please leave them here.

mingichu,

Some of these questions have been open for some time, and records indicate you logged in as recently as this week. Please resolve them appropriately as soon as possible. Continued disregard of your open questions will result in the force/acceptance of a comment as an answer; other actions affecting your account may also be taken. I will revisit these questions in approximately seven (7) days.

https://www.experts-exchange.com/jsp/qShow.jsp?ta=oracle&qid=20260860
https://www.experts-exchange.com/jsp/qShow.jsp?ta=oracle&qid=20176286
https://www.experts-exchange.com/jsp/qShow.jsp?ta=vbdatabases&qid=20156941
https://www.experts-exchange.com/jsp/qShow.jsp?ta=lotusnotes&qid=20138024

Thanks,

Netminder
Community Support Moderator
Experts Exchange
Avatar of Mark Geerlings
If your are backing up an Oracle database on NT without shutting it down, I hope you are using Oracle's "ocopy.exe" to do that, by copying the data files to an alternate disk location.  Otherwise the backup is useless.

I agree with kouke's suggestion: a batch file that you schedule via NT's "at" scheduler.  I've used that approach for years with Oracle on NT.
Avatar of mingichu

ASKER

Hi! Kouke,

Thanks for your answer!!!
But I have another question:
How I you put the connection string? Should I put it in the BAT file? Or, should I put it in ora_down.sql, before the shutdown script? (Pls see below.)

USERID/PASSWORD AS SYSDBA
SPOOL ORA_DOWN.LOG
SHUTDOWN IMMEDIATELY
SPOOL OFF

Thanks again!!





Hi! Kouke,

Thanks for your answer!!!
But I have another question:
How I you put the connection string? Should I put it in the BAT file? Or, should I put it in ora_down.sql, before the shutdown script? (Pls see below.)

USERID/PASSWORD AS SYSDBA
SPOOL ORA_DOWN.LOG
SHUTDOWN IMMEDIATELY
SPOOL OFF

Thanks again!!





For svrmgrl, I prefer to put the connection string in the *.SQL file.  But "svrmgrl" is going away.  With Oracle9, you will need to use SQL*Plus.  With SQL*Plus it works best for me to put to connection string in the *.bat file.
If you have  administrator rights you can "connect internal", so you don't have to know any passwords.

Enter command like this:
at 00:05 /EVERY:,W,Su  "D\:oracle\scripts\ora_backup.bat"




.