Friday, 3 October 2014

Setting up a physical standby in Oracle 12C


Setting up a physical standby in Oracle 12C

In our configuration we will have primary database as PROD1 and physical standby as DR1

## Making changes to the primary environment

SQL> alter system set log_archive_config='dg_config=(prod1,dr1)' ;

System altered.

SQL> alter system set log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_roles,all_logfiles) db_unique_name=prod1' ;

System altered.

SQL> alter system set log_archive_dest_2='service=dr1 valid_for=(primary_roles,online_logfiles) db_unique_name=dr1' ;

System altered.

SQL> alter system set fal_client=prod1;

System altered.

SQL> alter system set fal_server=dr1 ;

System altered.

SQL> alter system set db_file_name_convert='/u01/app/oracle/oradata/dr1','/u01/app/oracle/oradata/prod1' scope=spfile;

System altered.

SQL> alter system set log_file_name_convert='/u01/app/oracle/oradata/dr1','/u01/app/oracle/oradata/prod1' scope=spfile;

System altered.

SQL> alter system set standby_file_management=auto ;

System altered.

## Making changes to the standby environment

SQL> alter system set log_archive_config='dg_config=(prod1,dr1)' ;

System altered.

SQL> alter system set log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_roles,all_logfiles) db_unique_name=dr1' ;

System altered.

SQL> alter system set log_archive_dest_2='service=prod1 valid_for=(primary_roles,online_logfiles) db_unique_name=prod1' ;

System altered.

SQL> alter system set fal_client=dr1;

System altered.

SQL> alter system set fal_server=prod1 ;

System altered.

SQL> alter system set db_file_name_convert='/u01/app/oracle/oradata/prod1','/u01/app/oracle/oradata/dr1' scope=spfile;

System altered.

SQL> alter system set log_file_name_convert='/u01/app/oracle/oradata/prod1','/u01/app/oracle/oradata/dr1' scope=spfile;

System altered.

SQL> alter system set standby_file_management=auto ;

System altered.

__________________

## Below are tns entries

PROD1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = hostname of primary)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = prod1)
    )
  )


DR1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = hostname of standby)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = dr1)
    )
  )

## Appropriate directories and Password files are also in place

[oracle@node4 ~]$ ls -ld /u01/app/oracle/oradata/dr1
drwxr-xr-x 2 oracle oinstall 4096 Oct  2 16:49 /u01/app/oracle/oradata/dr1


[oracle@node4 ~]$ ls -ltr /u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwdr1
-rw-r----- 1 oracle oinstall 7680 Oct  2 16:45 /u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwdr1

[oracle@node4 ~]$ ls -ltr /u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwprod1
-rw-r----- 1 oracle oinstall 7680 Oct  2 16:19 /u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwprod1


[oracle@node4 ~]$ rman target/

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Oct 2 16:44:16 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PROD1 (DBID=2081254351)

RMAN> connect auxiliary sys@dr1

auxiliary database Password:
connected to auxiliary database: PROD1 (not mounted)

RMAN> duplicate target database for standby from active database;

Starting Duplicate Db at 02-OCT-14
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 10/02/2014 16:44:47
RMAN-05501: aborting duplication of target database
RMAN-05609: Must specify a username for target connection when using active duplicate

RMAN> exit


Recovery Manager complete.
[oracle@node4 ~]$ rman target sys@prod1 auxiliary sys@dr1

Recovery Manager: Release 12.1.0.1.0 - Production on Thu Oct 2 16:44:59 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

target database Password:
connected to target database: PROD1 (DBID=2081254351)
auxiliary database Password:
connected to auxiliary database: PROD1 (not mounted)

RMAN> duplicate target database for standby from active database;

Starting Duplicate Db at 02-OCT-14
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=22 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwprod1' auxiliary format
 '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwdr1'   ;
}
executing Memory Script

Starting backup at 02-OCT-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=52 device type=DISK
Finished backup at 02-OCT-14

contents of Memory Script:
{
   restore clone from service  'prod1' standby controlfile;
}
executing Memory Script

Starting restore at 02-OCT-14
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prod1
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output file name=/u01/app/oracle/oradata/dr1/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/dr1/control02.ctl
Finished restore at 02-OCT-14

contents of Memory Script:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:
{
   set newname for tempfile  1 to
 "/u01/app/oracle/oradata/dr1/temp01.dbf";
   switch clone tempfile all;
   set newname for datafile  1 to
 "/u01/app/oracle/oradata/dr1/system01.dbf";
   set newname for datafile  2 to
 "/u01/app/oracle/oradata/dr1/example01.dbf";
   set newname for datafile  3 to
 "/u01/app/oracle/oradata/dr1/sysaux01.dbf";
   set newname for datafile  4 to
 "/u01/app/oracle/oradata/dr1/undotbs01.dbf";
   set newname for datafile  6 to
 "/u01/app/oracle/oradata/dr1/users01.dbf";
   restore
   from service  'prod1'   clone database
   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/dr1/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 02-OCT-14
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prod1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/dr1/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:36
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prod1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/dr1/example01.dbf
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: using network backup set from service prod1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/dr1/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prod1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/dr1/undotbs01.dbf
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: using network backup set from service prod1
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/dr1/users01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 02-OCT-14

sql statement: alter system archive log current

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

datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=859913214 file name=/u01/app/oracle/oradata/dr1/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=859913214 file name=/u01/app/oracle/oradata/dr1/example01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=859913214 file name=/u01/app/oracle/oradata/dr1/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=859913214 file name=/u01/app/oracle/oradata/dr1/undotbs01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=859913214 file name=/u01/app/oracle/oradata/dr1/users01.dbf
Finished Duplicate Db at 02-OCT-14

RMAN> exit


Recovery Manager complete.

## Login to the standby database

SQL>  recover managed standby database disconnect;
Media recovery complete.

SQL> @arch

 SEQUENCE# ARCHIVED APPLIED   COMPLETION_TIME
---------- ------------ --------------------
         7 YES YES       02-oct-2014 16:50:14
         8 YES YES       02-oct-2014 16:50:17


Wednesday, 1 October 2014

12C Out-of-Place Refresh Option (Materialized Views)

Refreshing Materialized views at a fast speed in Oracle has always been a challenge and Oracle 12C has taken this 1 step ahead with the new enhancement in 12C for materialized view in the form of out of place refresh.

Oracle provides a package DBMS_MVIEW which has three APIs for performing refresh operations :

1) DBMS_MVIEW.REFRESH :- Refresh one or more materialized views.

2) DBMS_MVIEW.REFRESH_ALL_MVIEWS :- Refresh all materialized views.

3) DBMS_MVIEW.REFRESH_DEPENDENT :- Refresh all materialized views that depend on a specified master table or materialized view or list of master tables or materialized views.

New enhancement in 12C for materialized view which is out of place refresh is really a great feature of Oracle 12C , in this type of refresh oracle uses outside tables and they are used to improve materialized view availability and the refresh performance in certain situations.

Because oracle uses outside tables Out of place refresh requires extra storage space and the indexes for the duration of the refresh. Therefore, you must have enough available tablespace space or auto extend should be turned on.

To speed up the same operation oracle internally uses partition exchange techniques to improve performance and availability of the materialized views.

The partition exchange in out-of-place PCT refresh impacts the global index on the materialized view. Therefore, if there are global indexes defined on the materialized view container table, Oracle disables the global indexes before doing the partition exchange and rebuild the global indexes after the partition exchange. This rebuilding is additional overhead.


Using the refresh interface in the DBMS_MVIEW package, with method = ? and out_of_place = true, out-of-place fast refresh are attempted first, then out-of-place PCT refresh, and finally out-of-place complete refresh.

An example is the following:

DBMS_MVIEW.REFRESH('CAL_MONTH_SALES_MV', method => '?', atomic_refresh => FALSE, out_of_place => TRUE);

Restrictions and Considerations with Out-of-Place Refresh :-

## Out-of-place refresh has all the restrictions that apply when using the corresponding in-place refresh. In addition, it has the following restrictions:

## Only materialized join views and materialized aggregate views are allowed

## No ON COMMIT refresh is permitted

## No remote materialized views, cube materialized views, object materialized views are permitted

## No LOB columns are permitted

## Not permitted if materialized view logs, triggers, or constraints (except NOT NULL) are defined on the materialized view

## Not permitted if the materialized view contains the CLUSTERING clause

## Not applied to complete refresh within a CREATE or ALTER MATERIALIZED VIEW session or an ALTER TABLE session

## Atomic mode is not permitted. If you specify atomic_refresh as TRUE and out_of_place as TRUE, an error is displayed

For out-of-place PCT refresh, there is the following restriction :

## No UNION ALL or grouping sets are permitted

For out-of-place fast refresh, there are the following restrictions:

## No UNION ALL, grouping sets or outer joins are permitted

## Not allowed for materialized join views when more than one base table is modified with mixed DML statements

Understanding Histograms Slide Deck now available

Below is the link of my slide deck for Understanding Histograms

Click here to download the pdf http://goo.gl/Q72WR5   

This is the presentation which i gave at 7th conference of AIOUG NIC held in Mohali, India. Happy Reading everyone.

Tuesday, 30 September 2014

All India Oracle Users Group (AIOUG) North India Chapter 7th Conference

We had just ended the 7th conference of All India Oracle Users Group (AIOUG) North India Chapter, There were great topics given by great speakers like Exadata & Smart Scan from Oracle ACE Aman Sharma, 12C EM Cloud control from deepak. It was a great event with great audience showing up on the day, this event happens last saturday on every month in North India. I also got a chance as a Speaker to present on Oracle Histograms. The event this time took place in Mohali, India. I would like to thank everyone who came to the event and shared their Oracle Knowledge through this event. More information about AIOUG NIC can be found on the facebook page https://www.facebook.com/AIOUG.NIC .

Wednesday, 10 September 2014

Oracle Management Server (OMS) startup in 12C


As 12C OEM Cloud control uses weblogic so the following has to be started whenever you want OMS to be up and running, sometimes we get error that AdminServer Could Not Be Started, so in that case we have to make sure EMGC_ADMINSERVER is up and running, this error comes when the lock files are not cleared properly, so we have to shutdown oms and clean up the files and then restart them all over again and then we will get to see the following up and running. The lock files to be cleared are in the following location

[oracle@node4 ~]$ cd /u01/app/oracle/product/gc_inst/user_projects/domains/GCDomain/servers
[oracle@node4 servers]$ ls -ltr
total 16
drwxr-x--- 10 oracle oinstall 4096 Sep  9 20:09 EMGC_ADMINSERVER
drwxr-x---  3 oracle oinstall 4096 Sep  9 20:23 domain_bak
drwxr-x--- 10 oracle oinstall 4096 Sep  9 20:31 EMGC_OMS1
-rw-r-----  1 oracle oinstall   14 Sep 10 16:33 AdminServerTag


[oracle@node4 bin]$  ps -ef | grep EMGC_ADMINSERVER

oracle   11989 11944  5 16:33 ?        00:02:48 /u01/app/oracle/product/middleware/jdk16/jdk/bin/java -server -Xms256m -Xmx512m -XX:MaxPermSize=512m -Dweblogic.Name=EMGC_ADMINSERVER -Djava.security.policy=/u01/app/oracle/product/middleware/wlserver_10.3/server/lib/weblogic.policy -Dweblogic.ProductionModeEnabled=true -Dweblogic.system.BootIdentityFile=/u01/app/oracle/product/gc_inst/user_projects/domains/GCDomain/servers/EMGC_ADMINSERVER/security/boot.properties -Dweblogic.nodemanager.ServiceEnabled=true -Djava.security.egd=file:///dev/./urandom -Dweblogic.debug.DebugWebAppSecurity=true -Dweblogic.SSL.LoginTimeoutMillis=300000 -Djps.auth.debug=true -Djps.authz=ACC -Djps.combiner.optimize.lazyeval=true -Djps.combiner.optimize=true -Djps.policystore.hybrid.mode=false -Djps.subject.cache.key=5 -Djps.subject.cache.ttl=600000 -Doracle.apm.home=/u01/app/oracle/product/middleware/oms/apm/ -DAPM_HELP_FILENAME=oesohwconfig.xml -da -Dplatform.home=/u01/app/oracle/product/middleware/wlserver_10.3 -Dwls.home=/u01/app/oracle/product/middleware/wlserver_10.3/server -Dweblogic.home=/u01/app/oracle/product/middleware/wlserver_10.3/server -Dcommon.components.home=/u01/app/oracle/product/middleware/oracle_common -Djrf.version=11.1.1 -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger -Ddomain.home=/u01/app/oracle/product/gc_inst/user_projects/domains/GCDomain -Djrockit.optfile=/u01/app/oracle/product/middleware/oracle_common/modules/oracle.jrf_11.1.1/jrocket_optfile.txt -Doracle.server.config.dir=/u01/app/oracle/product/gc_inst/user_projects/domains/GCDomain/config/fmwconfig/servers/EMGC_ADMINSERVER -Doracle.domain.config.dir=/u01/app/oracle/product/gc_inst/user_projects/domains/GCDomain/config/fmwconfig -Digf.arisidbeans.carmlloc=/u01/app/oracle/product/gc_inst/user_projects/domains/GCDomain/config/fmwconfig/carml -Digf.arisidstack.home=/u01/app/oracle/product/gc_inst/user_projects/domains/GCDomain/config/fmwconfig/arisidprovider -Doracle.security.jps.config=/u01/app/oracle/product/gc_inst/user_projects/domains/GCDomain/config/fmwconfig/jps-config.xml -Doracle.deployed.app.dir=/u01/app/oracle/product/gc_inst/user_projects/domains/GCDomain/servers/EMGC_ADMINSERVER/tmp/_WL_user -Doracle.deployed.app.ext=/- -Dweblogic.alternateTypesDirectory=/u01/app/oracle/product/middleware/oracle_common/modules/oracle.ossoiap_11.1.1,/u01/app/oracle/product/middleware/oracle_common/modules/oracle.oamprovider_11.1.1,/u01/app/oracle/product/middleware/oracle_common/modules/oracle.jps_11.1.1,/u01/app/oracle/product/middleware/oms/sysman/jlib -Djava.protocol.handler.pkgs=oracle.mds.net.protocol -Dweblogic.jdbc.remoteEnabled=false -Doracle.apm.home=/u01/app/oracle/product/middleware/oms/apm/ -DAPM_HELP_FILENAME=oesohwconfig.xml -Dweblogic.management.discover=true -Dwlw.iterativeDev=false -Dwlw.testConsole=false -Dwlw.logErrorsToConsole=false -Dweblogic.ext.dirs=/u01/app/oracle/product/middleware/patch_wls1036/profiles/default/sysext_manifest_classpath weblogic.Server


How to start the Oracle Management Server in 12C with weblogic

I had just Started using Release 4 of Oracle Enterprise Manager Cloud Control 12c

Starting up my web tier and 12C Oracle Management Server for cloud control

[oracle@node4 ~]$ cd $OMS_HOME
[oracle@node4 oms]$ pwd
/u01/app/oracle/product/middleware/oms

[oracle@node4 oms]$ cd bin

[oracle@node4 bin]$ ./emctl stop oms -all
Oracle Enterprise Manager Cloud Control 12c Release 4
Copyright (c) 1996, 2014 Oracle Corporation.  All rights reserved.
Stopping WebTier...
WebTier Successfully Stopped
Stopping Oracle Management Server...
Oracle Management Server Successfully Stopped
AdminServer Successfully Stopped
Oracle Management Server is Down

[oracle@node4 bin]$ ./emctl start oms
Oracle Enterprise Manager Cloud Control 12c Release 4
Copyright (c) 1996, 2014 Oracle Corporation.  All rights reserved.
Starting Oracle Management Server...
Starting WebTier...
WebTier Successfully Started
Oracle Management Server Successfully Started
Oracle Management Server is Up

Click the below picture to get the closer look


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

To shutdown the OMS do the following :--

[oracle@node4 ~]$ cd /u01/app/oracle/product/middleware/oms
[oracle@node4 oms]$ cd bin
[oracle@node4 bin]$ ./emctl stop oms -all
Oracle Enterprise Manager Cloud Control 12c Release 4  
Copyright (c) 1996, 2014 Oracle Corporation.  All rights reserved.
Stopping WebTier...
WebTier Successfully Stopped
Stopping Oracle Management Server...
Oracle Management Server Successfully Stopped
AdminServer Successfully Stopped
Oracle Management Server is Down



12C Data guard Broker ORA-01017: invalid username/password; logon denied

## While doing switchover and failover with 12C Broker i kept on investigating for a long time why invalid username password error is coming even though the password and password file is same for primary and standby, i later realized that the password was not complex and that was the reason i was getting this error. Let us see now for a switchover and failover example.

DGMGRL> switchover to prd ;
Performing switchover NOW, please wait...
Operation requires a connection to instance "prd" on database "prd"
Connecting to instance "prd"...
ORA-01017: invalid username/password; logon denied

Warning: You are no longer connected to ORACLE.

        connect to instance "prd" of database "prd"

DGMGRL> switchover to prd ;
not logged on
DGMGRL> connect sys@drs
Password:
ORA-01017: invalid username/password; logon denied

## Now i made sure my password is complex

DGMGRL> connect sys@drs
Password:
Connected as SYSDBA.
DGMGRL> switchover to prd ;
Performing switchover NOW, please wait...
Operation requires a connection to instance "prd" on database "prd"
Connecting to instance "prd"...
Connected as SYSDBA.
New primary database "prd" is opening...
Operation requires startup of instance "drs" on database "drs"
Starting instance "drs"...
ORACLE instance started.
Database mounted.
Switchover succeeded, new primary is "prd"
DGMGRL> show configuration

Configuration - myconfig1

  Protection Mode: MaxPerformance
  Databases:
  prd - Primary database
    drs - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS

RMAN-05609: Must specify a username for target connection when using active duplicate

While i was setting up my 12C Standby database i faced an error which says RMAN-05609: Must specify a username for target connection when using active duplicate , because we had to put a username instead of using OS authentication, so here is how we solved it.

[oracle@node4 ~]$ rman target/ auxiliary sys@drs

Recovery Manager: Release 12.1.0.1.0 - Production on Mon Sep 8 14:59:08 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PRD (DBID=1921407359)
auxiliary database Password:
connected to auxiliary database: PRD (not mounted)

RMAN> duplicate target database to drs from active database;

Starting Duplicate Db at 08-SEP-14
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/08/2014 14:59:27
RMAN-05501: aborting duplication of target database
RMAN-05609: Must specify a username for target connection when using active duplicate

RMAN> exit


Recovery Manager complete.

## Now we specify a username and the error does not come

[oracle@node4 ~]$ rman target sys@prd auxiliary sys@drs

Recovery Manager: Release 12.1.0.1.0 - Production on Mon Sep 8 14:59:44 2014

Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.

target database Password:
connected to target database: PRD (DBID=1921407359)
auxiliary database Password:
connected to auxiliary database: PRD (not mounted)

RMAN> duplicate target database for standby from active database;

Starting Duplicate Db at 08-SEP-14
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=21 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwprd' auxiliary format
 '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/orapwdrs'   ;
}
executing Memory Script

Starting backup at 08-SEP-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=49 device type=DISK
Finished backup at 08-SEP-14

contents of Memory Script:
{
   restore clone from service  'prd' standby controlfile;
}
executing Memory Script

Starting restore at 08-SEP-14
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prd
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output file name=/u01/app/oracle/oradata/drs/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/drs/control02.ctl
Finished restore at 08-SEP-14

contents of Memory Script:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:
{
   set newname for tempfile  1 to
 "/u01/app/oracle/oradata/drs/temp01.dbf";
   switch clone tempfile all;
   set newname for datafile  1 to
 "/u01/app/oracle/oradata/drs/system01.dbf";
   set newname for datafile  2 to
 "/u01/app/oracle/oradata/drs/example01.dbf";
   set newname for datafile  3 to
 "/u01/app/oracle/oradata/drs/sysaux01.dbf";
   set newname for datafile  4 to
 "/u01/app/oracle/oradata/drs/undotbs01.dbf";
   set newname for datafile  6 to
 "/u01/app/oracle/oradata/drs/users01.dbf";
   restore
   from service  'prd'   clone database
   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/drs/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 08-SEP-14
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prd
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/drs/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:26
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prd
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/drs/example01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prd
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/drs/sysaux01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prd
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/drs/undotbs01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service prd
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/drs/users01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 08-SEP-14

sql statement: alter system archive log current

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

datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=857746892 file name=/u01/app/oracle/oradata/drs/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=857746892 file name=/u01/app/oracle/oradata/drs/example01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=857746892 file name=/u01/app/oracle/oradata/drs/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=857746892 file name=/u01/app/oracle/oradata/drs/undotbs01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=857746892 file name=/u01/app/oracle/oradata/drs/users01.dbf
Finished Duplicate Db at 08-SEP-14

RMAN> exit


Recovery Manager complete.