配置Oracle單例項隨機啟動(11gR2)
系統資訊:
beiora01:/home/oracle> uname -a
Linux beiora01a.bskyb.com 2.6.18-348.6.1.el5 #1 SMP Tue May 21 15:29:55 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
Linux beiora01a.bskyb.com 2.6.18-348.6.1.el5 #1 SMP Tue May 21 15:29:55 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
資料庫資訊:
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
1. 使用root使用者編輯如下檔案
vi /etc/init.d/dbora
#!/bin/sh # chkconfig: 345 99 10 # description: Oracle auto start-stop script. # # Set ORA_OWNER to the user id of the owner of the # Oracle database software. ORA_OWNER=oracle case "$1" in 'start') # Start the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values # Remove "&" if you don't want startup as a background process. su $ORA_OWNER -c "/home/oracle/scripts/startup.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1" & touch /var/lock/subsys/dbora ;; 'stop') # Stop the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su $ORA_OWNER -c "/home/oracle/scripts/shutdown.sh >> /home/oracle/scripts/startup_shutdown.log 2>&1" rm -f /var/lock/subsys/dbora ;; esac
修改許可權
chmod 750 /etc/init.d/dbora
chkconfig --add dbora
2. 建立自動啟動和關閉資料庫的指令碼
# mkdir -p /home/oracle/scripts # chown oracle.oinstall /home/oracle/scripts
vi /home/oracle/scripts/startup.sh
注意修改紅體自變數
#!/bin/bash
export TMP=/tmp
export TMPDIR=$TMP
export PATH=/usr/sbin:/usr/local/bin:$PATH export ORACLE_HOSTNAME=localhost.localdomain
export ORACLE_UNQNAME=phyprimary
export ORACLE_SID=phyprimary ORAENV_ASK=NO
. oraenv
ORAENV_ASK=YES
# Start Listener
lsnrctl start
# Start Database
sqlplus / as sysdba << EOF
STARTUP;
EXIT;
EOF
vi /home/oracle/scripts/shutdown.sh
注意修改紅體字變數
#!/bin/bash
export TMP=/tmp
export TMPDIR=$TMP
export PATH=/usr/sbin:/usr/local/bin:$PATH export ORACLE_HOSTNAME=localhost.localdomain
export ORACLE_UNQNAME=phyprimary
export ORACLE_SID=phyprimary ORAENV_ASK=NO
. oraenv
ORAENV_ASK=YES
# Stop Database
sqlplus / as sysdba << EOF
SHUTDOWN IMMEDIATE;
EXIT;
EOF
# Stop Listener
lsnrctl stop
3. 確認指令碼許可權
[root@localhost ~]# chmod u+x /home/oracle/scripts/startup.sh /home/oracle/scripts/shutdown.sh
[root@localhost ~]# chown oracle.oinstall /home/oracle/scripts/startup.sh /home/oracle/scripts/shutdown.sh
4. 測試實驗結果
# service dbora start # service dbora stop
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29734436/viewspace-1257948/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle 10203啟動例項報警Oracle
- Oracle 11gR2 ASM例項記憶體管理OracleASM記憶體
- ORA-29702複製RAC Oracle軟體啟動單例項Oracle單例
- oracle例項啟動異常慢案例一Oracle
- oracle配置開機自啟動Oracle
- 3.1.5 啟動例項
- OpenStack Q版雙機部署-啟動例項
- 一步一步搭建11gR2 rac+dg之配置單例項的DG(八)單例
- java_隨機數(統計例項)Java隨機
- oracle之 單例項監聽修改埠Oracle單例
- Oracle 單機配置DataGuardOracle
- C++學習隨筆——簡單的單例設計模式例項C++單例設計模式
- canal同步mysql,監聽單例項,多例項配置MySql單例
- Oracle 11gR2 RAC 單網路卡轉雙網路卡繫結配置Oracle
- 2.4.9 Step 8: 啟動例項
- 3.1.5.9 啟動遠端例項
- Oracle RAC 11gR2開啟歸檔Oracle
- [20191128]11GR2 asm例項audit檔案.txtASM
- shell動態修改yml配置例項
- 3.1.5.5 啟動例項到限制模式模式
- Oracle 11g RAC到單例項OGG同步Oracle單例
- oracle一個listener偵聽多個例項的配置Oracle
- 4.1. Oracle例項Oracle
- Oracle Far Sync例項Oracle
- 開機啟動項
- 2.4.15 Step 14: (可選) 開啟自動例項啟動
- oracle 12c RAC安裝,例項不能多節點同時啟動Oracle
- 前端學習程式碼例項-JavaScript 生成隨機數前端JavaScript隨機
- Oracle 11gR2 RAC 叢集服務啟動與關閉總結Oracle
- JavaScript隨滑鼠晃動的div塊程式碼例項JavaScript
- oracle資料庫與oracle例項Oracle資料庫
- 3.1.4 準備啟動一個例項
- ORACLE-LINUX環境字元介面單例項安裝OracleLinux字元單例
- Oracle 11G資料庫單例項安裝Oracle資料庫單例
- 【PSU】Oracle打PSU及解除安裝PSU(單例項)Oracle單例
- TRIZ 機械振動原理 例項
- 配置高效能動態網站(例項)網站
- oracle 例項表查詢Oracle
- 麒麟 V10 一鍵安裝 Oracle 11GR2(231017)單機版 2Oracle