Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

Auto Shutdown and Startup script for Oracle8.1.7

SOLVED
Go to solution
Jesse Delk
Frequent Advisor

Auto Shutdown and Startup script for Oracle8.1.7

I'm running HP-UX 11.11 Version1 and Oracle 8.1.7. Does anyone have any scripts I could have for:

/sbin/init.d/oracle
/etc/rc.config.d/oracle

From what I've read the second one maybe only

ORACLE_START=1
export ORACLE_START

but I'm not sure. I have oratab set up and able to create symbolic links that I need once the first script is created.
13 REPLIES
Rita C Workman
Honored Contributor
Solution

Re: Auto Shutdown and Startup script for Oracle8.1.7

Here's a little note I wrote for myself on setting up Oracle to start when a server reboots. It 'assumes' that the box does not run MC/SG. Now remember, they are my old notes, and on these small old boxes we would do a nightly shutdown and run cold backups. So you may want to exclude things like that.

How to start Oracle D/B on UNIX system startup automatically
Three steps

First:
set up Oracle start up scripts ( see DBA for this ) and edit the cronfile to include these
Cronfile for most systems is : /var/spool/cron/crontabs/root
then remember to crontab the root cronfile and ensure that this 'took' by doing a crontab -l.

Second:
create a file for the system to trigger on and start the Oracle d/b by creating a file (ex:
start_oracle.sh) it should include the following line(s):

su - oracle -c /home/oracle/start_oracle_db.sh

Note: spacing in above is exactly as it should be; the user is oracle; the -c forces it to run
the script on the line; /home/...is the location of the oracle start script from first step (see DBA)
save this file (start_oracle.sh) in /usr/local/bin

Third:
Go to /sbin/rc3.d (this is the default sbin startup routines)
create a symbolic link file to startup here by entering the following:

ln -s /usr/local/bin/start_oracle.sh S123start_oracle_db.sh

(where 123 equal the number for filing purposes of this routine, be careful
to file it properly for processing purposes)

OK...that's pretty much it.

Rgrds,
Rita

Thayanidhi
Honored Contributor

Re: Auto Shutdown and Startup script for Oracle8.1.7

You can copy lp script (/sbin/lp) or similar one and modify accrdingly.
source the variable file (. /etc/rc.config.d/oracle) and call Oracle utility to start or stop the DB.
Remember that sbin processes are started by root user. So you use su - -c <script>.

Hope this helps.

Regds
TT
It's not necessary to have /etc/rc.config.d/oracle unless you want to control time to time. Simply keeping the script in /sbin/init.d and linking t rc3.d & rc2.d would be sufficient.
Attitude (not aptitude) determines altitude.
DCE
Honored Contributor

Re: Auto Shutdown and Startup script for Oracle8.1.7

There is a template file in /sbin/init.d that you can use to construct the oracle start/stop script. copy it to an new name (oracle) and place the appropriate start and stop commands in the start/stop areas.

The /etc/rc.config.d/oracle file is a flag file to disable/enable the start and/or stopping of oracle at system startup/shutdown. It is very benficial to use when you are doing multiple boots (patching, upgrading, etc) and do not want to wait for oracle to load each time - you just set the flag to 0.

Remember that when you make the links to use the "rule of 1000" the numbers in the S and K links should add up to 1000. i.e. S900oracle and K100oracle. This means oracle will be one of the last started, and one of the first shutdown.
Victor Fridyev
Honored Contributor

Re: Auto Shutdown and Startup script for Oracle8.1.7

Hi,

You can use the attached script. The script looks for the file called /etc/rc.config.d/oraconf, which should contain the following:
ORACLE_START=1

Please take into account that the script uses Oracle standard procedures dbstart and dbshut. The procedures require /etc/oratab file, which must contain all used SIDs.


HTH
Entities are not to be multiplied beyond necessity - RTFM
Eric Antunes
Honored Contributor

Re: Auto Shutdown and Startup script for Oracle8.1.7

Hi Jesse,

Here are my scripts:

dbora817 is the script you must put at /sbin/init.d

start_boot_db.sh and start_boot_db.sh are the scripts you must have at the $ORA_BASE/.../ in dbora817.

Finally, you create links to dbora817 at the run level you want them to start and stop: rc2.d/S866dbora817 and rc3.d/K133dbora817 are respectively the links I use here at my servers. Note that 866+133=1000...

Best Regards,

Eric Antunes
Each and every day is a good day to learn.
Eric Antunes
Honored Contributor

Re: Auto Shutdown and Startup script for Oracle8.1.7

Better spelling:

...

start_boot_db.sh and start_boot_db.sh are the scripts you must have at the $ORA_BASE/... (see dbora817).

Finally, you create links to dbora817 at the run level you want them to start and stop: /sbin/rc2.d/S866dbora817 and /sbin/rc3.d/K133dbora817 are respectively the links I use here at my servers. Note that 866+133=1000...

Eric Antunes
Each and every day is a good day to learn.
Jesse Delk
Frequent Advisor

Re: Auto Shutdown and Startup script for Oracle8.1.7

One more thing........

about the links..some document from Oracle Metalink suggested....create /K100oracle in /sbin/rc1.d

It looks as though most of you said create it in /sbin/rc3.d

Which should it be or does it matter?
DCE
Honored Contributor

Re: Auto Shutdown and Startup script for Oracle8.1.7

Application scripts usualy are started at run level3, and brought down at run level 2

You want to bring up the application after all the basic subsystems are started, and they are a started at run level 2, and you want your application down before basic services are terminated, again at run level 2 Which is why you want a a low K number on the link i.e. K100oracle, so that the app is brought down before, say, networking.

Dave
Sandman!
Honored Contributor

Re: Auto Shutdown and Startup script for Oracle8.1.7

Jesse,

If you'ave a valid oratab file in the /var/opt/oracle directory and the ORACLE_HOME variable is defined and exported, use the attached script and follow the steps below:

1. Install the script in the /sbin/init.d directory, name it oracle.

2. make symbolic links to the 2 and 3 run-levels for stopping and starting oracle respectively like...

ln -s /sbin/init.d/oracle /sbin/rc3.d/S900oracle
ln -s /sbin/init.d/oracle /sbin/rc2.d/K100oracle
Yogeeraj_1
Honored Contributor

Re: Auto Shutdown and Startup script for Oracle8.1.7

hi,

in /sbin/init.d/

i have the attached script.
(please modify accordingly)

then, two symbolic links created using:
ln -s /sbin/init.d/oracle /sbin/rc3.d/S900oracle
ln -s /sbin/init.d/oracle /sbin/rc2.d/K100oracle

hope this helps!
regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Yogeeraj_1
Honored Contributor

Re: Auto Shutdown and Startup script for Oracle8.1.7

hi again,

also, the /etc/rc.config.d/oracle is indeed also important!
content of file should be:
# ORACLE DATABASE configuration
#
# ORACLE_START_STOP : Set to 1 to start ORACLE DATABASE
#
ORACLE_START_STOP=1

hope this helps too!
regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
vinod_25
Valued Contributor

Re: Auto Shutdown and Startup script for Oracle8.1.7

hi jesse

Do the following steps:

step 1: edit /etc/oratab file

ORACLE_SID:ORACLE_HOME: {Y|N}
y -> for dbstart and dbshut scripts to startup and shutdoen the database

step 2: Create dbora script in the /etc/init.d

see attachment for the script

step 3: Create symbolic links to the dbora script in the appropriate run-level
script directories

# ln -s /etc/init.d/dbora /sbin/rc2.d/K10dbora
# ln -s /etc/init.d/dbora /sbin/rc3.d/S99dbora

step 4: avoidance of "stty is not a typewriter" error message

The not-a-typewriter error is caused by running commands where there is no
controlling tty device; that is, no interactive terminal is present. This would
be true for a script that runs in cron or has su - to run a batch job.

Uncomment all stty commands in /home/$ORA_OWNER/.profile as $ORA_OWNER
Example:
# Set up the terminal:
# if [ "$TERM" = "" ]
# then
# eval ` tset -s -Q -m ':?hp' `
# else
# eval ` tset -s -Q `
# fi
# stty erase "^H" kill "^U" intr "^C" eof "^D"
# stty hupcl ixon ixoff
# tabs

Recheck the scripts before applying...
Any suggestions warmly welcomed...

Good Luck !!

Vinod K
Jesse Delk
Frequent Advisor

Re: Auto Shutdown and Startup script for Oracle8.1.7

Thanks everybody. I'm making the changes and will be testing them next Friday.