linux下oracle设置开机自启动实现方法建站知识
导读:1建站知识你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设定相关参数,首先网站seo优化软件网站推广优化seo。
在CentOS 6.3下安装完Oracle 10g R2,重开机之后,你会发现Oracle没有自行启动,这是正常的,因为在Linux下安装Oracle的确不会自行启动,必须要自行设定相关参数,首先先介绍一般而言如何启动oracle。
一、在Linux下启动Oracle
登录到CentOS,切换到oracle用户权限
# su – oracle
接着输入:
$ sqlplus "/as sysdba"
原本的画面会变为SQL>
接着请输入SQL> startup
就可以正常的启动数据库了。
另外停止数据库的指令如下:SQL> shutdown immediate
二、检查Oracle DB监听器是否正常
回到终端机模式,输入:
$ lsnrctl status
检查看看监听器是否有启动
如果没有启动,可以输入:
$ lsnrctl start
启动监听器
SQL> conn sys@orcl as sysdba
然后输入密码,sys以sysdba身份登入数据库。
三、启动emctl
另外也可以发现:1158/em 目前是没有反应的,这边要另外启动,启动的指令如下:
$ emctl start dbconsole
这个指令运行时间较长,执行完的画面如下:
手动启动Oracle数据库完毕,下面创建系统自行启动Oracle的脚本。
四、Oracle启动&停止脚本
1. 修改Oracle系统配置文件:/etc/oratab,只有这样,Oracle 自带的dbstart和dbshut才能够发挥作用。
# vi /etc/orataborcl:/opt/oracle/102:Y
# Entries are of the form:# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
2. 在 /etc/init.d/ 下创建文件oracle,内容如下:
复制代码 代码如下:
#!/bin/sh # chkconfig: 35 80 10 # description: Oracle auto start-stop script. # # Set ORA_HOME 网站seo优化软件to be equivalent to the $ORACLE_HOME # from which you wish to execute dbstart and dbshut; # # Set ORA_OWNER to the user id of the owner of the # Oracle database in ORA_HOME. ORA_HOME=/opt/oracle/102 ORA_OWNER=oracle if [ ! -f $ORA_HOME/bin/dbstart ] then echo "Oracle startup: cannot start" exit fi case "$1" in 'start') # Start the Oracle databases: echo "Starting Oracle Databases ... 网站优化seo培训" echo "-------------------------------------------------" >> /var/log/oracle date +" %T %a %D : Starting Oracle Databases as part of system up." >> /var/log/oracle echo "------------seo网站优化培训-------------------------------------" >> /var/log/oracle su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart" >>/var/log/oracle echo "Done" # Start the Listener: echo "Starting Oracle Listeners ... " echo "-------------------------------------------------" >> /var/log/oracle date +" %T %a %D : Starting Oracle Listeners as part of system up." >> /var/log/oracle echo "-------------------------------------------------" >> /var/log/oracle su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start" >>/var/log/oracle echo "Done." echo "-------------------------------------------------" >> /var/log/oracle date +" %T %a %D : Finished." >> /var/log/oracle echo "-------------------------------------------------" >> /var/log/oracle touch /var/lock/subsys/oracle 'stop') # Stop the Oracle Listener: echo "Stoping Oracle Listeners ... " echo "-------------------------------------------------" >> /var/log/oracle date +" %T %a %D : Stoping Oracle Listener as part of system down." >> /var/log/oracle echo "-------------------------------------------------" >> /var/log/oracle su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop" >>/var/log/oracle echo "Done." rm -f /var/lock/subsys/oracle # Stop the Oracle Database: echo "Stoping Oracle Databases ... " echo "-------------------------------------------------" >> /var/log/oracle date +" %T %a %D : Stoping Oracle Databases as part of system down." >> /var/log/oracle echo "-------------------------------------------------" >> /var/log/oracle su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut" >>/var/log/oracle echo "Done." echo "" echo "-------------------------------------------------" >> /var/log/oracle date +" %T %a %D : Finished." >> /var/log/oracle echo "-------------------------------------------------" >> /var/log/oracle 'restart') $0 stop $0 start esac
声明: 本文由我的SEOUC技术文章主页发布于:2023-05-23 ,文章linux下oracle设置开机自启动实现方法建站知识主要讲述标签,标题,linux下oracle设置开机自启动实现方法建网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_5494.html