方式一:配置开机启动
步骤:
1:查看ORACLE_HOME是否设置
2:执行dbstart 数据库自带启动脚本
3:编辑/etc/oratab文件
4:编辑/etc/rc.d/rc.local启动文件,添加数据库启动脚本dbstart
5:重启主机,查看数据库和监听是自启动
6:查看数据库是否处于open状态
[oracle@oracle10g bin]$ dbstartORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net ListenerUsage: /u01/app/oracle/product/10.2.0/db_1/bin/dbstart ORACLE_HOME错误提示:ORACLE_HOME_LISTNER 没有设置
[oracle@oracle10g bin]$ cd /u01/app/oracle/product/10.2.0/db_1/bin/
[oracle@oracle10g bin]$ ll | grep dbs
-rwxr-x--- 1 oracle oinstall 6582 Jan 1 2000 dbshut
-rwxr-x--- 1 oracle oinstall 14088 Jan 1 2000 dbstart
编辑 dbstart,将ORACLE_HOME_LISTNER=$1修改成ORACLE_HOME_LISTNER=$ORACLE_HOME前提是$ORACLE_HOME环境设置正确
编辑oratab
编辑/etc/oratab文件
dbca建库时都会自动创建/etc/oratab文件
将orcl:/u01/app/oracle/product/10.2.0/db_1:N 修改成
orcl:/u01/app/oracle/product/10.2.0/db_1:Y
添加启动脚本:
编辑/etc/rc.d/rc.local启动文件,添加数据库启动脚本dbstart
该文件必须使用root用户编辑
[root@oracle10g ~]# vi /etc/rc.d/rc.local[root@oracle10g ~]# cat /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 /u01/app/oracle/product/10.2.0/db_1/bin/dbstart
su - oracle -lc "/u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl start"
方式二,写小脚本加入开机启动(懒人方式)
小脚本
#!/bin/sh source ~/.bash_profile #启动mount echo "begin startup mount" sqlplus / as sysdba <<EOF startup; EOF lsnrctl start
编辑/etc/rc.d/rc.local启动文件
su - oracle -lc /usr/local/bin/oracle.sh
转载请注明:梦绘设计 » 数据库 » oracle配置开机启动
版权声明
本站《作品展示》类文章均为原创,转载必须注明出处,技术分享类文章部分来源于网络,版权归原作者所有,若侵权请留言。