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

make script to start listner and database

SOLVED
Go to solution
tareq_2
Regular Advisor

make script to start listner and database

hi all
I have rp7420 server with hp-ux 11iv1 And Oracle 10g installed, i want to make script to start listner and database on server startup and/or when oracle user login
please help
thanks
7 REPLIES
Kenan Erdey
Honored Contributor

Re: make script to start listner and database

Hi,
use it when you login as oracle:

export ORACLE_SID=your_sid
export ORACLE_HOME=your_oracle_path

lsnrctl start

sqlplus "/ as sysdba" << EOF
startup
EOF

Hope it helps.
Kenan.
Computers have lots of memory but no imagination
tareq_2
Regular Advisor

Re: make script to start listner and database

how can i know my listner name
and where to write
export ORACLE_SID=your_sid
export ORACLE_HOME=your_oracle_path

lsnrctl start

sqlplus "/ as sysdba" << EOF
startup
EOF
Mustafa Gulercan
Respected Contributor
Solution

Re: make script to start listner and database

here is the script start DB with oracle user;

echo starting listener
lsnrctl start

echo starting db
sqlplus "/ as sysdba" <startup
EOF

echo starting enterprise manager
emctl start dbconsole

and script stop DB with oracle user;

echo stopping listener
lsnrctl stop

echo stopping db
sqlplus "/ as sysdba" <shutdown immediate
EOF

echo stopping enterprise manager
emctl stop dbconsole

regards,
mustafa
tareq_2
Regular Advisor

Re: make script to start listner and database

thanks mustafa
but where i can write this script in oracle .login file or where??? my experince
in script file is not good
Mustafa Gulercan
Respected Contributor

Re: make script to start listner and database

hi;
you can put these script in to the oracle home directory.example /home/oracle/
don't forget to change the owner of the script.
chown oracle:dba start_db (assume script's name is start_db)
chown oracle:dba stop_db

chmod +x start_db stop_db

regards;
mustafa
Kenan Erdey
Honored Contributor

Re: make script to start listner and database

Hi,

you can place your start and stop scripts in your $ORACLE_HOME/bin as db_start and db_stop. you can find listener name cat $ORACLE_HOME/network/admin/listener.ora ( in configured line blocks)

after placing them create a file /sbin/init.d/rc_ora

#!/sbin/sh

ORA_HOME=

case "$1" in
start_msg)
echo "Start ORACLE server"
;;

stop_msg)
echo "Stop ORACLE server"
;;

'start')
/usr/bin/su - oracle -c $ORA_HOME/bin/db_start
;;
'stop')
# Stop the oracle databases
/usr/bin/su - oracle -c $ORA_HOME/bin/db_stop
;;
esac


And don't forget file to make executable by chmod +x.

after than create links for starting oracle while startup:

ln -s /sbin/init.d/rc_ora /sbin/rc3.d/S990rc_ora
ln -s /sbin/init.d/rc_ora /sbin/rc0.d/K10rc_ora

Kenan.
Computers have lots of memory but no imagination
tareq_2
Regular Advisor

Re: make script to start listner and database

thanks for all