您好,登錄后才能下訂單哦!
在linux下配置oracle自動啟動腳本:
[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 正在啟動lsnrctl start...." su - oracle -c 'lsnrctl start' &>>/var/log/oracle echo -e "\t\t 正在啟動dbstart...." su - oracle -c 'dbstart' &>>/var/log/oracle echo -e "\t\t 正在啟動emctl start dbconsole...." su - oracle -c 'emctl start dbconsole' &>>/var/log/oracle echo -e "\t\t\t 啟動成功!!" 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ù)暫時只添加了啟動|關(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ù)暫時只添加了啟動|關(guān)閉 [root@test ~]# service oracle start 2015-10-17 09:12:41 正在啟動lsnrctl start.... 正在啟動dbstart.... 正在啟動emctl start dbconsole.... 啟動成功??! 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版本做實驗時,oracle啟動腳本中需要添加才能在chkconfig中添加oracle服務(wù),否則會報服務(wù)不支持
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。