配置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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Windows下Oracle 11gR2例項啟動WindowsOracle
- 配置單例項自動重啟單例
- ORACLE 11gR2 單例項資料庫自啟Oracle單例資料庫
- oracle 11gR2 asm例項 不能啟動處理方法OracleASM
- Linux中設定oracle例項和asm同時隨機自動啟動LinuxOracleASM隨機
- Oracle單例項+ASM啟動與關閉Oracle單例ASM
- Oracle之 服務啟動&停止指令碼與開機自啟動(單例項)Oracle指令碼單例
- oracle 11gR2 配置goldengate連線asm例項OracleGoASM
- 在Windows平臺下修改Oracle例項不隨服務啟動WindowsOracle
- 11GR2 Active Duplicate過程(單例項對單例項)單例
- 單機環境配置ASM例項ASM
- 2 Day DBA-管理Oracle例項-關閉和啟動Oracle例項-使用OEMDC關閉和啟動Oracle例項Oracle
- 啟動CRS單例項、設定自動啟動單例
- 自動重新啟動oracle例項 for windowsOracleWindows
- jquery隨機瀑布流簡單程式碼例項jQuery隨機
- 配置 Oracle 11gR2 在 CentOS6 上開機自啟動OracleCentOS
- 啟動oracle例項最少引數Oracle
- oracle多個例項啟動方法Oracle
- 【Oracle】ORA-01078 ORA-29701 11gR2 ASM單例項重啟系統後不能啟動OracleASM單例
- 2 Day DBA-管理Oracle例項-關於例項的啟動和關閉-關於例項啟動Oracle
- Oracle 11g RAC 配置單例項 DataGuardOracle單例
- Oracle例項的啟動和關閉Oracle
- 11gR2啟動ASM例項時遭遇ORA-29701ASM
- 單機環境安裝配置ASM例項ASM
- oracle rac及單例項開啟歸檔Oracle單例
- windows下啟動服務時不啟動oracle例項WindowsOracle
- 在solaris10單例項配置oracle10g asm執行css不啟動處理單例OracleASMCSS
- ORA-29702複製RAC Oracle軟體啟動單例項Oracle單例
- oracle配置開機自啟動Oracle
- Oracle 最簡單的隨系統自動啟動Oracle
- 【轉】11gR2啟動ASM例項時遭遇ORA-29701ASM
- mysql例項停止、啟動、配置遠端訪問MySql
- oracle例項啟動異常慢案例一Oracle
- oracle 例項啟動和關閉解讀Oracle
- Oracle Restart啟動資料庫例項故障一例OracleREST資料庫
- linux下單例項資料庫開機自啟動設定Linux單例資料庫
- Oracle 11GR2 在CentOS 7 上的單例項靜默安裝OracleCentOS單例
- Oracle 11gR2單例項資料庫補丁升級記錄Oracle單例資料庫