Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: starting and stopping db instances
chienli_at_uclink4.berkeley.edu writes:
> Hi,
>
> I have a problem that I can't figure out how to do or even know if it is
> possible.
>
> The problem is that I want to shutdown and startup an oracle instance
> everyone hour or so. Before, how we did it was to run a shell script on
> the server side to schedule a bunch of batch jobs. The shell script
> calls svrmgrl and connects internal to do shutdown and startup. Now I
> would like to do this from my NT client and do the same thing from a
> program I am writing.
>
Well,
You could use a script like the following and just put it in cron to go off ever hour.
#!/bin/sh
ORACLE_SID=<insert SID here>
ORACLE_HOME=`grep "^${ORACLE_SID}:" /var/opt/oracle/oratab |cut -d: -f 2`
export ORACLE_SID ORACLE_HOME
#########################
#########################
${ORACLE_HOME}/bin/svrmgrl <<END_OF_SHUTDOWN
connect internal
shutdown immediate
END_OF_SHUTDOWN
######################
######################