Oracle 11G R2(11.0.2.4.0) DG打PSU(11.0.2.4.0.171017)

#oracle_home备份 

$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/db_1

$pwd
/u01/app/backup
$
$nohup tar -cvf db_1.tar /u01/app/oracle/product/11.2.0/db_1 &

1 OPatch Utility
      You must use the OPatch utility version 11.2.0.3.6 or later to apply this patch. 
  DG主库备库opatch utility备份
  
###主库
[oracle@test2 db_1]$ pwd
/u01/app/oracle/product/11.2.0/db_1
[oracle@test2 db_1]$ 
[oracle@test2 db_1]$ mv OPatch OPatch_bak20171228
[oracle@test2 patch]$ pwd
/u01/app/patch
[oracle@test2 patch]$ unzip p6880880_112000_Linux-x86-64.zip -d /u01/app/oracle/product/11.2.0/db_1  
[oracle@test2 OPatch]$ pwd
/u01/app/oracle/product/11.2.0/db_1/OPatch
[oracle@test2 OPatch]$ 
[oracle@test2 OPatch]$ ./opatch version
OPatch Version: 11.2.0.3.17
OPatch succeeded.  
  
###备库
[oracle@test1 db_1]$ pwd
/u01/app/oracle/product/11.2.0/db_1
[oracle@test1 db_1]$ 
[oracle@test1 db_1]$ mv OPatch OPatch_bak20171228


[oracle@test1 patch]$ pwd
/u01/app/patch


[oracle@test1 patch]$ ll -athr
总用量 229M
drwxrwxr-x 6 oracle oinstall 4.0K 12月 28 14:51 ..
-rw-r--r-- 1 oracle oinstall 102M 12月 28 14:52 p6880880_112000_Linux-x86-64.zip
drwxr-xr-x 2 oracle oinstall 4.0K 12月 28 14:52 .
-rw-r--r-- 1 oracle oinstall 128M 12月 28 14:52 p26392168_112040_Linux-x86-64.zip
[oracle@test1 patch]$ 
[oracle@test1 patch]$ unzip p6880880_112000_Linux-x86-64.zip -d /u01/app/oracle/product/11.2.0/db_1  
[oracle@test1 db_1]$ pwd
/u01/app/oracle/product/11.2.0/db_1
[oracle@test1 db_1]$ 
[oracle@test1 db_1]$ cd OPatch
[oracle@test1 OPatch]$ ./opatch version
OPatch Version: 11.2.0.3.17
OPatch succeeded.  
  
  
2.Environment Checks
     Ensure that the $PATH definition has the following executables: make, ar, ld, and nm.
The location of these executables depends on your operating system. On many operating systems, they are located in /usr/ccs/bin, in which case you can set your PATH definition as follows:
export PATH=$PATH:/usr/ccs/bin  


###主库
[oracle@test2 ~]$ which make ar ld  nm
/usr/bin/make
/usr/bin/ar
/usr/bin/ld
/usr/bin/nm


###备库
[oracle@test1 ~]$ which make ar ld  nm
/usr/bin/make
/usr/bin/ar
/usr/bin/ld
/usr/bin/nm



3.One-off Patch Conflict Detection and Resolution
     Determine whether any currently installed one-off patches conflict with the PSU patch as follows:
unzip p26392168_112040_<platform>.zip
cd 26392168
opatch prereq CheckConflictAgainstOHWithDetail -ph ./

-----------------------------------------------------------------


查看补丁是否存在冲突


###主库  
[oracle@test2 ~]$ cd /u01/app/patch/
[oracle@test2 patch]$ ll -athr
总用量 229M
drwxrwxr-x 6 oracle oinstall 4.0K 12月 28 13:41 ..
-rw-r--r-- 1 oracle oinstall 102M 12月 28 14:40 p6880880_112000_Linux-x86-64.zip
-rw-r--r-- 1 oracle oinstall 128M 12月 28 14:40 p26392168_112040_Linux-x86-64.zip
drwxr-xr-x 2 oracle oinstall 4.0K 12月 28 14:44 .
[oracle@test2 patch]$ 
[oracle@test2 patch]$ unzip p26392168_112040_Linux-x86-64.zip 
[oracle@test2 patch]$ cd 26392168/
[oracle@test2 26392168]$ 
[oracle@test2 26392168]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle 中间补丁程序安装程序版本 11.2.0.3.17
版权所有 (c) 2017, Oracle Corporation。保留所有权利。
PREREQ session
Oracle Home       : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.17
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-12-28_15-05-03下午_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.


###备库
[oracle@test1 ~]$ cd /u01/app/patch/
[oracle@test1 patch]$ ll -athr
总用量 229M
drwxrwxr-x 6 oracle oinstall 4.0K 12月 28 14:51 ..
-rw-r--r-- 1 oracle oinstall 102M 12月 28 14:52 p6880880_112000_Linux-x86-64.zip
drwxr-xr-x 2 oracle oinstall 4.0K 12月 28 14:52 .
-rw-r--r-- 1 oracle oinstall 128M 12月 28 14:52 p26392168_112040_Linux-x86-64.zip
[oracle@test1 patch]$ 
[oracle@test1 patch]$ unzip p26392168_112040_Linux-x86-64.zip 
[oracle@test1 patch]$ cd 26392168/
[oracle@test1 26392168]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle 中间补丁程序安装程序版本 11.2.0.3.17
版权所有 (c) 2017, Oracle Corporation。保留所有权利。
PREREQ session
Oracle Home       : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.17
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-12-28_15-08-36下午_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.


OVERALL STEPS


4. ===Disable REDO transport on Primary.
Disable the log_archive_destination used to ship archives from the primary to the standby site using sqlplus.


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

-------------------------------------------------------------------------------
【主库】
SQL> alter system set log_archive_dest_state_2=defer scope=both sid='*';
System altered.
SQL>
SQL> show parameter log_archive_dest_state_2
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_2             string      DEFER



5. ====Shutdown the standby site and apply interim patchsets to the RDBMS binaries as per the README. 
This includes Patchset/Patchset Update(PSU)/Critical Patch Update (CPU). Post upgrade changes must 
come via REDO transport(catpatch.sql etc) against the standby rdbms itself.  Start the standby site to mount only, 
do not restart managed recovery. Shutdown ALL processes running from Standby ORACLE_HOME. 
This will include all listeners, database instances, ASM instances etc running from the home to patched

 ====at standyb db sites



5.1 停止监听与关闭备库DB
$lsnrtl stop
sqllus / as sysdba
sql>shutdown immediate;

-----------------------------------------------------
【备库】
[oracle@test1 admin]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-DEC-2017 15:12:57
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.138.24.249)(PORT=1521)))
The command completed successfully
[oracle@test1 admin]$ 
[oracle@test1 admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 28 15:13:08 2017
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.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.


Once the new release of OPatch is in place apply the patch to the Standby Site
Please Note: In the Standby Site only the patching of the binaries is performed, there is no need to run the catupgrade/catcpu/catbundle.sql script as this will be performed through redo apply at the Standby Site.
The example below is applying the patch to a Single Instance Standby Site and its applying PSU Patch 26392168.

5.2 备库opatch apply

注:opatch apply前,数据库的监听,实例都要关闭,sqlplus也要退出.


cd 26392168
[oracle@standby 26392168]$ opatch apply 

----------------------------------------------------------------------------------------
【备库】
[oracle@test1 ~]$ cd /u01/app/patch/
[oracle@test1 patch]$ cd 26392168/
[oracle@test1 26392168]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch apply

Oracle 中间补丁程序安装程序版本 11.2.0.3.17
版权所有 (c) 2017, Oracle Corporation。保留所有权利。
Oracle Home       : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.17
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-12-28_15-32-39下午_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   24732075  25869727  26609445  26392168  


是否继续? [y|n]
y
User Responded with: Y
All checks passed.
提供电子邮件地址以用于接收有关安全问题的通知, 安装 Oracle Configuration Manager 并启动它。如果您使用 My Oracle
Support 电子邮件地址/用户名, 操作将更简单。
有关详细信息, 请访问 http://www.oracle.com/support/policies.html。
电子邮件地址/用户名: 
尚未提供电子邮件地址以接收有关安全问题的通知。
是否不希望收到有关安全问题 (是 [Y], 否 [N]) [N] 的通知:  y
请关闭本地系统上在此 ORACLE_HOME 之外运行的 Oracle 实例。
(Oracle 主目录 = '/u01/app/oracle/product/11.2.0/db_1')


本地系统是否已准备打补丁? [y|n]
y
User Responded with: Y
Backing up files...
Applying sub-patch '24732075' to OH '/u01/app/oracle/product/11.2.0/db_1'
正在为组件 oracle.precomp.common, 11.2.0.4.0 打补丁...
正在为组件 oracle.sysman.plugin.db.main.agent, 11.2.0.4.0 打补丁...
正在为组件 oracle.sqlplus.ic, 11.2.0.4.0 打补丁...
正在为组件 oracle.sqlplus, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.util, 11.2.0.4.0 打补丁...
正在为组件 oracle.ordim.client, 11.2.0.4.0 打补丁...
正在为组件 oracle.ordim.jai, 11.2.0.4.0 打补丁...
正在为组件 oracle.ordim.server, 11.2.0.4.0 打补丁...
Applying sub-patch '25869727' to OH '/u01/app/oracle/product/11.2.0/db_1'
ApplySession: Oracle 主目录中不存在可选组件 [ oracle.oid.client, 11.2.0.4.0 ] , 或找到更高版本。
正在为组件 oracle.ldap.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.oracore.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.rman, 11.2.0.4.0 打补丁...
Applying sub-patch '26609445' to OH '/u01/app/oracle/product/11.2.0/db_1'
正在为组件 oracle.oracore.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms, 11.2.0.4.0 打补丁...
Applying sub-patch '26392168' to OH '/u01/app/oracle/product/11.2.0/db_1'
ApplySession: Oracle 主目录中不存在可选组件 [ oracle.oid.client, 11.2.0.4.0 ] , 或找到更高版本。
正在为组件 oracle.network.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.ldap.client, 11.2.0.4.0 打补丁...
正在为组件 oracle.sysman.agent, 10.2.0.4.5 打补丁...
正在为组件 oracle.xdk, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms, 11.2.0.4.0 打补丁...
正在为组件 oracle.network.listener, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.dbscripts, 11.2.0.4.0 打补丁...
正在为组件 oracle.nlsrtl.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.xdk.parser.java, 11.2.0.4.0 打补丁...
正在为组件 oracle.xdk.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.rman, 11.2.0.4.0 打补丁...
Composite patch 26392168 successfully applied.
Log file location: /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-12-28_15-32-39下午_1.log
OPatch succeeded.


5.3备库启动监听与启动到mount状态.

Start the Standby Site database to mount and restart the listener(s).

$lsnrctl start
SQL>startup mount;

-------------------------------------------------------------------------------------
【备库】
[oracle@test1 ~]$ lsnrctl start


LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-DEC-2017 15:41:06
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/test1/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.24.249)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.138.24.249)(PORT=1521)))
STATUS of the LISTENER
-------------------------------------------------------------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                28-DEC-2017 15:41:06
Uptime                    0 days 0 hr. 0 min. 1 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/test1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.24.249)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl1" has 1 instance(s).
  Instance "orcl1", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@test1 ~]$ 
[oracle@test1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 28 15:41:12 2017
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to an idle instance.


SQL> startup mount
ORACLE instance started.
Total System Global Area 1787138048 bytes
Fixed Size                  2254104 bytes
Variable Size            1073744616 bytes
Database Buffers          704643072 bytes
Redo Buffers                6496256 bytes
Database mounted.


6. ====Shutdown the primary site, apply the Patchset/PSU/CPU patch to the RDBMS binaries and patch the RDBMS itself using the instructions in the README (run catpatch/catbundle/catcpu etc).


NOTE: The latest Patchsets for Oracle 11gR2 (11.2.0) require to be installed into a new ORACLE_HOME. So mind to reset your Environment and copy corresponding Files (like SPFILE, Network Files,..) to the new ORACLE_HOME, too. Follow the Database Upgrade Guide for further Details.

at primary sites
 
 6.1 停止监听与DB


$lsnrctl stop
SQL>shutdown immediate;


------------------------------------------------------------------------------
【主库】
[oracle@test2 ~]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-DEC-2017 15:43:55
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.138.24.248)(PORT=1521)))
The command completed successfully
[oracle@test2 ~]$ 
[oracle@test2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 28 15:44:05 2017
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.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.


确认oracle进程是否存在,如果存在杀掉oracle进程.
[oracle@test2 ~]$ ps -ef |grep ora



  6.2  Upgrade/Patch the RDBMS and dictionary objects. 
  The example below once again shows patch application to a single instance (non-RAC) Primary Site and is applying PSU 26392168.
  
cd 26392168
[oracle@primary 26392168]$ opatch apply   
$cd $ORACLE_HOME/rdbms/admin
$sqlplus / as sysdba
SQL>startup restrict
SQL>@catbundle psu apply
SQL>@utlrp.sql
...
SQL>commit;


---------------------------------------------------------------------------------------------------------------------------------
【主库】
[oracle@test2 ~]$ cd /u01/app/patch/26392168/
[oracle@test2 26392168]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch apply


Oracle 中间补丁程序安装程序版本 11.2.0.3.17
版权所有 (c) 2017, Oracle Corporation。保留所有权利。
Oracle Home       : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.17
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-12-28_15-53-47下午_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   24732075  25869727  26609445  26392168  


是否继续? [y|n]
y
User Responded with: Y
All checks passed.
提供电子邮件地址以用于接收有关安全问题的通知, 安装 Oracle Configuration Manager 并启动它。如果您使用 My Oracle
Support 电子邮件地址/用户名, 操作将更简单。
有关详细信息, 请访问 http://www.oracle.com/support/policies.html。
电子邮件地址/用户名: 
尚未提供电子邮件地址以接收有关安全问题的通知。
是否不希望收到有关安全问题 (是 [Y], 否 [N]) [N] 的通知:  y
请关闭本地系统上在此 ORACLE_HOME 之外运行的 Oracle 实例。
(Oracle 主目录 = '/u01/app/oracle/product/11.2.0/db_1')


本地系统是否已准备打补丁? [y|n]
y
User Responded with: Y
Backing up files...
Applying sub-patch '24732075' to OH '/u01/app/oracle/product/11.2.0/db_1'
正在为组件 oracle.precomp.common, 11.2.0.4.0 打补丁...
正在为组件 oracle.sysman.plugin.db.main.agent, 11.2.0.4.0 打补丁...
正在为组件 oracle.sqlplus.ic, 11.2.0.4.0 打补丁...
正在为组件 oracle.sqlplus, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.util, 11.2.0.4.0 打补丁...
正在为组件 oracle.ordim.client, 11.2.0.4.0 打补丁...
正在为组件 oracle.ordim.jai, 11.2.0.4.0 打补丁...
正在为组件 oracle.ordim.server, 11.2.0.4.0 打补丁...
Applying sub-patch '25869727' to OH '/u01/app/oracle/product/11.2.0/db_1'
ApplySession: Oracle 主目录中不存在可选组件 [ oracle.oid.client, 11.2.0.4.0 ] , 或找到更高版本。
正在为组件 oracle.ldap.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.oracore.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.rman, 11.2.0.4.0 打补丁...
Applying sub-patch '26609445' to OH '/u01/app/oracle/product/11.2.0/db_1'
正在为组件 oracle.oracore.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms, 11.2.0.4.0 打补丁...
Applying sub-patch '26392168' to OH '/u01/app/oracle/product/11.2.0/db_1'
ApplySession: Oracle 主目录中不存在可选组件 [ oracle.oid.client, 11.2.0.4.0 ] , 或找到更高版本。
正在为组件 oracle.network.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.ldap.client, 11.2.0.4.0 打补丁...
正在为组件 oracle.sysman.agent, 10.2.0.4.5 打补丁...
正在为组件 oracle.xdk, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms, 11.2.0.4.0 打补丁...
正在为组件 oracle.network.listener, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.dbscripts, 11.2.0.4.0 打补丁...
正在为组件 oracle.nlsrtl.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.xdk.parser.java, 11.2.0.4.0 打补丁...
正在为组件 oracle.xdk.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.rman, 11.2.0.4.0 打补丁...
Composite patch 26392168 successfully applied.
Log file location: /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-12-28_15-53-47下午_1.log


OPatch succeeded.




【主库】
[oracle@test2 ~]$ cd /u01/app/oracle/product/11.2.0/db_1/rdbms/admin/
[oracle@test2 admin]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 28 16:01:22 2017
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
Connected to an idle instance.


SQL> startup restrict
ORACLE instance started.
Total System Global Area 1787138048 bytes
Fixed Size                  2254104 bytes
Variable Size            1006635752 bytes
Database Buffers          771751936 bytes
Redo Buffers                6496256 bytes
Database mounted.
Database opened.
SQL> 
SQL> select instance_name,status,logins from v$instance;
INSTANCE_NAME    STATUS       LOGINS
---------------- ------------ ----------
orcl1            OPEN         RESTRICTED
SQL>
SQL>@catbundle psu apply
SQL>@utlrp.sql
...
SQL>commit;
SQL>
SQL>


7. =====Start the primary site, re-enable log shipping to the standby. 

  7.1 开启监听

$lsnrctl start

----------------------------------------------------------------------------------
【主库】
[oracle@test2 ~]$ lsnrctl start


LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-DEC-2017 16:12:23
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/test2/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.24.248)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.138.24.248)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                28-DEC-2017 16:12:23
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/test2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.24.248)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl1" has 1 instance(s).
  Instance "orcl1", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@test2 ~]$ 




  7.2 Force the Primary to register its services with the listener


【主库】  
$sqlplus / as sysdba
SQL> alter system register;
System altered.


  7.3 In a single instance (non-RAC) disable restricted session to allow end user connectivity.
  
【主库】  

SQL>alter system disable restricted session;
SQL>select instance_name,status,logins from v$instance;


  7.4 Re-enable log shipping to the Standby Site.
  
【主库】  
SQL> alter system set log_archive_dest_state_2=enable scope=both sid='*';
System altered.
SQL> show parameter log_archive_dest_state_2


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_2             string      ENABLE


【主库】
$primary>opatch lsinventory 

【备库】
$standby>opatch lsinventory 


8. ======At the standby site start the MRP(managed recovery). RDBMS changes implemented in the Primary Site
through catpatch/catbundle/catcpu will also be applied to the standby.


NOTE: Step 5. should be done immediately after upgrading the Database Binaries on the Standby Database. 
It is to ensure the Data Dictionary (CATPROC)-Version matches the Version of the Database Binaries. 
If this does not match (eg. when you upgrade the Standby Database Binaries first and perform a Role Change 
on the Standby before you upgrade the Primary) you may run into severe Problems. Having different Patchlevels 
in a Data Guard Physical Standby Database Environment is not supported anyway, seeMixed Oracle Version support 
with Data Guard Redo Transport Services (Doc ID 785347.1)for further Details and Reference.


【备库】
SQL>alter database open;
Database altered.
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE disconnect from session;
Database altered.


9. =====Checks to perform to ensure the patch has been applied successfully at the primary and standby sites.

In the case of a PSU examine the registry history view.
SQL> select ACTION_TIME,ACTION,NAMESPACE,VERSION,BUNDLE_SERIES,ID from registry$history; 

-------------------------------------------------------------------------------------------------------------------


【主库】
SQL> col action_time for a30
SQL> col action for a15
SQL> col bundle_series for a15 
SQL> select ACTION_TIME,ACTION,NAMESPACE,VERSION,BUNDLE_SERIES,ID from registry$history;


ACTION_TIME                    ACTION     NAMESPACE  VERSION                        BUNDLE_SERIES           ID
------------------------------ ---------- ---------- ------------------------------ --------------- ----------
08-NOV-16 01.49.05.311792 PM   APPLY      SERVER     11.2.0.4                       PSU                      0
14-NOV-16 02.31.22.201611 PM   jvmpsu.sql SERVER     11.2.0.4.161018OJVMPSU                                  0
14-NOV-16 02.32.11.296054 PM   APPLY      SERVER     11.2.0.4                       PSU                 161018
14-NOV-16 02.33.33.984545 PM   APPLY      SERVER     11.2.0.4.161018OJVMPSU                                  0
14-NOV-16 02.33.33.994926 PM   APPLY                                                                  24315821
28-DEC-17 04.08.06.304854 PM   APPLY      SERVER     11.2.0.4                       PSU                 171017


6 rows selected.


【备库】
SQL>select ACTION_TIME,ACTION,NAMESPACE,VERSION,BUNDLE_SERIES,ID from registry$history;
OR
SQL>SQL>select * from dba_registry_history


ACTION_TIME                    ACTION     NAMESPACE  VERSION                        BUNDLE_SERIES           ID
------------------------------ ---------- ---------- ------------------------------ --------------- ----------
08-NOV-16 01.49.05.311792 PM   APPLY      SERVER     11.2.0.4                       PSU                      0
14-NOV-16 02.31.22.201611 PM   jvmpsu.sql SERVER     11.2.0.4.161018OJVMPSU                                  0
14-NOV-16 02.32.11.296054 PM   APPLY      SERVER     11.2.0.4                       PSU                 161018
14-NOV-16 02.33.33.984545 PM   APPLY      SERVER     11.2.0.4.161018OJVMPSU                                  0
14-NOV-16 02.33.33.994926 PM   APPLY                                                                  24315821
28-DEC-17 04.08.06.304854 PM   APPLY      SERVER     11.2.0.4                       PSU                 171017


【主备库】
SQL>select NAME,LOG_MODE,OPEN_MODE,PROTECTION_MODE,PROTECTION_LEVEL,FORCE_LOGGING,DATABASE_ROLE,DB_UNIQUE_NAME from v$database;


SQL>select NAME,OPEN_MODE,PROTECTION_MODE,PROTECTION_LEVEL,DATABASE_ROLE,DB_UNIQUE_NAME from v$database;


primary>

NAME      OPEN_MODE            PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    DB_UNIQUE_NAME
--------- -------------------- -------------------- -------------------- ---------------- ------------------------------
RRSGW     READ WRITE           MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY PRIMARY          rrsgw



standby>
NAME      OPEN_MODE            PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    DB_UNIQUE_NAME
--------- -------------------- -------------------- -------------------- ---------------- ------------------------------
RRSGW     READ ONLY WITH APPLY MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY PHYSICAL STANDBY rrsgwdg




遇到问题:
          如上为测试库,在生产库打PSU未遇到问题,在生产库,主库sys密码被其它DB修改后,未修改备库sys密码,导致主备库打完PSU重启后,主库归档不能应用到备库,查询主库protection_level状态为RESYNCHRONIZATION
SQL> select NAME,OPEN_MODE,PROTECTION_MODE,PROTECTION_LEVEL,DATABASE_ROLE,DB_UNIQUE_NAME from v$database;

NAME      OPEN_MODE            PROTECTION_MODE      PROTECTION_LEVEL     DATABASE_ROLE    DB_UNIQUE_NAME
--------- -------------------- -------------------- -------------------- ---------------- ------------------------------
RRSGW     READ WRITE           MAXIMUM AVAILABILITY RESYNCHRONIZATION    PRIMARY          rrsgw


查询主库alert日志报错如下,查询如下报错信息,主库sys密码被用户修改.
解决方法: 把主库密码文件orapwrrsgw scp到备库上,异常解决,主库PROTECTION_LEVEL,变为MAXIMUM AVAILABILITY,主库归档也开始应用到备库上,主备库归档同步. 切记,主库修改特权用户sys密码,sys新密码不会同步到备份上,如果修改主库sys密码一定把主库密码文件同到步备库上.


主库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
------------------------------------------------------------
PING[ARC1]: Heartbeat failed to connect to standby 'rrsgwdg'. Error is 16191.
Thu Jan 11 20:43:54 2018
Error 1017 received logging on to the standby
------------------------------------------------------------
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
------------------------------------------------------------
PING[ARC1]: Heartbeat failed to connect to standby 'rrsgwdg'. Error is 16191.
(END)













来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28569596/viewspace-2150302/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/28569596/viewspace-2150302/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值