在linux下配置oracle自動(dòng)啟動(dòng)腳本:
孝義網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),孝義網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為孝義成百上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站制作要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的孝義做網(wǎng)站的公司定做!
[root@test ~]# vim /etc/init.d/oracle
#!/bin/bash #chkconfig:35 99 01 case "$1" in start) echo -e "\n\t\t `date +%F` `date +%T`" echo -e "\t\t 正在啟動(dòng)lsnrctl start...." su - oracle -c 'lsnrctl start' &>>/var/log/oracle echo -e "\t\t 正在啟動(dòng)dbstart...." su - oracle -c 'dbstart' &>>/var/log/oracle echo -e "\t\t 正在啟動(dòng)emctl start dbconsole...." su - oracle -c 'emctl start dbconsole' &>>/var/log/oracle echo -e "\t\t\t 啟動(dòng)成功!!" echo -e "\t\t `date +%F` `date +%T`\n" ;; stop) echo -e "\n\t\t `date +%F` `date +%T`" echo -e "\t\t 正在關(guān)閉emctl stop dbconsole...." su - oracle -c 'emctl stop dbconsole' &>>/var/log/oracle echo -e "\t\t 正在關(guān)閉dbshut...." su - oracle -c 'dbshut' &>>/var/log/oracle echo -e "\t\t 正在關(guān)閉lsnrctl stop...." su - oracle -c 'lsnrctl stop' &>>/var/log/oracle echo -e "\t\t\t 關(guān)閉完畢??!" echo -e "\t\t `date +%F` `date +%T`\n" ;; *) echo -e "\n\t\t Usage:oracle{start|stop} 該服務(wù)暫時(shí)只添加了啟動(dòng)|關(guān)閉\n" ;; esac
[root@test ~]# chmod a+x /etc/init.d/oracle [root@test ~]# ll /etc/init.d/oracle -rwxr-xr-x 1 root root 1012 10月 16 23:38 /etc/init.d/oracle [root@test ~]# chkconfig --add oracle [root@test ~]# chkconfig --list oracle oracle 0:關(guān)閉 1:關(guān)閉 2:關(guān)閉 3:啟用 4:關(guān)閉 5:啟用 6:關(guān)閉 [root@test ~]# service oracle stop 2015-10-17 09:11:04 正在關(guān)閉emctl stop dbconsole.... 正在關(guān)閉dbshut.... 正在關(guān)閉lsnrctl stop.... 關(guān)閉完畢??! 2015-10-17 09:12:30 [root@test ~]# service oracle stll Usage:oracle{start|stop} 該服務(wù)暫時(shí)只添加了啟動(dòng)|關(guān)閉 [root@test ~]# service oracle start 2015-10-17 09:12:41 正在啟動(dòng)lsnrctl start.... 正在啟動(dòng)dbstart.... 正在啟動(dòng)emctl start dbconsole.... 啟動(dòng)成功!! 2015-10-17 09:18:47 [root@test ~]# su - oracle [oracle@test ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Sat Oct 17 09:20:15 2015 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select status from v$instance; STATUS ------------ OPEN SQL>
——————————————————————————————————
#description:auto_run //用linux5版本做實(shí)驗(yàn)時(shí),oracle啟動(dòng)腳本中需要添加才能在chkconfig中添加oracle服務(wù),否則會(huì)報(bào)服務(wù)不支持