標籤:des style blog http color io os ar for
Oracle 最簡單的隨系統自動啟動
俗話說使用者是上帝,他們有時候提出一個問題非常的簡單,就只需要一句話,一分鐘就完事了,但是拿到我們DBA來說,可能至少得半個小時甚至半個月才能滿足他的一句話,有沒有更好更快的辦法呢,我告訴大家這是有的;
我就拿一個例子來說,使用者通常都會為了維護簡單,需要資料庫自動隨系統啟動,一句非常簡單的話,但是拿給DBA來說至少得多花半個小時的時間來配置實現這個功能。那麼今天你看完這篇文檔之後,可以在他的話還沒有說完就可以完成自啟動的配置,非常簡單。
一、配置自動
1、添加啟動項[[email protected] ~]# cat >> /etc/rc.d/rc.local <<EOFsu - oracle -c "lsnrctl start"su - oracle -c "sqlplus sys/oracle as sysdba @/home/oracle/.script/.startup"su - oracle -c "emctl start dbconsole"EOF2、建立並編輯開機檔案[[email protected] ~]#su - oracle[[email protected] ~]#mkdir -p /home/oracle/.script/[[email protected] ~]# cat > /home/oracle/.script/.startup <<EOFstartup;alter system register;exit 0EOF
二、重啟驗證:
三、確定資料庫和EM以及監聽是否都已經起來
###監聽狀態[[email protected] ~]$ lsnrctl statusLSNRCTL for Linux: Version 11.2.0.3.0 - Production on 03-OCT-2014 07:26:22Copyright (c) 1991, 2011, Oracle. All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.3.0 - ProductionStart Date 03-OCT-2014 07:13:54Uptime 0 days 0 hr. 12 min. 28 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /DBSoft/Product/11.2.3/db_1/network/admin/listener.oraListener Log File /DBSoft/diag/tnslsnr/db01/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db01)(PORT=1521)))Services Summary...Service "woo" has 1 instance(s). Instance "woo", status READY, has 1 handler(s) for this service...Service "wooXDB" has 1 instance(s). Instance "woo", status READY, has 1 handler(s) for this service...The command completed successfully###資料庫狀態SQL> select instance_name,host_name,status from v$instance;INSTANCE_N HOST_NAME STATUS---------- ---------- ------------woo db01 OPEN###EM狀態[[email protected] ~]$ emctl status dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.3.0 Copyright (c) 1996, 2011 Oracle Corporation. All rights reserved.https://db01:1158/em/console/aboutApplicationOracle Enterprise Manager 11g is running. ------------------------------------------------------------------Logs are generated in directory /DBSoft/Product/11.2.3/db_1/db01_woo/sysman/log
至此我們已經確定,這樣也可以將資料庫配置為自動啟動,且比Oralce推薦的老方法更為簡單,老方法見如下連結:
Linux 下 Oracle隨系統自動啟動和關閉(老方法)
Oracle 最簡單的隨系統自動啟動