Monday, July 14, 2014

Applying CPU Patch On Primary Database Server Environment

 Applying CPU Patch On Primary Database Server Environment.


 Step 1:

Incase if you have standby server. Now disable log shipping on the primary database by setting the log_archive_dest_state_2 to disable. As I said earlier, parameter log_archive_dest_2 on my primary database is set to point to the standby database.

SQL> alter system set log_archive_dest_state_2=disable;

System altered.

Step 2:

Shutdown the Primary database and stop the listener running on the primary database server.

 
[oracle@PRIM ~]$ sqlplus sys/"as sysdba"

SQL*Plus: Release 11.2.0.2.0 Production

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, DataMining and Real Application Testing options

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, DataMining and Real Application Testing options

Now Stop the Listener.

[oracle@PRIM ~]$ lsnrctl stop

 [oracle@PRIM ~]$ ps -ef | grep pmon

Step 3:

Now apply the CPU patch on the Primary database.



Set the Opatch path.
[oracle@PRIM ~]$ export $ORACLE_HOME=/u01/app/oracle/product/11.2/db_1
[oracle@PRIM ~]$ export PATH=$PATH:$ORACLE_HOME/OPatch

OPatch Version: 11.2.0.3.0

OPatch succeeded.

[oracle@PRIM ~]$ opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /opt/12827726/
Oracle Interim Patch Installer version 11.2.0.3.0
Copyright (c) 2012, Oracle Corporation. All rights reserved.

PREREQ session
OPatch version : 11.2.0.3.0
OUI version : 11.2.0.2.0
Log file location : /u01/app/oracle/product/11.2.0.2/db1/cfgtoollogs/opatch/opatch2013-05-18_11-56-11AM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

[oracle@PRIM ~]$ export PATH=$PATH:/u01/app/oracle/product/11.2.0.2/db1/OPatch
[oracle@PRIM ~]$ opatch apply /opt/12827726/

 OPatch succeeded.

 Step 4:

Start the listener on the primary database server and also start the Primary database.


[oracle@PRIM ~]$ lsnrctl start

[oracle@PRIM ~]$ sqlplus /"as sysdba"

SQL*Plus: Release 11.2.0.2.0 Production

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup

ORACLE instance started.

 Step 5:

Incase if you have standby server. Now enable log shipping on the primary database by setting the log_archive_dest_state_2 to "enable". As I said earlier, parameter log_archive_dest_2 on my primary database is set to point to the standby database.

SQL> alter system set log_archive_dest_state_2=enable;


Step 6:

On the primary database, run the patching scripts like “catbundle.sql” in this case.
The script run generates archives and these archives would be shipped and applied to the standby database. So, there is no requriement to run the patching scripts on the standby database.

[oracle@PRIM ~]$ sqlplus /"as sysdba"

SQL*Plus: Release 11.2.0.2.0 Production

Copyright (c) 1982, 2010, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, DataMining and Real Application Testing options

SQL> @?/rdbms/admin/catbundle.sql psu apply

SQL> select max(sequence#) from v$archived_log;

MAX(SEQUENCE#)
--------------

Note : Incase if you want to rollback the patch applied:


  1. Verify that an $ORACLE_HOME/rdbms/admin/catbundle_PSU_<database SID>_ROLLBACK.sql file exists for each database associated with this ORACLE_HOME. If this is not the case, you must execute the steps.
  2. Shut down all instances and listeners associated with the Oracle home that you are updating. 
  3. For more information, see Oracle Database Administrator's Guide.

            Run the OPatch utility specifying the rollback argument as follows.

            opatch rollback -id 12827726


Patch Post-Deinstallation Instructions for a Non Oracle RAC Environment

  1. Start all database instances running from the Oracle home. (For more information, see Oracle Database Administrator's Guide.)
  2. For each database instance running out of the ORACLE_HOME, connect to the database using SQL*Plus as SYSDBA and run the rollback script as follows:
    cd $ORACLE_HOME/rdbms/admin
    sqlplus /nolog
    SQL> CONNECT / AS SYSDBA
    SQL> STARTUP
    SQL> @catbundle_PSU_<database SID>_ROLLBACK.sql
    SQL> QUIT

No comments:

Post a Comment