[Oracle] Data Guard CPU/PSU补丁安装详细教程
非Data Guard的补丁安装教程可参考《 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 在数据库里检查补丁是否安装成功
https://www.uoften.com/dbs/oracle/20180415/72964.html
页:
[1]