非Data Guard的補(bǔ)丁安裝教程可參考《[Oracle] CPU/PSU補(bǔ)丁安裝詳細(xì)教程》,Data Guard需要Primary和Standby同時(shí)打上補(bǔ)丁,所以步驟更復(fù)雜一些,其主要步驟如下:
1.在Primary停止日志傳輸服務(wù);
2.關(guān)閉Standby數(shù)據(jù)庫(kù),在Standby的軟件上打補(bǔ)?。ㄗ⒁猓翰恍枰獮镾tandby數(shù)據(jù)庫(kù)打補(bǔ)?。?,啟動(dòng)standby為mount狀態(tài),不啟用managed recovery;
3.關(guān)閉Primary,在Primary的軟件和數(shù)據(jù)庫(kù)本身都打上補(bǔ)?。?BR>4.啟動(dòng)Primary數(shù)據(jù)庫(kù),重新開啟日志傳輸服務(wù);
5.在Standby啟動(dòng)Redo Apply,這樣Primary上補(bǔ)丁腳本就會(huì)自動(dòng)同步至Standby;
6.檢查Primary和Standby是否都已安裝補(bǔ)丁。
下面是一個(gè)具體例子:
1. 在Primary停止日志傳輸服務(wù)
復(fù)制代碼 代碼如下:
sys@EPAY>select database_role from v$database;
DATABASE_ROLE
----------------
PRIMARY
sys@EPAY>show parameter log_archive_dest_3
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_3 string SERVICE=sta ASYNC VALID_FOR=(O
NLINE_LOGFILES,PRIMARY_ROLE) D
B_UNIQUE_NAME=epaybk
log_archive_dest_30 string
log_archive_dest_31 string
sys@EPAY>alter system set log_archive_dest_state_3=defer scope=both;
System altered.
2.在Standby的Oracle軟件打上補(bǔ)丁
2.1 關(guān)閉數(shù)據(jù)庫(kù)實(shí)例,listener,ASM實(shí)例等
2.2 查看opatch的版本,如果不夠,就去下載最新的版本
2.3 在Standby的Oracle軟件上打補(bǔ)丁
2.4 啟動(dòng)Standby到mount狀態(tài),啟動(dòng)listener
(注意:Standby不需要對(duì)數(shù)據(jù)庫(kù)本身打補(bǔ)丁)
3. 在Primary上打補(bǔ)丁
3.1 關(guān)閉數(shù)據(jù)庫(kù)實(shí)例,listener,ASM實(shí)例等
3.2 查看opatch的版本,如果不夠,就去下載最新的版本
3.3 在Primary的Oracle軟件上打補(bǔ)丁
3.4 為Primary數(shù)據(jù)庫(kù)本身打補(bǔ)丁
復(fù)制代碼 代碼如下:
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT
4. 在Primary啟動(dòng)日志傳輸服務(wù)
4.1 啟動(dòng)Primary listener,數(shù)據(jù)庫(kù)實(shí)例等
4.2 強(qiáng)制注冊(cè)services到listener
復(fù)制代碼 代碼如下:
sys@EPAY>alter system register;
System altered.
4.3 重新啟動(dòng)日志傳輸服務(wù)
復(fù)制代碼 代碼如下:
sys@EPAY>alter system set log_archive_dest_state_3=enable scope=both;
System altered.
注意:?jiǎn)?dòng)日志傳輸,在alert里有可能出現(xiàn)如下錯(cuò)誤:
復(fù)制代碼 代碼如下:
------------------------------------------------------------
Check that the primary and standby are using a password file
and remote_login_passwordfile is set to SHARED or EXCLUSIVE,
and that the SYS password is same in the password files.
returning error ORA-16191
------------------------------------------------------------
根據(jù)錯(cuò)誤信息的提示,應(yīng)該是主庫(kù)在做CPU補(bǔ)丁的時(shí)候把sys密碼修改了,用主庫(kù)的密碼文件替換備庫(kù)的密碼文件即可解決該錯(cuò)誤。
5. Standby啟動(dòng)Redo Apply
5.1 open Standby 數(shù)據(jù)庫(kù)
5.2 啟用Redo Apply
復(fù)制代碼 代碼如下:
sys@EPAY>alter database recover managed standby database disconnect from session;
Database altered.
5.3 驗(yàn)證Primary和Standby是否同步
在primary端查詢當(dāng)前最大的歸檔日志序號(hào):
復(fù)制代碼 代碼如下:
sys@EPAY>select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
159
在standby端查詢已傳過(guò)來(lái)的歸檔日志:
復(fù)制代碼 代碼如下:
sys@EPAY>select sequence#, applied from v$archived_log;
5.4 從alert.log可用看出同步了3個(gè)日志文件(即把在primary打的補(bǔ)丁同步到了standby)
復(fù)制代碼 代碼如下:
alter database recover managed standby database disconnect from session
Attempt to start background Managed Standby Recovery process (epay)
Wed Jul 10 06:03:48 2013
MRP0 started with pid=29, OS id=15030
MRP0: Background Managed Standby Recovery process started (epay)
started logmerger process
Wed Jul 10 06:03:53 2013
Managed Standby Recovery not using Real Time Apply
Wed Jul 10 06:04:01 2013
Parallel Media Recovery started with 32 slaves
Waiting for all non-current ORLs to be archived...
All non-current ORLs have been archived.
Wed Jul 10 06:04:01 2013
Completed: alter database recover managed standby database disconnect from session
Media Recovery Log /data/oradata/epay/archivelog/1_157_814716635.dbf
Media Recovery Log /data/oradata/epay/archivelog/1_158_814716635.dbf
Media Recovery Log /data/oradata/epay/archivelog/1_159_814716635.dbf
Media Recovery Waiting for thread 1 sequence 160 (in transit)
6. 后期檢查補(bǔ)丁是否安裝成功
6.1 在primary, standby分別指向opatch lsinventory
6.2 在數(shù)據(jù)庫(kù)里檢查補(bǔ)丁是否安裝成功
您可能感興趣的文章:- VMware中l(wèi)inux環(huán)境下oracle安裝圖文教程(二)ORACLE 10.2.05版本的升級(jí)補(bǔ)丁安裝
- [Oracle] CPU/PSU補(bǔ)丁安裝詳細(xì)教程
- Oracle數(shù)據(jù)庫(kù)opatch補(bǔ)丁操作流程