oracle 9 linux 自启动方法

oracle 9 linux 自启动方法

1\创建文件ora9 ,注意里面的路径 .

#!/bin/bash
#
# (c) [email protected]
#
# name: /etc/rc.d/init.d/ora9
# des cription: starts and stops oracle 9i database, TNS listener
# http server, and fixes kernel parameters for oracle

. /etc/rc.d/init.d/functions

prog=oracle

start() {
        echo -n $"Starting $prog: "
        #daemon "startOracle"
        su - oracle -c "lsnrctl start"
        su - oracle -c "/usr/oracle/product/9.2.0.4/bin/dbstart"
}

stop() {
 echo -n $"Stopping $prog: "
        #stopOracle
        su - oracle -c "lsnrctl stop"
        su - oracle -c "/usr/oracle/product/9.2.0.4/bin/dbshut"
}
case $1 in
start)
 start
 ;;
stop)
 stop
 ;;
*)
echo "Usage: ora9 [start|stop]"
;;

esac


2\拷贝到 /etc/init.d/ 中

3\ 运行如下命令
ln -s /etc/init.d/ora9 /etc/rc.d/rc2.d/S99ora9
ln -s /etc/init.d/ora9 /etc/rc.d/rc3.d/S99ora9
ln -s /etc/init.d/ora9 /etc/rc.d/rc4.d/S99ora9
ln -s /etc/init.d/ora9 /etc/rc.d/rc5.d/S99ora9
ln -s /etc/init.d/ora9 /etc/rc.d/rc0.d/S99ora9
ln -s /etc/init.d/ora9 /etc/rc.d/rc0.d/K99ora9
ln -s /etc/init.d/ora9 /etc/rc.d/rc6.d/K99ora9

4\修改/etc/oratab 把sid置为Y

5、
sqlplus /nolog
conn sys/pwd as sysdba
create pfile from spfile
6\reboot

你可能感兴趣的:(oracle 9 linux 自启动方法)