Data GUARD环境打PSU

下午初步看了一下文档,给Data Guard打PSU和给Data Guard升级版本应该是一个原理,那么我们先来看一看打PSU的步骤.根据MOS上的文档,我画了一个图,如下所示:

1.禁止主库向备库log shipping

SQL> alter system set log_archive_dest_state_2=defer scope=both sid='*';
System altered.

2.停止standby的监听和数据库

[oracle@dg2 ~]$ lsnrctl
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 01-AUG-2012 23:12:44
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> stop
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dg2.localdomain)(PORT=1521)))
The command completed successfully
LSNRCTL> exit 

[oracle@dg2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 1 23:12:53 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
Database altered.
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

3.给standby打PSU软件

因为我的数据库版本是11.2.0.1的,所以我下载了11.2.0.1.6的PSU补丁包.p12419378_112010_Linux-x86-64.zip,上传介质并解压后,开始打PSU.

[oracle@dg2 ~]$ export PATH=$PATH:$ORACLE_HOME/OPatch
[oracle@dg2 ~]$ opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ./12419378
Oracle Interim Patch Installer version 11.2.0.3.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.
PREREQ session
Oracle Home       : /oracle/app/oracle/product/11.2.0/db_1
Central Inventory : /oracle/app/oraInventory
    from           : /oracle/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.0
OUI version       : 11.2.0.1.0
Log file location : /oracle/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2012-08-01_23-38-17PM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.

[oracle@dg2 12419378]$ opatch apply
Oracle Interim Patch Installer version 11.2.0.3.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.
Oracle Home       : /oracle/app/oracle/product/11.2.0/db_1
Central Inventory : /oracle/app/oraInventory
    from           : /oracle/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.0
OUI version       : 11.2.0.1.0
Log file location : /oracle/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/12419378_Aug_02_2012_00_07_57/apply2012-08-02_00-07-57AM_1.log
Applying interim patch '12419378' to OH '/oracle/app/oracle/product/11.2.0/db_1'
Verifying environment and performing prerequisite checks...
Patch 12419378: Optional component(s) missing : [ oracle.client, 11.2.0.1.0 ]
All checks passed. 

Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:
You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  y
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/oracle/app/oracle/product/11.2.0/db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Patching component oracle.rdbms.rsf, 11.2.0.1.0...
Patching component oracle.rdbms.dbscripts, 11.2.0.1.0...
Patching component oracle.rdbms, 11.2.0.1.0...
Patching component oracle.oraolap, 11.2.0.1.0...
Patching component oracle.rdbms.deconfig, 11.2.0.1.0...
Patching component oracle.javavm.server, 11.2.0.1.0...
Patching component oracle.precomp.common, 11.2.0.1.0...
Patching component oracle.network.rsf, 11.2.0.1.0...
Patching component oracle.network.listener, 11.2.0.1.0...
Patching component oracle.rdbms.dv.oc4j, 11.2.0.1.0...
Patching component oracle.sdo.locator, 11.2.0.1.0...
Patching component oracle.sysman.console.db, 11.2.0.1.0...
Patching component oracle.sysman.oms.core, 10.2.0.4.2...
Patching component oracle.rdbms.dv, 11.2.0.1.0...
Patching component oracle.xdk.rsf, 11.2.0.1.0...
Patching component oracle.ldap.rsf.ic, 11.2.0.1.0...
Patching component oracle.ldap.rsf, 11.2.0.1.0...
Patching component oracle.sysman.plugin.db.main.repository, 11.2.0.1.0...
OPatch found the word "warning" in the stderr of the make command.
Please look at this stderr. You can re-run this make command.
Stderr output:  ins_precomp.mk:19: warning: overriding commands for target `pcscfg.cfg'
/oracle/app/oracle/product/11.2.0/db_1/precomp/lib/env_precomp.mk:2091: warning: ignoring old commands for target `pcscfg.cfg'
/oracle/app/oracle/product/11.2.0/db_1/precomp/lib/ins_precomp.mk:19: warning: overriding commands for target `pcscfg.cfg'
/oracle/app/oracle/product/11.2.0/db_1/precomp/lib/env_precomp.mk:2091: warning: ignoring old commands for target `pcscfg.cfg'
Verifying the update...
Patch 12419378 successfully applied
OPatch Session completed with warnings.
Log file location: /oracle/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/12419378_Aug_02_2012_00_07_57/apply2012-08-02_00-07-57AM_1.log

OPatch completed with warnings.这里出现了一些warning,根据文档Opatch warning: overriding commands for target xxxx [ID 1448337.1]里面有介绍.This is a warning only which opatch is reporting. The Patch has applied successfully and the warning output can be safely ignored.
同时需要注意的是:这里我们并不需要运行catbundle.sql脚本,因为我们给主库打完PSU后,我们会在主库上运行脚本,主库运行完后会传到备库,保持主备一致.

4.重新启动standby的监听,并mount database 

[oracle@dg2 12419378]$ lsnrctl
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 02-AUG-2012 00:55:08
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> start
Starting /oracle/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /oracle/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /oracle/app/oracle/diag/tnslsnr/dg2/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg2.localdomain)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dg2.localdomain)(PORT=1521)))
STATUS of the LISTENER   ------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                02-AUG-2012 00:55:10
Uptime                    0 days 0 hr. 0 min. 6 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /oracle/app/oracle/diag/tnslsnr/dg2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg2.localdomain)(PORT=1521)))
The listener supports no services
The command completed successfully
LSNRCTL> exit 

[oracle@dg2 12419378]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 2 00:55:29 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area  839282688 bytes
Fixed Size                  2217992 bytes
Variable Size             494929912 bytes
Database Buffers          339738624 bytes
Redo Buffers                2396160 bytes
Database mounted.

这里需要注意的是:我们的数据库只需要mount,而不需要进入recover mode.

5.停止primary的监听和数据库

[oracle@dg1 ~]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 02-AUG-2012 00:59:53
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dg1.localdomain)(PORT=1521)))
The command completed successfully
[oracle@dg1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 2 00:59:58 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

6.给primary打PSU

[oracle@dg1 ~]$ opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ./12419378
Oracle Interim Patch Installer version 11.2.0.3.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.
PREREQ session
Oracle Home       : /oracle/app/oracle/product/11.2.0/db_1
Central Inventory : /oracle/app/oraInventory
    from           : /oracle/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.0
OUI version       : 11.2.0.1.0
Log file location : /oracle/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2012-08-02_01-03-51AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.

[oracle@dg1 12419378]$ opatch apply
Oracle Interim Patch Installer version 11.2.0.3.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.
Oracle Home       : /oracle/app/oracle/product/11.2.0/db_1
Central Inventory : /oracle/app/oraInventory
    from           : /oracle/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.0
OUI version       : 11.2.0.1.0
Log file location : /oracle/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/12419378_Aug_02_2012_01_04_18/apply2012-08-02_01-04-18AM_1.log
Applying interim patch '12419378' to OH '/oracle/app/oracle/product/11.2.0/db_1'
Verifying environment and performing prerequisite checks...
Patch 12419378: Optional component(s) missing : [ oracle.client, 11.2.0.1.0 ]
All checks passed. 

Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:
You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  y
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/oracle/app/oracle/product/11.2.0/db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Patching component oracle.rdbms.rsf, 11.2.0.1.0...
Patching component oracle.rdbms.dbscripts, 11.2.0.1.0...
Patching component oracle.rdbms, 11.2.0.1.0...
Patching component oracle.oraolap, 11.2.0.1.0...
Patching component oracle.rdbms.deconfig, 11.2.0.1.0...
Patching component oracle.javavm.server, 11.2.0.1.0...
Patching component oracle.precomp.common, 11.2.0.1.0...
Patching component oracle.network.rsf, 11.2.0.1.0...
Patching component oracle.network.listener, 11.2.0.1.0...
Patching component oracle.rdbms.dv.oc4j, 11.2.0.1.0...
Patching component oracle.sdo.locator, 11.2.0.1.0...
Patching component oracle.sysman.console.db, 11.2.0.1.0...
Patching component oracle.sysman.oms.core, 10.2.0.4.2...
Patching component oracle.rdbms.dv, 11.2.0.1.0...
Patching component oracle.xdk.rsf, 11.2.0.1.0...
Patching component oracle.ldap.rsf.ic, 11.2.0.1.0...
Patching component oracle.ldap.rsf, 11.2.0.1.0...
Patching component oracle.sysman.plugin.db.main.repository, 11.2.0.1.0...
OPatch found the word "warning" in the stderr of the make command.
Please look at this stderr. You can re-run this make command.
Stderr output:
ins_precomp.mk:19: warning: overriding commands for target `pcscfg.cfg'
/oracle/app/oracle/product/11.2.0/db_1/precomp/lib/env_precomp.mk:2091: warning: ignoring old commands for target `pcscfg.cfg'
/oracle/app/oracle/product/11.2.0/db_1/precomp/lib/ins_precomp.mk:19: warning: overriding commands for target `pcscfg.cfg'
/oracle/app/oracle/product/11.2.0/db_1/precomp/lib/env_precomp.mk:2091: warning: ignoring old commands for target `pcscfg.cfg'
Verifying the update...
Patch 12419378 successfully applied
OPatch Session completed with warnings.
Log file location: /oracle/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/12419378_Aug_02_2012_01_04_18/apply2012-08-02_01-04-18AM_1.log

OPatch completed with warnings.同样的在给主库打的时候也出现了关于ins_precomp.mk的warning,这些warning是可以忽略的.

7.重新启动主库的监听和数据库

[oracle@dg1 12419378]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 02-AUG-2012 01:13:24
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Starting /oracle/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /oracle/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /oracle/app/oracle/diag/tnslsnr/dg1/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg1.localdomain)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dg1.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                02-AUG-2012 01:13:25
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /oracle/app/oracle/diag/tnslsnr/dg1/listener/alert/log.xml
Listening Endpoints Summary...     (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg1.localdomain)(PORT=1521)))
The listener supports no services
The command completed successfully 

[oracle@dg1 12419378]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 2 01:13:31 2012
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area  839282688 bytes
Fixed Size                  2217992 bytes
Variable Size             721422328 bytes
Database Buffers          113246208 bytes
Redo Buffers                2396160 bytes
Database mounted.
Database opened.

启动好了之后,就可以运行脚本

@?/rdbms/admin/catbundle psu apply

8.重启主库的log shipping.

SQL> alter system set log_archive_dest_state_2=enable scope=both sid='*';
System altered.

9,备库切换到recover mode

SQL> alter database open read only;
Database altered.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
Database altered.

10.验证PSU是否安装

-------------primary
SQL> select ACTION_TIME,ACTION,NAMESPACE,VERSION,BUNDLE_SERIES,ID from registry$history;
ACTION_TIME                         ACTION                         NAMESPACE                      VERSION                        BUNDLE_SERIES                          ID
----------------------------------- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ----------
02-AUG-12 01.17.20.881573 AM        APPLY                          SERVER                         11.2.0.1                       PSU                                     6
-------------standby
SQL> select ACTION_TIME,ACTION,NAMESPACE,VERSION,BUNDLE_SERIES,ID from registry$history;
ACTION_TIME                         ACTION                         NAMESPACE                      VERSION                        BUNDLE_SERIES                          ID
----------------------------------- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ----------
02-AUG-12 01.17.20.881573 AM        APPLY                          SERVER                         11.2.0.1                       PSU                                     6
-------------primary
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /oraarch
Oldest online log sequence     20
Next log sequence to archive   22
Current log sequence           22
-------------standby
SQL> select name,sequence#,applied from v$archived_log order by sequence# asc;
NAME                                                          SEQUENCE# APPLIED
------------------------------------------------------------ ---------- ---------
/oraarch/1_5_788362124.arc                                            5 YES
/oraarch/1_6_788362124.arc                                            6 YES
/oraarch/1_7_788362124.arc                                            7 YES
/oraarch/1_8_788362124.arc                                            8 YES
/oraarch/1_9_788362124.arc                                            9 YES
/oraarch/1_10_788362124.arc                                          10 YES
/oraarch/1_11_788362124.arc                                          11 YES
/oraarch/1_12_788362124.arc                                          12 YES
/oraarch/1_13_788362124.arc                                          13 YES
/oraarch/1_14_788362124.arc                                          14 YES
/oraarch/1_15_788362124.arc                                          15 YES
/oraarch/1_16_788362124.arc                                          16 YES
/oraarch/1_17_788362124.arc                                          17 YES
/oraarch/1_18_788362124.arc                                          18 YES
/oraarch/1_19_788362124.arc                                          19 YES
/oraarch/1_20_788362124.arc                                          20 YES
/oraarch/1_21_788362124.arc                                          21 YES
17 rows selected.

[oracle@dg1 db_1]$ opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.0   Copyright (c) 2012, Oracle Corporation.  All rights reserved.
Oracle Home       : /oracle/app/oracle/product/11.2.0/db_1
Central Inventory : /oracle/app/oraInventory
      from           : /oracle/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.0
OUI version       : 11.2.0.1.0
Log file location : /oracle/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2012-08-02_01-29-56AM_1.log
Lsinventory Output file location : /oracle/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2012-08-02_01-29-56AM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 11g                                                  11.2.0.1.0
There are 1 products installed in this Oracle Home.
Interim patches (1) :
Patch  12419378     : applied on Thu Aug 02 01:06:33 CST 2012
Unique Patch ID:  13769952
   Created on 8 Jul 2011, 02:47:43 hrs PST8PDT      Bugs fixed:
     9068088, 9363384, 8865718, 8898852, 8801119, 9054253, 8725286, 8974548
     9093300, 8909984, 8755082, 8780372, 9952216, 8664189, 8769569, 7519406
     9302343, 9471411, 8822531, 7705591, 8650719, 10205230, 9637033, 8883722
     8639114, 8723477, 8729793, 8919682, 8856478, 9001453, 8733749, 8565708
     8735201, 8684517, 8870559, 8773383, 8981059, 8812705, 9488887, 12534742
     8813366, 12534743, 9242411, 12534745, 12534746, 12534747, 8822832
     12534748, 8897784, 8760714, 12534749, 8775569, 8671349, 8898589, 9714832
     8642202, 9011088, 9369797, 9170608, 9165206, 8834636, 8891037, 8431487
     8570322, 8685253, 8872096, 8718952, 8799099, 12534750, 9032717, 9399090
     12534751, 12534752, 9713537, 9546223, 12534753, 12534754, 8588519
     8783738, 12534755, 12534756, 8834425, 9454385, 8856497, 8890026, 8721315
     10248516, 8818175, 8674263, 10249532, 9145541, 8720447, 9272086, 9467635
     9010222, 9102860, 9197917, 8991997, 8661168, 8803762, 12419378, 8769239
     9654983, 8706590, 8546356, 10408903, 8778277, 9058865, 8815639, 11724991
     9971778, 9971779, 9027691, 9454036, 9454037, 9454038, 8761974, 9255542
     9275072, 8496830, 8702892, 8818983, 8475069, 8875671, 9328668, 8891929
     8798317, 9971780, 8782959, 8774868, 8820324, 8544696, 8702535, 9952260
     9406607, 8268775, 9036013, 9363145, 8933870, 8405205, 9467727, 8822365
     9676419, 11724930, 8761260, 8790767, 8795418, 8913269, 8717461, 8861700
     9531984, 8607693, 8780281, 8330783, 8784929, 8780711, 9341448, 9015983
     10323077, 8828328, 9119194, 10323079, 8832205, 8717031, 8665189, 9482399
     9676420, 9399991, 8821286, 8633358, 9321701, 9655013, 9231605, 8796511
     9167285, 8782971, 8756598, 8703064, 9390484, 9066116, 9007102, 9461782
     10323080, 10323081, 10323082, 8753903, 8505803, 9382101, 9352237, 9216806
     8918433, 11794163, 9057443, 8790561, 11794164, 8733225, 8795792, 11794165
     11794167, 9067282, 8928276, 8837736, 9210925
--------------------------------------------------------------------------------
OPatch succeeded.

参考文档:How do you apply a Patchset,PSU or CPU in a Data Guard Physical Standby configuration [ID 278641.1]

分享到: 更多

Post a Comment

Your email is never published nor shared. Required fields are marked *