Thursday, November 6, 2014


Apply Patch in Oracle


* You Must have two thing to apply PSU Patch :
1-Lastest version For Optach.
2-PSU Patch that you want to apply.


Steps:

$ORACLE_HOME/OPatch/opatch version
Output will be:
Invoking OPatch 11.2.0.1.7
OPatch Version:  11.2.0.1.7
OPatch succeeded

1-you need to Update latest version For Optach, to do this :

cd $ORACLE_HOME

cp -r Optach/ /u01/backup/Optach

**make sure you in ORACLE_HOME

rm -rf $ORACLE_HOME/Optach

unzip Optach_that_you_download_from_MOS inside $ORACLE_HOME.

Patch Number :6880880

2-Check Optach After Doing Above Steps :

$ORACLE_HOME/OPatch/opatch version
Output will be:
Invoking OPatch 11.2.0.3.0
OPatch Version:  11.2.0.3.0
OPatch succeeded

3-Apply PSU Patch By Doing the Following, for example :

unzip p13923374_11203_.zip
cd 13923374
opatch apply

Answer the question that you been asked by Oracle
 

4- Post Installation Steps :

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
 SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT

------------------------------------------------------------
for more details:


Steps to Apply PSU 5 on Oracle 11.2.0.3 Database

Oracle recommends to apply Latest available PSU-1

1) Download and install p6880880_112000_Linux-x86-64(Pre-Req patch)

a) Backup the $ORACLE_HOME/OPatch directory
b) Remove the contents of OPatch directory
c) cp the patch in p6880880_112000_Linux-x86-64.zip at $ORACLE_HOME and unzip the patch(unzip -o patchno)
d) Check Prereq pf patch
Go to patch 14727310 location
Run -> opatch prereq CheckConflictAgainstOHWithDetail -ph ./

e) Rollback patch 13004894
opatch rollback -id 13004894

f) Apply the patch 14727310
opatch apply

g) Apply patch 13004894
opatch apply
---------------------------------------------------







Complete steps to apply PSU patch:


Applying Database PSU 10.2.0.5.12 to Oracle database 10.2.0.5
Yesterday I applied Database PSU (includes CPU July2013) 10.2.0.5.12 to Oracle Database version 10.2.0.5 . PFB steps to apply :-

Download the Latest PSU patch (p16619894_10205_Linux-x86-64.zip) from Metalink. In my case Patch number is 16619894.

Backup your Database and ORACLE_HOME before applying PSU.

1. Prerequisites to Apply PSU :-

[oracle@localhost ~]$ which opatch
/oracle_home/app/OPatch/opatch
[oracle@localhost ~]$
[oracle@localhost ~]$ cd /DBSOFT/
[oracle@localhost DBSOFT]$ opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ./16619894
Invoking OPatch 10.2.0.4.9

Oracle Interim Patch Installer version 10.2.0.4.9
Copyright (c) 2009, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /oracle_home/app
Central Inventory : /oracle11gr2/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 10.2.0.4.9
OUI version       : 10.2.0.5.0
OUI location      : /oracle_home/app/oui
Log file location : /oracle_home/app/cfgtoollogs/opatch/opatch2013-09-27_16-19-20PM.log

Patch history file: /oracle_home/app/cfgtoollogs/opatch/opatch_history.txt

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

From output its clear that My Opatch Version is lower than the Patch version which has to be applied . Patch has to be applied with same or higher OPatch version otherwise we will get below mentioned error :-

[oracle@localhost 16619894]$ opatch apply
Invoking OPatch 10.2.0.4.9

Oracle Interim Patch Installer version 10.2.0.4.9
Copyright (c) 2009, Oracle Corporation.  All rights reserved.

Oracle Home       : /oracle_home/app
Central Inventory : /oracle11gr2/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 10.2.0.4.9
OUI version       : 10.2.0.5.0
OUI location      : /oracle_home/app/oui
Log file location : /oracle_home/app/cfgtoollogs/opatch/opatch2013-09-27_16-32-38PM.log

Patch history file: /oracle_home/app/cfgtoollogs/opatch/opatch_history.txt

ApplySession applying interim patch '16619894' to OH '/oracle_home/app'
ApplySession failed: ApplySession failed to prepare the system.

Patch 16619894 requires OPatch version 10.2.0.5.0.
The OPatch version being used (10.2.0.4.9) doesn't meet the minimum version required by the patch(es). Please download latest OPatch from My Oracle Support.

System intact, OPatch will not attempt to restore the system

OPatch failed with error code 73

2. Download the latest Opatch version from Metalink and copy it in inside ORACLE_HOME

[oracle@localhost 16619894]$pwd
/oracle_home/app
[oracle@localhost app]$ unzip p6880880_102000_Linux-x86-64.zip
Archive:  p6880880_102000_Linux-x86-64.zip
 extracting: OPatch/ocm/ocm.zip
  inflating: OPatch/ocm/lib/osdt_jce.jar
  inflating: OPatch/ocm/lib/osdt_core3.jar
  inflating: OPatch/ocm/lib/emocmclnt-14.jar
replace OPatch/ocm/lib/emocmutl.jar? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
  inflating: OPatch/ocm/lib/emocmutl.jar
  inflating: OPatch/ocm/bin/emocmrsp
  inflating: OPatch/ocm/ocm_platforms.txt
replace OPatch/crs/patch112.pl? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
  inflating: OPatch/crs/patch112.pl
replace OPatch/crs/crsdelete.pm? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
  inflating: OPatch/crs/crsdelete.pm
replace OPatch/crs/crspatch.pm? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
  inflating: OPatch/crs/crspatch.pm
replace OPatch/crs/s_crsconfig_defs? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
  inflating: OPatch/crs/s_crsconfig_defs
replace OPatch/crs/crsconfig_lib.pm? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
  inflating: OPatch/crs/crsconfig_lib.pm
  inflating: OPatch/crs/oracss.pm
  inflating: OPatch/crs/auto_patch.pl
  inflating: OPatch/crs/s_crsconfig_lib.pm
  inflating: OPatch/opatch
  inflating: OPatch/opatchprereqs/opatch/runtime_prereq.xml
  inflating: OPatch/opatchprereqs/opatch/opatch_prereq.xml
  inflating: OPatch/opatchprereqs/opatch/rulemap.xml
  inflating: OPatch/opatchprereqs/prerequisite.properties
  inflating: OPatch/opatchprereqs/oui/knowledgesrc.xml
  inflating: OPatch/opatch.ini
  inflating: OPatch/emdpatch.pl
  inflating: OPatch/opatch.pl
  inflating: OPatch/jlib/opatchprereq.jar
  inflating: OPatch/jlib/opatchactions.jar
  inflating: OPatch/jlib/opatchutil.jar
  inflating: OPatch/jlib/opatchfmw.jar
  inflating: OPatch/jlib/opatchext.jar
  inflating: OPatch/jlib/opatch.jar
  inflating: OPatch/opatch.bat
  inflating: OPatch/docs/Prereq_Users_Guide.txt
  inflating: OPatch/docs/FAQ
  inflating: OPatch/docs/Users_Guide.txt
  inflating: OPatch/README.txt

[oracle@localhost OPatch]$ opatch lsinventory
Invoking OPatch 10.2.0.5.1

Oracle Interim Patch Installer version 10.2.0.5.1
Copyright (c) 2010, Oracle Corporation.  All rights reserved.

Oracle Home       : /oracle_home/app
Central Inventory : /oracle11gr2/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 10.2.0.5.1
OUI version       : 10.2.0.5.0
OUI location      : /oracle_home/app/oui
Log file location : /oracle_home/app/cfgtoollogs/opatch/opatch2013-09-27_16-59-28PM.log

Patch history file: /oracle_home/app/cfgtoollogs/opatch/opatch_history.txt

Lsinventory Output file location : /oracle_home/app/cfgtoollogs/opatch/lsinv/lsinventory2013-09-27_16-59-28PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (2):

Oracle Database 10g                                                  10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 4                            10.2.0.5.0
There are 2 products installed in this Oracle Home.

There are no Interim patches installed in this Oracle Home.

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

OPatch succeeded.

Opatch version is upgraded to the latest version .

3. As Its a Single Instance Database. We need to Shutdown database as well as Listeners and EM's :-

[oracle@localhost ~]$ sqlplus

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Sep 27 13:20:57 2013

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

Enter user-name: /as sysdba

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
[oracle@localhost ~]$ emctl stop dbconsole
TZ set to Asia/Calcutta
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
http://localhost.localdomain:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ...
 ...  Stopped.
[oracle@localhost ~]$ lsnrctl stop

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 27-SEP-2013 13:23:34

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
The command completed successfully
[oracle@localhost ~]$ isqlplusctl stop
iSQL*Plus 10.2.0.1.0
Copyright (c) 2003, 2005, Oracle.  All rights reserved.
Stopping iSQL*Plus ...
iSQL*Plus stopped.

4. Apply the Patch on Database :-

[oracle@localhost OPatch]$
[oracle@localhost OPatch]$
[oracle@localhost OPatch]$ cd /DBSOFT/
[oracle@localhost DBSOFT]$ ls -ltr
total 4351288
-rw-r--r-- 1 oracle oinstall      35417 Apr 22  2010 utltzpv4.sql
drwxr-xr-x 7 oracle oinstall       4096 Nov  3  2010 OPatch
-rw-r--r-- 1 oracle oinstall  801603584 Nov  9  2011 10201_database_linux_x86_64.cpio
-rw-r--r-- 1 root   root     1239269270 Sep 24 12:41 linux.x64_11gR2_database_1of2.zip
-rw-r--r-- 1 root   root     1111416131 Sep 24 13:13 linux.x64_11gR2_database_2of2.zip
-rw-r--r-- 1 oracle oinstall       6475 Sep 27 10:32 utltzpv4.zip
-rw-r--r-- 1 oracle oinstall 1249857866 Sep 27 13:07 p8202632_10205_Linux-x86-64.zip
-rw-r--r-- 1 root   root       21714481 Sep 27 14:59 p16619894_10205_Linux-x86-64.zip
drwxr-xr-x 5 oracle oinstall       4096 Sep 27 16:01 16619894
-rw-r--r-- 1 root   root       27412455 Sep 27 16:56 p6880880_102000_Linux-x86-64.zip
[oracle@localhost DBSOFT]$
[oracle@localhost DBSOFT]$ cd 16619894/
[oracle@localhost 16619894]$ opatch apply
Invoking OPatch 10.2.0.5.1

Oracle Interim Patch Installer version 10.2.0.5.1
Copyright (c) 2010, Oracle Corporation.  All rights reserved.

Oracle Home       : /oracle_home/app
Central Inventory : /oracle11gr2/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 10.2.0.5.1
OUI version       : 10.2.0.5.0
OUI location      : /oracle_home/app/oui
Log file location : /oracle_home/app/cfgtoollogs/opatch/opatch2013-09-27_17-00-06PM.log

Patch history file: /oracle_home/app/cfgtoollogs/opatch/opatch_history.txt

ApplySession applying interim patch '16619894' to OH '/oracle_home/app'

Running prerequisite checks...
Patch 16619894: Optional component(s) missing : [ oracle.rdbms.dv, 10.2.0.5.0 ] , [ oracle.rdbms.dv.oc4j, 10.2.0.5.0 ] , [ oracle.network.cman, 10.2.0.5.0 ]
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

OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/oracle_home/app')

Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '16619894' for restore. This might take a while...
Backing up files affected by the patch '16619894' for rollback. This might take a while...
Execution of 'sh /DBSOFT/16619894/custom/scripts/pre -apply 16619894 ':

Return Code = 0

Patching component oracle.rdbms, 10.2.0.5.0...
Updating archive file "/oracle_home/app/lib/libserver10.a"  with "lib/libserver10.a/kcbl.o"
Updating archive file "/oracle_home/app/lib/libserver10.a"  with "lib/libserver10.a/qecsel.o"
Updating archive file "/oracle_home/app/lib/libserver10.a"  with "lib/libserver10.a/ksfd.o"
Updating archive file "/oracle_home/app/lib/libserver10.a"  with "lib/libserver10.a/qkexr.o"
Updating archive file "/oracle_home/app/lib/libserver10.a"  with "lib/libserver10.a/xty.o"
Updating archive file "/oracle_home/app/lib/libserver10.a"  with "lib/libserver10.a/qergh.o"
Updating archive file "/oracle_home/app/lib/libserver10.a"  with "lib/libserver10.a/qergs.o"
Updating archive file "/oracle_home/app/lib/libserver10.a"  with "lib/libserver10.a/ktsx.o"
Updating archive file "/oracle_home/app/lib/libserver10.a"  with "lib/libserver10.a/kdt.o"
Updating archive file "/oracle_home/app/lib/libserver10.a"  with "lib/libserver10.a/kkpod.o"
Updating archive file "/oracle_home/app/lib/libserver10.a"  with "lib/libserver10.a/kdiss.o"
.
.
.
.

Copying file to "/oracle_home/app/rdbms/admin/bundledata_PSU.xml"
Copying file to "/oracle_home/app/rdbms/lib/kkxwtp.o"
Copying file to "/oracle_home/app/rdbms/lib/ksms.o"
Copying file to "/oracle_home/app/rdbms/lib/jox.o"
Copying file to "/oracle_home/app/rdbms/mesg/oraus.msg"
Copying file to "/oracle_home/app/rdbms/mesg/oraus.msb"
Copying file to "/oracle_home/app/psu/10.2.0.5.12/catpsu.sql"
Copying file to "/oracle_home/app/psu/10.2.0.5.12/catpsu_rollback.sql"

Patching component oracle.rdbms.rsf, 10.2.0.5.0...
Updating archive file "/oracle_home/app/lib/libgeneric10.a"  with "lib/libgeneric10.a/qcop.o"
Updating archive file "/oracle_home/app/lib/libgeneric10.a"  with "lib/libgeneric10.a/kgh.o"
Updating archive file "/oracle_home/app/lib/libgeneric10.a"  with "lib/libgeneric10.a/kgl.o"
Updating archive file "/oracle_home/app/lib/libgeneric10.a"  with "lib/libgeneric10.a/kgl2.o"
Updating archive file "/oracle_home/app/lib/libgeneric10.a"  with "lib/libgeneric10.a/qcs2.o"
Updating archive file "/oracle_home/app/lib/libgeneric10.a"  with "lib/libgeneric10.a/kgx.o"
Updating archive file "/oracle_home/app/lib/libgeneric10.a"  with "lib/libgeneric10.a/kgkp.o"
Updating archive file "/oracle_home/app/lib/libgeneric10.a"  with "lib/libgeneric10.a/kgsk.o"
Updating archive file "/oracle_home/app/lib/libgeneric10.a"  with "lib/libgeneric10.a/kgski.o"
Updating archive file "/oracle_home/app/lib/libgeneric10.a"  with "lib/libgeneric10.a/kgls.o"
.
.
.
.

Patching component oracle.javavm.server, 10.2.0.5.0...
Copying file to "/oracle_home/app/lib/libjox10.so"
Copying file to "/oracle_home/app/lib32/libjox10.so"
Running make for target client_sharedlib
Running make for target ioracle
Running make for target iwrap
Running make for target client_sharedlib
Running make for target proc
Running make for target irman
Running make for target itnslsnr
ApplySession adding interim patch '16619894' to inventory

Verifying the update...
Inventory check OK: Patch ID 16619894 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 16619894 are present in Oracle Home.

The local system has been patched and can be restarted.

OPatch succeeded.
[oracle@localhost 16619894]$

Patch has been Successfully applied. You can Check Logfile for any errors
/oracle_home/app/cfgtoollogs/opatch/opatch2013-09-27_17-00-06PM.log

5. Post Installation Instructions :-

a. Start Database :-

[oracle@localhost admin]$ sqlplus

SQL*Plus: Release 10.2.0.5.0 - Production on Fri Sep 27 17:06:22 2013

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Enter user-name: /as sysdba
Connected to an idle instance.

SQL>
SQL> startup
ORACLE instance started.

Total System Global Area  599785472 bytes
Fixed Size                  2098112 bytes
Variable Size             218106944 bytes
Database Buffers          373293056 bytes
Redo Buffers                6287360 bytes
Database mounted.
Database opened.

Run the CatBundle script :-

SQL> @catbundle.sql psu apply

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

Generating apply and rollback scripts...
Check the following file for errors:
/oracle_home/app/cfgtoollogs/catbundle/catbundle_PSU_ORCL_GENERATE_2013Sep27_17_06_50.log
Apply script: /oracle_home/app/rdbms/admin/catbundle_PSU_ORCL_APPLY.sql
Rollback script: /oracle_home/app/rdbms/admin/catbundle_PSU_ORCL_ROLLBACK.sql

PL/SQL procedure successfully completed.

Executing script file...

SQL> COLUMN spool_file NEW_VALUE spool_file NOPRINT
SQL> SELECT '/oracle_home/app/cfgtoollogs/catbundle/' || 'catbundle_PSU_' || name || '_APPLY_' || TO_CHAR(SYSDATE, 'YYYYMonDD_hh24_mi_ss', 'NLS_DATE_LANGUAGE=''AMERICAN''') || '.log' AS spool_file FROM v$database;

SQL> SPOOL &spool_file
SQL> exec dbms_registry.set_session_namespace('SERVER')

PL/SQL procedure successfully completed.

SQL> PROMPT Processing Oracle Enterprise Manager...
Processing Oracle Enterprise Manager...
SQL> ALTER SESSION SET current_schema = SYSMAN;

Session altered.

SQL> @?/sysman/admin/emdrep/sql/core/latest/ecm/ecm_util_pkgdef.sql
SQL> Rem
SQL> Rem $Header: emdw_src_1/source/oracle/sysman/emdrep/sql/core/latest/ecm/ecm_util_pkgdef.sql /st_recommended_10.2.0.5.0sa/1 2011/04/27 02:54:51 agor Exp $
SQL> Rem
SQL> Rem ecm_util_pkgdef.sql
SQL> Rem
SQL> Rem Copyright (c) 2002, 2011, Oracle and/or its affiliates.
SQL> Rem All rights reserved.
SQL> Rem
SQL> Rem    NAME
SQL> Rem      ecm_util_pkgdef.sql - <one-line expansion of the name>
SQL> Rem
SQL> Rem    DESCRIPTION
SQL> Rem      <short description of component this file declares/defines>
SQL> Rem
SQL> Rem    NOTES
SQL> Rem      <other useful comments, qualifications, etc.>
SQL> Rem
SQL> Rem    MODIFIED   (MM/DD/YY)
SQL> Rem    agor        04/23/11 - Backport of txn niramach_bug-8837368 .
SQL> Rem    vkhizder    10/31/03 - adding functions for getting
SQL> Rem                           patchsets/patches/bugs for a home
SQL> Rem    groyal      08/28/03 - Enhance concat to support a limit
SQL> Rem    jmansur     08/21/03 - update get_clone_source to match latest design
SQL> Rem    shuberma    04/16/03 - Removing procedure that is not longer used
SQL> Rem    shuberma    02/12/03 - Document new column in returned cursor
SQL> Rem    shuberma    01/03/03 - Adding procedure for clone home source
SQL> Rem    shuberma    12/23/02 - Adding an optional argument to the concat_col call
SQL> Rem    rmenon      10/18/02 - added CONCAT_COMPONENT_VERSION definition
SQL> Rem    rpinnama    05/15/02 - rpinnama_reorg_rep_scripts
SQL> Rem    rpinnama    05/15/02 - Created
SQL> Rem
.
.
.
.
.
.
..
Grant succeeded.

Grant succeeded.

Grant succeeded.

Session altered.

Updating registry...

1 row created.

Commit complete.

Check the following log file for errors:
/oracle_home/app/cfgtoollogs/catbundle/catbundle_PSU_ORCL_APPLY_2013Sep27_17_06_57.log

Cat Bundle script Completed .

b. Check for invalid Objects :-

SQL>  @utlrp.sql

TIMESTAMP
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN  2013-09-28 00:04:49

DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC>   objects in the database. Recompilation time is proportional to the
DOC>   number of invalid objects in the database, so this command may take
DOC>   a long time to execute on a database with a large number of invalid
DOC>   objects.
DOC>
DOC>   Use the following queries to track recompilation progress:
DOC>
DOC>   1. Query returning the number of invalid objects remaining. This
DOC>      number should decrease with time.
DOC>         SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC>   2. Query returning the number of objects compiled so far. This number
DOC>      should increase with time.
DOC>         SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC>   This script automatically chooses serial or parallel recompilation
DOC>   based on the number of CPUs available (parameter cpu_count) multiplied
DOC>   by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC>   On RAC, this number is added across all RAC nodes.
DOC>
DOC>   UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC>   recompilation. Jobs are created without instance affinity so that they
DOC>   can migrate across RAC nodes. Use the following queries to verify
DOC>   whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC>   1. Query showing jobs created by UTL_RECOMP
DOC>         SELECT job_name FROM dba_scheduler_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC>   2. Query showing UTL_RECOMP jobs that are running
DOC>         SELECT job_name FROM dba_scheduler_running_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#

PL/SQL procedure successfully completed.

TIMESTAMP
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END  2013-09-28 00:04:50

PL/SQL procedure successfully completed.

DOC> The following query reports the number of objects that have compiled
DOC> with errors (objects that compile with errors have status set to 3 in
DOC> obj$). If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#

OBJECTS WITH ERRORS
-------------------
                  0

DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#

ERRORS DURING RECOMPILATION
---------------------------
                          0

PL/SQL procedure successfully completed.

No Invalid Objects . PSU applied Successfully on Database.

6. Check with OPacth lsinventory that Patch successfully applied and bugs are fixed or not :-

[oracle@localhost admin]$ opatch lsinventory
Invoking OPatch 10.2.0.5.1

Oracle Interim Patch Installer version 10.2.0.5.1
Copyright (c) 2010, Oracle Corporation.  All rights reserved.

Oracle Home       : /oracle_home/app
Central Inventory : /oracle11gr2/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 10.2.0.5.1
OUI version       : 10.2.0.5.0
OUI location      : /oracle_home/app/oui
Log file location : /oracle_home/app/cfgtoollogs/opatch/opatch2013-09-28_00-06-02AM.log

Patch history file: /oracle_home/app/cfgtoollogs/opatch/opatch_history.txt

Lsinventory Output file location : /oracle_home/app/cfgtoollogs/opatch/lsinv/lsinventory2013-09-28_00-06-02AM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (2):

Oracle Database 10g                                                  10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 4                            10.2.0.5.0
There are 2 products installed in this Oracle Home.

Interim patches (1) :

Patch  16619894     : applied on Fri Sep 27 17:02:06 GMT+05:30 2013
Unique Patch ID:  16519126
   Created on 28 Jun 2013, 01:27:47 hrs PST8PDT
   Bugs fixed:
     13596521, 8865718, 11790175, 13489660, 9020537, 9772888, 8650138
     8664189, 10091698, 14275629, 14469008, 10092858, 12551710, 7519406
     9821321, 13349665, 8771916, 7509714, 16619894, 8822531, 10139235
     10159846, 13257247, 8350262, 11792865, 7119382, 13632738, 11724962
     16309604, 16309605, 16309606, 8966823, 9320130, 16961614, 16961615
     13775862, 16961616, 11674645, 16961617, 16961618, 15877957, 7026523
     16961619, 15877958, 15877959, 9399589, 14841459, 9672816, 13503598
     9499302, 9150282, 9448311, 9659614, 13632743, 14220725, 9949948, 8882576
     10327179, 7612454, 7111619, 9711859, 9714832, 9735237, 9952230, 15877960
     12780098, 13561951, 15877961, 15877962, 14665116, 15877963, 8660422
     11066597, 16703112, 16279401, 14546673, 14105702, 14459552, 9713537
     14105703, 14105704, 13483152, 13737773, 13737775, 14269955, 12925532
     12748240, 9694101, 14390396, 12862186, 12862187, 10249537, 14727319
     9586877, 8211733, 6694396, 9548269, 7115910, 7710224, 9337325, 8354642
     7602341, 14076510, 10157402, 11856395, 12565867, 6402302, 10327190
     10269717, 13015379, 11693109, 14023636, 10017048, 8546356, 8394351
     9024850, 13561750, 8224558, 9770451, 9360157, 8488233, 9109487, 10132870
     14841558, 9171933, 16817117, 10173237, 9532911, 10068982, 7361418
     10306945, 8666117, 11725006, 6157713, 10214450, 9184754, 14205448
     8544696, 9767674, 16306019, 9323583, 8277300, 13343467, 16279211
     9726739, 16382448, 13791364, 8412426, 10326338, 10165083, 10208905
     12419392, 6651220, 9145204, 13554409, 11076894, 7450366, 11893577
     8970313, 14492313, 6690853, 6011045, 14492314, 11814891, 10162036
     14492315, 10248542, 14492316, 16742123, 9469117, 13359623, 9952270
     9842573, 13343471, 12710774, 10324526, 14546638, 12419258, 9322219
     8636407, 16056270, 10010310, 12828105, 9689310, 9390484, 13736501
     13736502, 9824435, 13736503, 13736504, 13736505, 13736506, 9963497
     9032322, 13736507, 12551700, 12551701, 14035825, 12551702, 11858315
     12551703, 12551704, 10076669, 16270946, 12551705, 12551706, 14040433
     12551707, 6076890, 14258925, 12551708, 9308296, 13916709, 12827745
     12880299, 14038805, 13923855, 9072105, 8528171, 11737047
--------------------------------------------------------------------------------

OPatch succeeded.
 

Applying Critical patch Updates (CPU PATCH)


Applying Critical Patch Updates (CPU).
A Critical Patch Update is a collection of patches for multiple security vulnerabilities. Critical Patch Update patches are usually cumulative but each advisory describes only the security fixes added since the previous Critical Patch Update advisory. Thus, prior Critical Patch Update advisories should be reviewed for information regarding earlier published security fixes.its released on January, April, July &October.

Steps to Apply CPU:

Pre-Installation:
Shutdown all the instance , and oracle services such as listener.
ensure $PATH variable.
Download Patchand unzip it.
Use the Opatch like this : opatch napply -skip_subset -skip_duplicate.
Startup databas.
Post-Installation :

 cd $ORACLE_HOME/rdbms/admin
sqlplus / as sysdba
SQL> @catbundle.sql cpu apply

for more details:

– Shutdown the Oracle instances and services or listener on node 1
– Apply the patch to the on node 1
– Start the Oracle instance of node 1
– Now Shutdown the Oracle instance on node 2
– Apply the patch to on node 2
– Start the Oracle instance of node 2
– Repeat this process as per the number of node.
1. Download the CPU required patchset from Metalink
2. Change the owner of the patch file to oracle user.
# chown –R oracle
3. Set the PATH variable to locate the opatch utility.
$ export PATH=$PATH: $ORACLE_HOME/OPatch
4. unzip the patch and go the unzipped directory
$unzip “patchfile.zip”
5. Find and invoke the Opatch version
$ opatch version
OPatch Version: 10.2.0.4.2
$ opatch lsinventory
If you want check the CPU patch is whether rolling support or not, go to the patch directory
Cd /oracle/??  --patch directory
[oracle@rac1 ??]$ opatch query -all
6. Backup the oraInventory and Opatch directory
$cp -R oraInventory old_oraInventory
$cp -R opatch old_opatch
7. If you are Applying on RAC: Stop Instance/asm/nodeapps of node1
$ srvctl stop instance -d racdb –i racdb1
$ srvctl stop asm -n rac1
$ srvctl stop nodeapps -n rac1
8. Go to the Patch Directory and invoke opatch apply.
$ cd ??  --patch directory
$opatch apply or $opatch napply -skip_subset -skip_duplicate
9. Verify Patches are applied
$opatch lsinventory -detail -oh $ORACLE_HOME
10. Now start the Node1 and repeat the same steps 7 to 9 for Node2
11. Verify Patches are applied
          $opatch lsinventory -detail -oh $ORACLE_HOME
12. Start the Instance/Asm/Nodeapps of node2
$srvctl start instance –d racdb –i racdb2
$srvctl start asm –n rac2
$srvctl start nodeapps –n rac2
$crs_stat –t
Post CPU Patch Steps:
For each database instance running on the Oracle home being patched, connect to the database using SQL*Plus on each node. Connect as SYSDBA and run the catbundle.sql script:
On node1/node2:
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql cpu apply
SQL> @utlrp.sql
The catbundle.sql execution is reflected in the dba_registry_history view by a row associated with bundle series CPU. Check the following log files for any errors:
catbundle_CPU__APPLY_.log, catbundle_CPU__GENERATE_.log on the path $ORACLE_HOME/cfgtoollogs/catbundle
Recompiling Views in the Database
If you already applied this during previous CPU installation then you can skip this section. To check whether view recompilation has already been performed:
SELECT * FROM registry$history where ID = '6452863';
If the view recompilation has been performed, this statement returns one or more rows. If the view recompilation has not been performed, this statement returns no rows.
If no rows returns then go the following steps for RAC environment:
1. Run the pre-check script, which reports the maximum number of views and objects that may be recompiled:
cd $ORACLE_HOME/cpu/view_recompile
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @recompile_precheck_jan2010cpu.sql
Note: If the database is in RAC environment then perform both the steps otherwise (single instance db), perform only step1 skip the step 2.
cd $ORACLE_HOME/cpu/view_recompile
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP UPGRADE;
SQL> @view_recompile_jan2010cpu.sql
SQL> SHUTDOWN;
SQL> STARTUP;
2. Stop all instances except the one where the view recompilation is being executed.
cd $ORACLE_HOME/cpu/view_recompile
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP NOMOUNT;
SQL> ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=spfile;
SQL> SHUTDOWN;
SQL> STARTUP UPGRADE;
SQL> @?/ cpu/view_recompile /view_recompile_jan2008cpu.sql
SQL> SHUTDOWN;
SQL> STARTUP NOMOUNT;
Set the CLUSTER_DATABASE initialization parameter to TRUE:
SQL> ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=spfile;
Restart the database:
SQL> QUIT
cd $CRS_HOME/bin
srvctl start database -d racdb
If any invalid objects were reported, run the utlrp.sql script:
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql
Then, manually recompile any invalid objects:
SQL> alter package schemaname.packagename compile;
Verify Patches are applied.
$opatch lsinventory -detail -oh $CRS_HOME #if you have CRS_HOME
$opatch lsinventory -detail -oh $ORACLE_HOME #if you have both ORACLE_HOME

Cloning Database with RMAN 


SOURCE DB: UAT 
Location='u01/app/oracle/product/11.2.0/dbhome_1'

TARGET DB: CLONE

Location='u02/app/oracle/product/11.2.0/dbhome_1'

STEP 1: TAKE YOUR DATABASE TO
 MOUNT STAGE.
[oracle@ramdev02 ~]$ export ORACLE_SID=uat
[oracle@ramdev02 ~]$ sqlplus / as sysdba

Connected to ideal instance:
SQL> startup mount;
ORACLE instance started.

Total System Global Area 285212672 bytes
Fixed Size                 1218968 bytes
Variable Size             88082024 bytes
Database Buffers         188743680 bytes
Redo Buffers               7168000 bytes
Database mounted.

STEP 2: PUT YOUR DATABASE IN ARCHIVELOG MODE.
SQL> alter database archivelog;

Database altered.

STEP 3: NOW TAKE YOUR DATABASE TO OPEN STAGE
SQL> alter database open;

Database altered.

STEP 4: CONNECT TO YOUR SOURCE DATABASE THROUGH RMAN AND PERFORM BACKUP OF YOUR DATABASE AND ARCHIVELOG FILES
oracle@ramdev02 ~$ export ORACLE_SID=uat
oracle@ramdev02 ~$ rman target /

connected to target database: UAT
RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_uat.f'; # default
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 5;

new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 5 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored
RMAN> backup database plus archivelog;

It will be stored in
 '/u01/app/oracle/flash_recovery_area/UAT/backupset/YYYY_MM_DD’

STEP 5: CREATE A PARAMETER FILE FOR CLONE DATABASE
SQL> create pfile='$ORACLE_HOME/dbs/initclone.ora' from spfile;

File created.
oracle@ramdev02 ~$ vi initclone.ora (target database) $ORACLE_HOME/dbs

STEP 6: DO THE FOLLOWING CHANGE IN CLONE PARAMETER FILE
Source need change to Target (Name and file system location)
clone.__db_cache_size=184549376
clone.__java_pool_size=4194304
clone.__large_pool_size=4194304
clone.__shared_pool_size=83886080
clone.__streams_pool_size=0
*.audit_file_dest='/u02/app/oracle/admin/clone/adump'
*.background_dump_dest='/u02/app/oracle/admin/clone/bdump'
*.compatible='11.2.0.1.0'
*.control_files='/u02/app/oracle/oradata/clone/control01.ctl','/u02/app/oracle/oradata/clone/control02.ctl','/u02/app/oracle/oradata/clone/control03.ctl'
*.core_dump_dest='/u02/app/oracle/admin/clone/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='clone'
#*.db_recovery_file_dest='/u02/app/oracle/flash_recovery_area'
#*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=cloneXDB)'
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=283115520
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u02/app/oracle/admin/clone/udump'
db_file_name_convert='/u01/app/oracle/oradata/uat','/u02/app/oracle/oradata/clone'
log_file_name_convert='/u01/app/oracle/oradata/uat','/u02/app/oracle/oradata/clone'

STEP 7: CREATE THE FOLLOWING DIRECTORIES FOR CONE DATABASE
oracle@ramdev02 ~$ mkdir -p /u02/app/oracle/oradata/clone

oracle@ramdev02 ~$ mkdir –p /u02/app/oracle/admin/clone

oracle@ramdev02 ~$ mkdir –p /u02/app/oracle/admin/clone/adump

oracle@ramdev02 ~$ mkdir –p /u02/app/oracle/admin/clone/bdump

oracle@ramdev02 ~$ mkdir –p /u02/app/oracle/admin/clone/cdump

oracle@ramdev02 ~$ mkdir –p /u02/app/oracle/admin/clone/udump

oracle@ramdev02 ~$ mkdir –p /u02/app/oracle/flash_recovery_area/clone/



STEP 8: CREATE A PASSWORD FILE FOR CLONE DATABASE
oracle@ramdev02 ~$ orapwd file=$ORACLE_HOME/dbs/orapwclone password=oracle entries=5

STEP 9: FIRE THE FOLLWOING COMMAND ON PRIMARY DATABASE TO SET THE SAME PASSWORD OF CLONE DATABASE
alter user sys identified by oracle;

STEP 10: TAKE YOUR DATABASE TO NOMOUNT STAGE AND EXIT FROM SQL PROMPT
oracle@ramdev02 ~$ export ORACLE_SID=clone
oracle@ramdev02 ~$ sqlplus / as sysdba


Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 167772160 bytes
Fixed Size                 1218316 bytes
Variable Size             62916852 bytes
Database Buffers         100663296 bytes
Redo Buffers               2973696 bytes
SQL>

SQL> exit
oracle@ramdev02 ~$

STEP 11: CONNECT TO PRIMARY DATABASE AND CLONE DATABASE BY FIRING FOLLOWING COMMAND
[oracle@ramdev02 ~]$ export ORACLE_SID=uat
[oracle@ramdev02 ~]$ rman auxiliary /


connected to auxiliary database: uat (not mounted)

STEP 12: FIRE THE FOLLOWING COMMAND TO CREATE THE CLONE
RMAN>duplicate database to "clone" backup location '/u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26' nofilenamecheck;

Starting Duplicate Db at 27-MAR-14

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''UAT'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''CLONE'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile from  '/u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26/o1_mf_ncnnf_TAG20140326T194706_9m5rc4xy_.bkp';
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''UAT'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''CLONE'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area    1252663296 bytes

Fixed Size                     2212936 bytes
Variable Size                805309368 bytes
Database Buffers             436207616 bytes
Redo Buffers                   8933376 bytes

Starting restore at 27-MAR-14
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK

channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u02/app/oracle/oradata/clone/control01.ctl
output file name=/u02/app/oracle/flash_recovery_area/clone/control02.ctl
Finished restore at 27-MAR-14

database mounted
released channel: ORA_AUX_DISK_1
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK

contents of Memory Script:
{
   set until scn  1024051;
   set newname for datafile  1 to
 "/u02/app/oracle/oradata/clone/system01.dbf";
   set newname for datafile  2 to
 "/u02/app/oracle/oradata/clone/sysaux01.dbf";
   set newname for datafile  3 to
 "/u02/app/oracle/oradata/clone/undotbs01.dbf";
   set newname for datafile  4 to
 "/u02/app/oracle/oradata/clone/users01.dbf";
   set newname for datafile  5 to
 "/u02/app/oracle/oradata/clone/example01.dbf";
   restore
   clone database
   ;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 27-MAR-14
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u02/app/oracle/oradata/clone/system01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26/o1_mf_nnndf_TAG20140326T194706_9m5rc49m_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26/o1_mf_nnndf_TAG20140326T194706_9m5rc49m_.bkp tag=TAG20140326T194706
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00002 to /u02/app/oracle/oradata/clone/sysaux01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26/o1_mf_nnndf_TAG20140326T194706_9m5rc6s5_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26/o1_mf_nnndf_TAG20140326T194706_9m5rc6s5_.bkp tag=TAG20140326T194706
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:16
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u02/app/oracle/oradata/clone/undotbs01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26/o1_mf_nnndf_TAG20140326T194706_9m5rc6jj_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26/o1_mf_nnndf_TAG20140326T194706_9m5rc6jj_.bkp tag=TAG20140326T194706
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u02/app/oracle/oradata/clone/users01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26/o1_mf_nnndf_TAG20140326T194706_9m5rcb1d_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26/o1_mf_nnndf_TAG20140326T194706_9m5rcb1d_.bkp tag=TAG20140326T194706
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00005 to /u02/app/oracle/oradata/clone/example01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26/o1_mf_nnndf_TAG20140326T194706_9m5rc6cn_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26/o1_mf_nnndf_TAG20140326T194706_9m5rc6cn_.bkp tag=TAG20140326T194706
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
Finished restore at 27-MAR-14

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=6 STAMP=843322272 file name=/u02/app/oracle/oradata/clone/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=7 STAMP=843322272 file name=/u02/app/oracle/oradata/clone/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=8 STAMP=843322272 file name=/u02/app/oracle/oradata/clone/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=9 STAMP=843322272 file name=/u02/app/oracle/oradata/clone/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=10 STAMP=843322272 file name=/u02/app/oracle/oradata/clone/example01.dbf

contents of Memory Script:
{
   set until scn  1024051;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 27-MAR-14
using channel ORA_AUX_DISK_1

starting media recovery

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=7
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26/o1_mf_annnn_TAG20140326T194757_9m5rdp84_.bkp
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/UAT/backupset/2014_03_26/o1_mf_annnn_TAG20140326T194757_9m5rdp84_.bkp tag=TAG20140326T194757
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u02/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_7_843246981.dbf thread=1 sequence=7
channel clone_default: deleting archived log(s)
archived log file name=/u02/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_7_843246981.dbf RECID=1 STAMP=843322274
media recovery complete, elapsed time: 00:00:02
Finished recover at 27-MAR-14

contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  db_name =
 ''CLONE'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    1252663296 bytes

Fixed Size                     2212936 bytes
Variable Size                805309368 bytes
Database Buffers             436207616 bytes
Redo Buffers                   8933376 bytes

sql statement: alter system set  db_name =  ''CLONE'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    1252663296 bytes

Fixed Size                     2212936 bytes
Variable Size                805309368 bytes
Database Buffers             436207616 bytes
Redo Buffers                   8933376 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "CLONE" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 ( '/u02/app/oracle/oradata/clone/redo01.log' ) SIZE 50 M  REUSE,
  GROUP  2 ( '/u02/app/oracle/oradata/clone/redo02.log' ) SIZE 50 M  REUSE,
  GROUP  3 ( '/u02/app/oracle/oradata/clone/redo03.log' ) SIZE 50 M  REUSE
 DATAFILE
  '/u02/app/oracle/oradata/clone/system01.dbf'
 CHARACTER SET AL32UTF8


contents of Memory Script:
{
   set newname for tempfile  1 to
 "/u02/app/oracle/oradata/clone/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/u02/app/oracle/oradata/clone/sysaux01.dbf",
 "/u02/app/oracle/oradata/clone/undotbs01.dbf",
 "/u02/app/oracle/oradata/clone/users01.dbf",
 "/u02/app/oracle/oradata/clone/example01.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u02/app/oracle/oradata/clone/temp01.dbf in control file

cataloged datafile copy
datafile copy file name=/u02/app/oracle/oradata/clone/sysaux01.dbf RECID=1 STAMP=843322296
cataloged datafile copy
datafile copy file name=/u02/app/oracle/oradata/clone/undotbs01.dbf RECID=2 STAMP=843322296
cataloged datafile copy
datafile copy file name=/u02/app/oracle/oradata/clone/users01.dbf RECID=3 STAMP=843322296
cataloged datafile copy
datafile copy file name=/u02/app/oracle/oradata/clone/example01.dbf RECID=4 STAMP=843322296

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=843322296 file name=/u02/app/oracle/oradata/clone/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=843322296 file name=/u02/app/oracle/oradata/clone/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=843322296 file name=/u02/app/oracle/oradata/clone/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=843322296 file name=/u02/app/oracle/oradata/clone/example01.dbf

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 27-MAR-14

RMAN> exit


Recovery Manager complete.
[oracle@ramdev02 ~]$ . ./clone.env
[oracle@ramdev02 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Mar 27 16:13:55 2014

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> select name,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------


CLONE     READ WRITE