通过dbstart脚本可以在Linux和Unix下设置数据库是否自动启动,但是使用前需要进行一些设置.
下面是一些设置的步骤: 1、修改$ORACLE_HOME/bin下的dbstart文件,约78行,修改为 ORACLE_HOME_LISTNER=$ORACLE_HOME 2、修改/etc/oratab文件,注意在rac环境下有可能实例名并不正确,需要修改为正确的实例名(格式为:$ORACLE_SID:$ORACLE_HOME:Y/N) +ASM1:/u/oracle/product/10.2.0/db_1:Y orcl1:/u/oracle/product/10.2.0/db_1:Y 3修改/etc/rc.local加入 su - oracle -c 'dbstart' 4、这样就可以运行dbstart启动数据库和监听了,并可以通过$ORACLE_HOME/startup.log查看是不是有问题 [oracle@rac1 ~]$ dbstart Processing ASM instance "+ASM1": log file /home/oracle/product/10.2.0/db_1/startup.log Processing Database instance "orcl1": log file /home/oracle/product/10.2.0/db_1/startup.log 下面内容如果安装asm库时候未进行,请按顺序执行 添加init 文件使系统启动时自动加载ASMLib $ su – # cd /etc/rc3.d # ln -s ../init.d/oracleasm S99oracleasm # ln -s ../init.d/oracleasm K01oracleasm 注意:如果系统启动是自动进入图形界面,也就是系统的init level 是5,那么上面生成链 接的命令应该在/etc/rc5.d 目录中操作。 重新启动系统,确认ASMLib 已经可以自动加载 以上内容完成后重启系统。如果在linux as 4上可能遇到以下错误(纠缠偶好久才解决),css服务未就绪导致asm无法启动.日志内容如下 Failure 1 contacting CSS daemon logger: Waiting for Oracle CSS service to be available before starting logger: ASM instance +ASM. Wait 1. Failure 1 contacting CSS daemon 这是一个bug,解决方法如下 编辑/etc/inittab 在行l2,l3之间加入如下内容(一定要在l3之前),修改后如: l2:2:wait:/etc/rc.d/rc 2 h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null l3:3:wait:/etc/rc.d/rc 3 参考自 原文内容: Autostart Oracle on RHEL with ASM support After carefully crafting an init.d startup/shutdown script for my Oracle 10g installation on RHEL, I was able to successfully use it from the command line while shelled in as root. However, Oracle stubbornly refused to automatically start at boot time when invoked via init. A look at the boot logs made it clear that the culprit was a race-condition with the cssd process. While attempting to start ASM, Oracle was throwing the following in /opt/oracle/product/10.2.0/db_1/startup.log: logger: Waiting for Oracle CSS service to be available before starting logger: ASM instance +ASM. Wait 14. Failure 1 contacting CSS daemon logger: Timed out waiting to start ASM instance +ASM logger: CSS service is NOT available. Despite knowing the problem, I wasn't able to find a solution until I came across Jeff Hunter's Oracle blog. In it, he correctly noted that due to a known bug, the /etc/inittab file must be manually modified to support Oracle ASM auto-start on RHEL. Specifically, the respawn line for the init.cssd process must fall between the wait for runlevel 2 and runlevel 3 l2:2:wait:/etc/rc.d/rc 2 h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1 </dev/null l3:3:wait:/etc/rc.d/rc 3 After making this change, Oracle properly auto-starts at boot and all is well with the world.