Jul 16, 2015

how to use opatch auto



> OPatch auto automaticaly patch the typical Grid Infrastructure (GI) and RAC home directories with minimal intervention.
> OPatch auto performs many of the pre-patch checks as well as the post-patch verification.
> OPatch auto lies in its ability to perform end-to-end configuration patching (patching a GI or RAC home based on its configuration.) By incorporating the configuration information into the patch process.
> OPatch auto streamlines patching tasks by automating most of the steps.
> OPatch auto uses your GI/RAC configuration and, from that information, automatically generates patching instructions specific to your site configuration.
> OPatch auto then uses OPatch to implement these instructions and perform the actual application of the patch.


 -------------------------------- Create Response file -----------------------------------------
[oracle@v-box1 OPatch]$ sudo su -
[root@v-box1 ~]# export ORACLE_HOME=/u01/app/11.2.0.4/grid
[root@v-box1 ~]# $ORACLE_HOME/OPatch/ocm/bin/emocmrsp -no_banner -output /opt/software/gridocm_config.rsp
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
The OCM configuration response file (/opt/software/gridocm_config.rsp) was successfully created.
 -------------------------------- Patch GI home -----------------------------------------
[root@v-box1 ~]# cd /opt/software/19380115

[root@v-box1 19380115]# sudo /u01/app/11.2.0.4/grid/OPatch/opatch auto /opt/software/19380115 -oh /u01/app/11.2.0.4/grid/ -ocmrf /opt/software/gridocm_config.rsp
Executing /u01/app/11.2.0.4/grid/perl/bin/perl /u01/app/11.2.0.4/grid/OPatch/crs/patch11203.pl -patchdir /opt/software -patchn 19380115 -oh /u01/app/11.2.0.4/grid/ -ocmrf /opt/software/gridocm_config.rsp -paramfile /u01/app/11.2.0.4/grid/crs/install/crsconfig_params

This is the main log file: /u01/app/11.2.0.4/grid/cfgtoollogs/opatchauto2015-07-16_04-39-48.log

This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/u01/app/11.2.0.4/grid/cfgtoollogs/opatchauto2015-07-16_04-39-48.report.log

2015-07-16 04:39:48: Starting Oracle Restart Patch Setup
Using configuration parameter file: /u01/app/11.2.0.4/grid/crs/install/crsconfig_params

Stopping CRS...
Stopped CRS successfully

patch /opt/software/19380115/19121551  apply successful for home  /u01/app/11.2.0.4/grid
patch /opt/software/19380115/19121549  apply successful for home  /u01/app/11.2.0.4/grid
patch /opt/software/19380115/19121552  apply successful for home  /u01/app/11.2.0.4/grid

Starting CRS...
CRS-4123: Oracle High Availability Services has been started.

opatch auto succeeded.

-------------------------------- Patch Oracle Home -----------------------------------------

[oracle@v-box1 OPatch]$ sudo /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch auto /opt/software/19380115 -oh /u01/app/oracle/product/11.2.0.4/dbhome_1/ -ocmrf /opt/software/gridocm_config.rsp
Executing /u01/app/11.2.0.4/grid/perl/bin/perl /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/crs/patch11203.pl -patchdir /opt/software -patchn 19380115 -oh /u01/app/oracle/product/11.2.0.4/dbhome_1/ -ocmrf /opt/software/gridocm_config.rsp -paramfile /u01/app/11.2.0.4/grid/crs/install/crsconfig_params

This is the main log file: /u01/app/oracle/product/11.2.0.4/dbhome_1/cfgtoollogs/opatchauto2015-07-16_05-02-44.log

This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/u01/app/oracle/product/11.2.0.4/dbhome_1/cfgtoollogs/opatchauto2015-07-16_05-02-44.report.log

2015-07-16 05:02:44: Starting Oracle Restart Patch Setup
Using configuration parameter file: /u01/app/11.2.0.4/grid/crs/install/crsconfig_params

Stopping RAC /u01/app/oracle/product/11.2.0.4/dbhome_1 ...
Stopped RAC /u01/app/oracle/product/11.2.0.4/dbhome_1 successfully

patch /opt/software/19380115/19121551  apply successful for home  /u01/app/oracle/product/11.2.0.4/dbhome_1
patch /opt/software/19380115/19121549/custom/server/19121549  apply successful for home  /u01/app/oracle/product/11.2.0.4/dbhome_1

Starting RAC /u01/app/oracle/product/11.2.0.4/dbhome_1 ...
Started RAC /u01/app/oracle/product/11.2.0.4/dbhome_1 successfully

opatch auto succeeded.
[oracle@v-box1 OPatch]$

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

Moving Spfile from File System to ASM Disk


[oracle@vbox-01 ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 15 08:00:15 2015
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, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options

SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/spfilefaizal.ora

SQL> create pfile='/home/oracle/initfaizal.ora' from spfile;

File created.

SQL> create spfile='+DATA' from pfile='/home/oracle/initfaizal.ora';

File created.

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

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

[oracle@vbox-01 ~]$ cd $ORACLE_HOME/dbs
[oracle@vbox-01 dbs]$ ls -ltr *faizal*

-rw-r----- 1 oracle oinstall 1536 Jul 15 07:23 orapwfaizal
-rw-r----- 1 oracle oinstall 4608 Jul 15 07:48 spfilefaizal.ora
-rw-rw---- 1 oracle oinstall 1544 Jul 15 07:57 hc_faizal.dat
[oracle@vbox-01 dbs]$
[oracle@vbox-01 dbs]$ mv spfilefaizal.ora spfilefaizal.ora.bck

[oracle@vbox-01 dbs]$ export ORACLE_SID=+ASM
ASMCMD> ls -ltr
WARNING:option 'r' is deprecated for 'ls'
please use 'reverse'
 
Type           Redund  Striped  Time             Sys  Name
PARAMETERFILE  UNPROT  COARSE   JUL 15 08:00:00  Y    spfile.313.885110543
ASMCMD> pwd
+data/FAIZAL/PARAMETERFILE

# you must give init.ora not spfile.ora
[oracle@vbox-01 dbs]$ vi initfaizal.ora 
[oracle@vbox-01 dbs]$
[oracle@vbox-01 dbs]$ cat initfaizal.ora
spfile='+DATA/faizal/parameterfile/spfile.313.885110543'

[oracle@vbox-01 dbs]$ ls -ltr *faizal*
-rw-r----- 1 oracle oinstall 1536 Jul 15 07:23 orapwfaizal
-rw-r----- 1 oracle oinstall 4608 Jul 15 07:48 spfilefaizal.ora.bck
-rw-r--r-- 1 oracle oinstall   61 Jul 15 07:54 initfaizal.ora
-rw-rw---- 1 oracle oinstall 1544 Jul 15 07:57 hc_faizal.dat
[oracle@vbox-01 dbs]$
[oracle@vbox-01 dbs]$ export ORACLE_SID=faizal
[oracle@vbox-01 dbs]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jul 15 08:05:30 2015
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup;

ORACLE instance started.
Total System Global Area 1.2827E+10 bytes
Fixed Size                  2265224 bytes
Variable Size            6140465016 bytes
Database Buffers         6677331968 bytes
Redo Buffers                7307264 bytes
Database mounted.
Database open.

SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/faizal/parameterfile/spfile.313.885110543

Done