Solaris 10中Oracle 10gR2开机自启动


Solaris 10中Oracle 10gR2开机自启动

1.修改/var/opt/oracle/oratab文件,后面的dbstart和dbshut依据这个文件启动数据库:
 
orcl:/opt/oracle/product/10.2:Y
 
2.修改$ORACLE_HOME/bin/dbstart和$ORACLE_HOME/bin/dbshut文件:
 
vi dbstart
 
#ORACLE_HOME_LISTNER=$1
 ORACLE_HOME_LISTNER=/opt/oracle/product/10.2
 export ORACLE_HOME_LISTNER
 
vi dbshut
 
#ORACLE_HOME_LISTNER=$1
 ORACLE_HOME_LISTNER=/opt/oracle/product/10.2
 export ORACLE_HOME_LISTNER
 
3.修改完毕后用看看oracle用户能否执行这两个文件,我的dbshut没问题,但是执行dbstart不行:

查看/opt/oracle/product/10.2/listener.log的权限:


 
原来是oracle用户没有写入listener的权限,赋予相应权限即可:
 chown oracle:dba /opt/oracle/product/10.2/listener.log
 执行后成功。
 
4.接下来在/etc/init.d下建立系统自动启动和关机前自动关闭Oracle的脚本文件,分别如下:
 
vi start_oracle.sh(开机后启动oracle数据库脚本):
 
#!/usr/bin/bash
 #this script is used to start the oracle
 su - oracle -c " /opt/oracle/product/10.2/bin/dbstart"
 
chmod a+x /etc/init.d/start_oracle.sh
 
vi stop_oracle.sh(关机前停止oracle数据库脚本):
 
#!/usr/bin/bash
 #this script is used to stop the oracle
 su - oracle -c " /opt/oracle/product/10.2/bin/dbshut"
 
chmod a+x /etc/init.d/stop_oracle.sh

  • 1
  • 2
  • 下一页

相关内容