假如ORACLE_HOME为/opt/app/oracle/product/10.2.0/db_1.
1) 修改/etc/oratab
$ vi /etc/oratab
---------------------------------------------------------------------
...
+ASM:/opt/app/oracle/product/10.2.0/db_1:Y
ORCL:/opt/app/oracle/product/10.2.0/db_1:Y
---------------------------------------------------------------------
把Flag设置为Y表示可用dbstart来启动ASM实例,数据库实例和监听.
2) 修改dbstart脚本
10.2.0.1以上版本无需做本步骤, 10.2.0.1版本则修改dbstart第102行:
$ vi $ORACLE_HOME/bin/dbstart
---------------------------------------------------------------------
$ORACLE_HOME_LISTNER/bin/lsnrctl start LISTENER_NAME >> $LOG 2>&1 &
---------------------------------------------------------------------
3) 检查脚本
启动日志是$ORACLE_HOME/startup.log, 关闭日志是$ORACLE_HOME/shutdown.log
$ dbshut /opt/app/oracle/product/10.2.0/db_1
$ tail -f $ORACLE_HOME/shutdown.log
$ dbstart /opt/app/oracle/product/10.2.0/db_1
$ tail -f $ORACLE_HOME/startup.log
$ ps -ef | grep tns | grep -v grep
$ ps -ef | grep asm_ | grep -v grep
$ ps -ef | grep ora_ | grep -v grep
4) 增加Oracle相关进程启动脚本
# vi /etc/rc.oracle
---------------------------------------------------------------------
#wangnc added
su - oracle -c "/opt/app/oracle/product/10.2.0/db_1/bin/dbstart /opt/app/oracle/product/10.2.0/db_1"
su - oracle -c "/opt/app/oracle/product/10.2.0/db_1/bin/emctl start dbconsole"
---------------------------------------------------------------------
"emctl start dbconsole"那行是实现随机启动OEM, 根据实际需要决定是否加上.
# chmod +x /etc/rc.oracle
5) 修改/etc/inittab实现随机启动
# vi /etc/inittab
---------------------------------------------------------------------
oracle:2:wait:/etc/rc.oracle 2>&1
---------------------------------------------------------------------
6) 增加Oracle相关进程关闭脚本
# vi /etc/rc.shutdown
---------------------------------------------------------------------
#wangnc added
su - oracle -c "/opt/app/oracle/product/10.2.0/db_1/bin/dbshut /opt/app/oracle/product/10.2.0/db_1"
---------------------------------------------------------------------
# chmod +x /etc/rc.shutdown
AIX关闭前会自动执行rc.shutdown脚本.
7) 测试随机启动
# shutdown -Fr
$ more $ORACLE_HOME/shutdown.log
$ more $ORACLE_HOME/startup.log
--END--