Sunday, 16 September 2018

How to find latest oracle database patchset

$ORACLE_HOME/OPatch/opatch lsinventory

$ORACLE_HOME/OPatch/opatch lsinventory|grep "Patch description"
Patch description:  "Database Patch Set Update : 11.2.0.3.7 (16619892)"

$ORACLE_HOME/OPatch/opatch lsinventory -details


Which Patch has been applied?


SET linesize 200 pagesize 200
col action_time FOR a28
col version FOR a10
col comments FOR a35
col action FOR a25
col namespace FOR a12
SELECT * FROM registry$history;



To unlock the Grid home, perform the following steps:


cd /u01/app/11.2.0/grid/crs/install 
perl rootcrs.pl -unlock -crshome /u01/app/11.2.0/grid

cd /u01/app/11.2.0/grid/crs/install 
perl rootcrs.pl -patch
$ CRS_home/bin/srvctl stop database -d sales
CRS_home/crs/bin/crsctl stop cluster -all
$ Grid_home/bin/crsctl status resource -t
$ cd Oracle_home/OPatch/4519934/4519934
$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1
opatch apply

Grid_home/bin/crsctl start cluster -all
$ Grid_home/bin/crsctl status resource -t
$ Oracle_home/bin/srvctl start instance -d sales -i "sales1"
# Grid_home/bin/crsctl start resource myResource -n docrac2
$ sqlplus /nolog 
SQL> connect sys/password@sales1 AS SYSDBA
SQL> @Oracle_home/rdbms/admin/catbundle.sql cpu apply
SQL> exit
To apply a patch using the rolling patch method:
$ cd Oracle_home/OPatch/12419331/12419331
$ opatch query -is_rolling_patch [unzipped patch location]
$ Oracle_home/bin/emctl stop dbconsole
$ Oracle_home/bin/srvctl stop instance -d sales -i "sales1" -f
$ Grid_home/crs/bin/crsctl stop cluster -n docrac1
$ Grid_home/bin/crsctl status resource -t
$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1
$ opatch apply -local
$ opatch apply -remote_nodes docrac2
$ opatch apply [-local_node docrac1] -remote_nodes docrac2,docrac3
$ Oracle_home/bin/srvctl start instance -d sales -i "sales1"
$ Oracle_home/bin/emctl start dbconsole
# Grid_home/bin/crsctl start cluster -n docrac1
$ Grid_home/bin/crsctl status resource -t
$ Oracle_home/bin/srvctl start instance -d sales -i "sales1"
# Grid_home/bin/crsctl start resource myResource -n docrac
$ sqlplus /nolog 
SQL> connect sys/password@sales1 AS SYSDBA
SQL> @Oracle_home/rdbms/admin/catbundle.sql cpu apply
SQL> exit

 apply a patch to your cluster database using the minimum downtime method:
  1. Change to the directory where the unzipped patch is staged on disk, for example:
    $ cd Oracle_home/OPatch/12419331/12419331
    
  2. Stop all user applications that use the Oracle RAC home directory for the group of nodes being patched. For example, to stop Enterprise Manager Database Control on the local node, use the following command, where Oracle_home is the home directory for your Oracle RAC installation:
    $ Oracle_home/bin/emctl stop dbconsole
    
  3. Shut down all Oracle RAC instances on the local node. To shut down an instance for an Oracle RAC database, enter a command similar to the following example, where Oracle_home is the home directory for your Oracle RAC database installation, sales is the name of the database, and sales1 is the name of the instance:
    $ Oracle_home/bin/srvctl stop instance -d sales -i "sales1" -f
    
  4. Make sure the ORACLE_HOME environment variable points to the software directory you want to patch, for example:
    $ echo $ORACLE_HOME
    /u01/app/oracle/product/11.2.0/dbhome_1
    
  5. Use the following command from within the patch directory:
    $ opatch apply -minimize_downtime
    
    If you run the OPatch command from the directory where the patch is staged on disk, then you do not need to specify the patch ID.
    OPatch asks if you are ready to patch the local node. After you confirm that the Oracle RAC instances on the local node have been shut down, OPatch applies the patch to the Oracle home directory on the local node. You are then asked to select the next nodes to be patched.
  6. After you shut down the Oracle RAC instances on the other nodes in the cluster, you can restart the Oracle RAC instance on the local node. Then, instruct OPatch that you are ready to patch the remaining nodes.
  7. After all the nodes have been patched, restart the Oracle RAC instances on the other nodes in the cluster. The following command shows how to start the orcl2instance for the Oracle RAC database named orcl:
    $ Oracle_home/bin/srvctl start instance -d orcl -i "orcl2"
     
    
  8. Verify that all the Oracle Clusterware resources were restarted on all the nodes in the cluster.
    $ crsctl check cluster
    
    If any of the cluster resources did not restart, then use either the CRSCTL or SRVCTL utility to restart them. For example, you can use commands similar the following to restart various cluster resources, where Grid_home is the home directory of your Oracle Grid Infrastructure for a cluster installation and Oracle_home is the home directory of your Oracle RAC database:
    $ Oracle_home/bin/srvctl start instance -d sales -i "sales1"
    # Grid_home/bin/crsctl start resource myResource -n docrac1
    
  9. Run any post-patch scripts that are mentioned in the patch instructions, for example:
    $ sqlplus /nolog 
    SQL> connect sys/password@sales1 AS SYSDBA
    SQL> @Oracle_home/rdbms/admin/catbundle.sql cpu apply
    SQL> exit

No comments:

Post a Comment

Featured post

duplicate db from standy to other server

 Duplicate Testuat   $ export ORACLE_SID=Testuat3 $ sqlplus '/as sysdba' Testuat3 SQL> alter system set cluster_database=FALSE sc...