1、以user oracle身份登录
2、设置启动脚本dbstart 的参数
[oracle@oracle10g bin]$ vim $ORACLE_HOME/bin/dbstart
原配置 ORACLE_HOME_LISTNER=$1
目标配置 ORACLE_HOME_LISTNER=$ORACLE_HOME
3、修改实例orcl的配置选项
[oracle@oracle10g bin]$ vim /etc/oratab
原配置 orcl:/opt/oracle/app/product/11.2.0/dbhome_1:N
目标配置 orcl:/opt/oracle/app/product/11.2.0/dbhome_1:Y
4、添加系统开机自启动任务。加入数据库启动脚本dbstart和开启监听lsnrctl start
[root@oracle10g ~]# vim /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
su - oracle -lc /opt/oracle/app/product/11.2.0/dbhome_1/bin/dbstart
su - oracle -lc "/opt/oracle/app/product/11.2.0/dbhome_1/bin/lsnrctl start"
5、重启主机
[root@oracle10g ~]# reboot
6、查看数据库和监听是否自启动
刚开始重启一次可能不生效,再次重启查看下
[oracle@oracle10g ~]$ ps -ef | grep orcl
[oracle@oracle10g ~]$ lsnrctl status
7、查看数据库是否处于open状态
最后的保证数据库是否处于可用状态
[oracle@oracle10g ~]$sqlplus /as sysdba
SQL>select status from v$instance;
SQL>select name from v$database;