重启系统的时候自动启动oracle服务
|
这时你需要添加另外的初始化脚本,以使在oracle在你重启系统的时候启动,但是首先,你需要删除安装程序所创建的一些链接: #!/bin/bash## /etc/init.d/oracledb## Run-level Startup script for the Oracle Instance, Listener, and # Web Interfaceexport ORACLE_HOME=/your/oracle/home/goes/hereexport ORACLE_SID=oraclesidgoeshereexport PATH=$PATH:$ORACLE_HOME/binORA_OWNR="oracleownergoeshere"# if the executables do not exist -- display errorif [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]thenecho "Oracle startup: cannot start"exit 1fi# depending on parameter -- startup, shutdown, restart# of the instance and listener or usage displaycase "{GetProperty(Content)}" instart)# Oracle listener and instance startupecho -n "Starting Oracle: "su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"su $ORA_OWNR -c $ORACLE_HOME/bin/dbstarttouch /var/lock/oraclesu $ORA_OWNR -c $ORACLE_HOME/bin/emctl start dbconsoleecho "OK";;stop)# Oracle listener and instance shutdownecho -n "Shutdown Oracle: "su $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"su $ORA_OWNR -c $ORACLE_HOME/bin/dbshutrm -f /var/lock/oraclesu $ORA_OWNR -c $ORACLE_HOME/bin/emctl stop dbconsoleecho "OK";;reload|restart){GetProperty(Content)} stop{GetProperty(Content)} start;;****)echo "Usage: `basename {GetProperty(Content)}` start|stop|restart|reload"exit 1esacexit 0创建好脚本後,给他添加执行权限,并在各个运行级里创建链接: # chmod 755 /etc/init.d/oracledb# update-rc.d oracledb defaults 99在启动我们新的数据库之前,我们需要做一些用户化的设置: /usr/local/bin/dbhome 需要改变 ORAHOME, ORASID, 和 ORATAB (/etc/oratab) 这几个环境变量。 /your/oracle/home/bin/dbhome 同上 /your/oracle/home/bin/dbshut 同上 /your/oracle/home/dbstart 需要改变ORATAB这个环境变量。 要使你所创建的所有的数据库在开机是启动,你需要相应的修改 /etc/oratab。 例如把 oracle:/opt/oracle:Y替换为: dbname:/opt/oracle/:N你需要设置如下环境变量: ORACLE_HOME ORACLE_SID PATH 这有很多中方法,请自己找一个适合你自己的!一旦你重启机器或者重启数据库,你需要确认所有的东西都运行起来了,你可以通过sqlplus或者则web管理页面登陆来检查: http://urlgoeshere.com:5500/em 源代码网供稿. |
