[Oracle] Data Guard CPU/PSU補丁安裝詳細教程_oracle

來源:互聯網
上載者:User
非Data Guard的補丁安裝教程可參考《[Oracle] CPU/PSU補丁安裝詳細教程》,Data Guard需要Primary和Standby同時打上補丁,所以步驟更複雜一些,其主要步驟如下:
1.在Primary停止日誌傳輸服務;
2.關閉Standby資料庫,在Standby的軟體上打補丁(注意:不需要為Standby資料庫打補丁),啟動standby為mount狀態,不啟用managed recovery;
3.關閉Primary,在Primary的軟體和資料庫本身都打上補丁;
4.啟動Primary資料庫,重新開啟日誌傳輸服務;
5.在Standby啟動Redo Apply,這樣Primary上補丁指令碼就會自動同步至Standby;
6.檢查Primary和Standby是否都已安裝補丁。
下面是一個具體例子:
1. 在Primary停止日誌傳輸服務
複製代碼 代碼如下:

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軟體打上補丁
2.1 關閉資料庫執行個體,listener,ASM執行個體等
2.2 查看opatch的版本,如果不夠,就去下載最新的版本
2.3 在Standby的Oracle軟體上打補丁
2.4 啟動Standby到mount狀態,啟動listener
(注意:Standby不需要對資料庫本身打補丁)

3. 在Primary上打補丁
3.1 關閉資料庫執行個體,listener,ASM執行個體等
3.2 查看opatch的版本,如果不夠,就去下載最新的版本
3.3 在Primary的Oracle軟體上打補丁
3.4 為Primary資料庫本身打補丁
複製代碼 代碼如下:

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT

4. 在Primary開機記錄傳輸服務
4.1 啟動Primary listener,資料庫執行個體等
4.2 強制註冊services到listener
複製代碼 代碼如下:

sys@EPAY>alter system register;
System altered.

4.3 重新開機記錄傳輸服務
複製代碼 代碼如下:

sys@EPAY>alter system set log_archive_dest_state_3=enable scope=both;
System altered.

注意:開機記錄傳輸,在alert裡有可能出現如下錯誤:
複製代碼 代碼如下:

------------------------------------------------------------
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
------------------------------------------------------------

根據錯誤資訊的提示,應該是主庫在做CPU補丁的時候把sys密碼修改了,用主庫的密碼檔案替換備庫的密碼檔案即可解決該錯誤。
5. Standby啟動Redo Apply
5.1 open Standby 資料庫
5.2 啟用Redo Apply
複製代碼 代碼如下:

sys@EPAY>alter database recover managed standby database disconnect from session;
Database altered.

5.3 驗證Primary和Standby是否同步
在primary端查詢當前最大的歸檔日誌序號:
複製代碼 代碼如下:

sys@EPAY>select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
           159

在standby端查詢已傳過來的歸檔日誌:
複製代碼 代碼如下:

sys@EPAY>select sequence#, applied from v$archived_log;

5.4 從alert.log可用看出同步了3個記錄檔(即把在primary打的補丁同步到了standby)
複製代碼 代碼如下:

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. 後期檢查補丁是否安裝成功
6.1 在primary, standby分別指向opatch lsinventory
6.2 在資料庫裡檢查補丁是否安裝成功
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.