Wednesday, November 11, 2015

Cloning

What is Cloning?

Database Cloning is a procedure that can be used to create an identical copy of the existing Oracle database. DBA’s sometimes need to clone databases to test backup and recovery strategies or export a table that was dropped from the production database and import it back into the production database. Cloning can be done on separate hosts or on the same host and is different from standby database.
What is Oracle Database Clone :
complete and separate copy of a database system that includes the business data, the DBMS software and any other application tiers that make up the environment. Cloning is a different kind of operation to replication and backups in that the cloned environment is both fully functional and separate in its own right. Additionally the cloned environment may be modified at its inception due to configuration changes or data sub setting.
Second : Benefit Of Clone :
1-useful for the DBA who wants to give his developers a full-sized TEST and DEV instance by cloning the PROD instance into the development server areas.
2-quickly migrate a system from one server to another .
3-fastest way to copy a Oracle database .
Reason for Cloning
In every oracle development and production environment there will become the need to transport the entire database from one physical machine to another. This copy may be used for development, production testing, beta testing, etc, but rest assured that this need will aPRODe and management will ask you to perform this task quickly. Listed below are the most typical uses:
Relocating an Oracle database to another machine.
Moving Oracle database to new Storage media.
Renaming Oracle database.
Database Cloning can be done using the following methods,
Cold Cloning
Hot Cloning
RMAN Cloning

METHOD 1: COLD CLONING

Cold Cloning is one the reliable methods that is done using the Cold Backup. The drawback of this method is that the database has to be shutdown while taking the cold backup.
Considerations:

Source Database Name: PROD
Clone Database Name: SNAP
Source Database physical files path=/u01/PROD/oradata
Cloned Database physical files path=/u02/SNAP/oradata
Steps to be followed:

Startup the source database (if not open)
$ export ORACLE_SID=PROD
$ sqlplus / as sysdba
SQL> startup
Find out the path and names of datafiles, control files, and redo log files.
SQL> select name from v$datafile;
SQL> select member from v$logfile;
SQL> select name from v$controlfile;
Take the control file backup.
SQL> alter database backup controlfile to trace;
Parameter file backup.
If ‘PROD’ database is using spfile,
SQL> create pfile=’/u02/SNAP/initSNAP.ora’ from spfile;
If database is using pfile, use OS command to copy the pfile to a backup location.
Shutdown the ‘PROD’ database
SQL> shutdown
Copy all data files, control files, and redo log files of ‘PROD’ database to a target database location.
$ mkdir /u02/SNAP/oradata
$ cp /u01/PROD/oradata/* /u02/SNAP/oradata/
Create appropriate directory structure in clone database for dumps and specify them in the parameter file.
$ mkdir -p /u02/SNAP/{bdump,udump}
Edit the clone database parameter file and make necessary changes to the clone database
$ cd /u02/SNAP/
$ vi initSNAP.ora
db_name=SNAP
control_files=/u02/SNAP/oradata/cntrl01.ctl
background_dump_dest=/u02/SNAP/bdump
user_dump_dest=/u02/SNAP/udump
. . .
. . .
:wq!
Startup the clone database in NOMOUNT stage.
$ export ORACLE_SID=SNAP
SQL> startup nomount pfile=’/u02/SNAP/initSNAP.ora’
Create the control file trace for the clone database using the trace control file and specify the appropriate paths for redolog and datafiles.
CREATE CONTROLFILE SET DATABASE “SNAP” RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ‘/u02/SNAP/oradata/redo01.log’ SIZE 5M,
GROUP 2 ‘/u02/SNAP/oradata/redo02.log’ SIZE 5M,
DATAFILE
‘/u02/SNAP/oradata/system01.dbf’,
‘/u02/SNAP/oradata/undotbs01.dbf’,
‘/u02/SNAP/oradata/sysaux01.dbf’,
‘/u02/SNAP/oradata/users01.dbf’,
‘/u02/SNAP/oradata/example01.dbf’
CHARACTER SET AL32UTF8
Create the control file by running from the trace path
SQL> @u01/PROD/source/udump/cntrl.sql
Once the control file’s successfully created, open the database with resetlogs option.
SQL> alter database open resetlogs;
METHOD 2: HOT CLONING

Hot database cloning is more suitable for databases which are running 24X7X365 type of databases and is done using the hot backup. For hot database cloning, database has to be in archivelog mode and there is no need to shutdown the database.
Considerations:

Source Database Name: PROD
Clone Database Name: SNAP
Source Database physical files path=/u01/PROD/oradata
Cloned Database physical files path=/u02/SNAP/oradata
Steps to be followed:

1. Find out the path and names of datafiles.
SQL> select name from v$datafile;
2. Backup the parameter file
If ‘PROD’ database is using spfile create pfile,
SQL> create pfile=’/u02/SNAP/initSNAP.ora’ from spfile;
If database is using pfile, use OS command to copy the pfile to a backup location.
3. Note down the oldest log sequence number.
SQL> alter system switch logfile;
SQL> archive log list;
4. Place the database to backup mode
SQL> alter database begin backup;
5. Copy all data files of ‘PROD’ database to a clone location.
$ mkdir /u02/SNAP/oradata
$ cp /u01/PROD/source/oradata/*.dbf /u02/SNAP/oradata/
6. After copying all datafiles, release the database from backup mode.
SQL> alter database end backup;
7. Switch the current log file and note down the oldest log sequence number
SQL> alter system switch logfile;
SQL> archive log list;
8. Copy all archive log files generated during FIRST old log sequence no. to the LAST old log sequence no. during which the database was in backup mode.
9. Take the control file trace backup to the trace path
SQL> alter database backup controlfile to trace;
10. Create appropriate directory structure for the clone database and specify the same
$ cd /u02/SNAP
$ mkdir bdump udump
11. Edit the clone database parameter file and make necessary changes to the clone database
$ cd /u02/SNAP
$ vi initSNAP.ora
db_name=SNAP
control_files=/u02/SNAP/oradata/cntrl01.ctl
background_dump_dest=/u02/SNAP/bdump
user_dump_dest=/u02/SNAP/udump
. . .
. . .
:wq!
12. Startup the cloned database in NOMOUNT phase.
$ export ORACLE_SID=SNAP
SQL> startup nomount pfile=’/u02/SNAP/initSNAP.ora’
13. Create the control file for the clone database using the trace control file.
CREATE CONTROLFILE SET DATABASE “SNAP” RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ‘/u02/SNAP/oradata/redo01.log’ SIZE 5M,
GROUP 2 ‘/u02/SNAP/oradata/redo02.log’ SIZE 5M,
DATAFILE
‘/u02/SNAP/oradata/system01.dbf’,
‘/u02/SNAP/oradata/undotbs01.dbf’,
‘/u02/SNAP/oradata/sysaux01.dbf’,
‘/u02/SNAP/oradata/users01.dbf’,
‘/u02/SNAP/oradata/example01.dbf’
CHARACTER SET AL32UTF8;
14. Create the control file by running trace file from the trace path
SQL> @u01/PROD/source/udump/cntrl.sql
15. Recover the database using backup controlfile option.
SQL> recover database using backup controlfile until cancel;
16. You will be prompted to feed the archive log files henceforth. Specify the absolute path and file name for the archive log files and keep feeding them until you cross the LAST old sequence no. (Refer: Step 8), type CANCEL to end the media recovery.
17. Open the database with resetlogs option.
SQL> alter database open resetlogs;
11g RMAN Cloning using Duplicate Command
Today I was given a task to perform Rman cloning from server prod to Dev.
NOTE: Here i'm doing backup based Duplication instead of Active duplication (NO backup method)
Here my DEV server is already identical to prod except with a data in it Since my both prod and dev server are 11gr2 I decided to go with Rman Duplicate Command, even though  we can go either for Data Pump  or Rman or Manual Copy(cp) methods but my prod size is around 2TB so Rman is a better solution for it(since its fast and recommended)

SQL> select banner from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE    11.2.0.2.0      Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 – Production
$ cat    /etc/redhat-release
Red Hat Enterprise Linux Server release 5.4 (Tikanga)

Step 1:   Take the backup of the prod server either HOT or COLD (I did cold) depending upon your situation
For a cold backup
SQL>   shutdown Immediate;
SQL>   Startup mount;
And connect to RMAN (I have no catalog)

Rman target / nocatalog
Rman > configure controlfile autobackup on;

Allocate more channels depending upon number of CPU’s available on your database, here I used 12 channels
RMAN >   configure device type disk parallelism 12 backup type to backupset;
RMAN>   show all ;
RMAN configuration parameters for database with db_unique_name PROD are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/opt/oracle/product/11.2.0.2/dbs/snapcf_PROD.f'; # default

Rman >  run {
2>  allocate channel d1 type disk;
3> Backup full tag full_offline_bkup
4> Format ‘/var/backup/corppsdb/rman/db_t%t_s%s_p%p’
5> Database plus archivelog;
6> Release channel d1;
}

If you write a script like above then Rman uses only 1 channel even though you set it for 12 paths by default.

Rman >  run {
2>Backup full tag full_offline_bkup
3> Format ‘/var/backup/corppsdb/rman/db_t%t_s%s_p%p’
4> Database plus archivelog;
}

Now it uses 12 channels…….
It took me around 12 hrs. to complete backup to the file location specified (12 backup sets created)
STEP 2 :  Move all the backup sets to the DEV server using either SCP or SFTP or FTP Or whatever you are convenient to a specific location

STEP 3 :   Restore all the data into the DEV server using RMAN Duplicate Command
Before Doing RMAN Duplication makes sure you have TNS entry of prod in DEV server
Go to the $ORACLE_HOME/network/admin location and open tnsnames.ora file and see if not there copy from prod and put in dev  tnsnames.ora file

I already have both Parameter file and Controlfile in DEV server but if you don’t have you need to create pfile and controlfile which is same as like PROD pfile and controlfile, for this you need to copy pfile and controlfile from prod and change all parameters according to the DEV

The two main mandatory parameters we need to change in DEV are
db_file_name_convert=(<source_db_path>,<target_db_path>)
log_file_name_convert=(<source_db_path>,<target_db_path>)

Password file also should create in $ORACLE_HOME/dbs
orapwd file=${ORACLE_HOME}/dbs/orapw${ORACLE_SID} password=<your password>

Then shut down and startup dev in NOMOUNT again…..
SQL >   shut immediate;
SQL >   startup nomount;
$ RMAN    target      sys/passwd@prod
RMAN >   connect auxiliary /                              --->  connecting to target
RMAN>   show   all;                    (just to check everything)

RMAN>   run {
2>   set until time =’ sysdate  –  1’;
3>   Duplicate target database to aux_database_name nofilenamecheck;
}
...........
.......
database opened
Finished Duplicate Db at 09-DEC-11
Now my dev database is exact copy of prod database.
If you want to see the Converter parameters in pfile or spfile
SQL> show parameter convert

NAME                                         TYPE           VALUE
------------------------------------ ----------- ------------------------------
_convert_set_to_join                 boolean     FALSE
db_file_name_convert                 string      +DATA/PROD/DATAFILE/, +DATA/DEV/DATAFILE/
log_file_name_convert                string      +DATA/PROD/ONLINELOG/, +DATA/DEV/ONLINELOG/            

  See: RMAN 'Duplicate From Active Database' Feature in 11G (Doc ID 452868.1)               

RMAN provides the DUPLICATE command, which uses the backups of the database to create the clone database. Files are restored to the target database, after which an incomplete recovery is performed and the clone database is opened using RESETLOGS option. All the preceding steps are performed automatically by RMAN without any intervention from the DBA.
Considerations:

NOTE: db_file_name_convert and log_file_name_convert parameters are required only if the source database directory structure and clone database directory structure differs.
NOTE: Copy the backup pieces from the source server to destination server manually if you are cloned database is located in different server and configure the listener and tnsnames accordingly. If you had configured both environments in catalog database, the coping of backup is not necessary.
RMAN> duplicate target database to ‘RISCLON';
NOTE: The preceding command restores all files from the backup of the target database to the clone database destination using all available archive log files and also RMAN opens the clone database with resetlogs option.
RMAN Duplicate database from Active database
I am started writing this blog after a long time, in which I will discuss about one of the Oracle 11g New features in Recovery Manager (RMAN).
From Oracle 11g, we create a duplicate database using the RMAN by two methods.
·         Active database duplication (Oracle 11g New Feature)
·         Backup-based duplication
Active database duplication copies the target database over the network to the destination and then creates the duplicate database. Only difference is you don’t need to have the pre-existing RMAN backups and copies. The duplication work is performed by an auxiliary channel. This channel corresponds to a server session on the auxiliary instance on the auxiliary host.
As part of the duplicating operation, RMAN automates the following steps:
·         Creates a control file for the duplicate database.
·         Restarts the auxiliary instance and mounts the duplicate control file.
·         Creates the duplicate data files and recovers them with incremental backups and archived redo logs.
·         Opens the duplicate database with the resetlogs option.
For the active database duplication, RMAN will copy the target database data files over the network to the auxiliary instance.
The Only Disadvantage is there will be a High traffic on your network connection between source and target database.
·         Creating initialization Parameter file for the Duplicate database
If you are using spfile then only parameter required for the duplicate database is DB_NAME. Rest other parameters can be set in the duplicate command itself. If you are not using the spfile , then you need to set initialization parameters in the pfile.
Required parameters:




DB_NAME
CONTROL_FILES
DB_BLOCK_SIZE
DB_FILE_NAME_CONVERT
LOG_FILE_NAME_CONVERT
We will create a pfile with the above parameters for the duplicate database.Create an Oracle Password File for the Duplicate database.
I will make the Duplicate database  name as  “DUP”
Password file is must for the Active database duplication where as it is not required for backup-based duplication. For Active database duplication it connects directly to the auxiliary instance using the password file with the same SYSDBA password as target database. In case you are using password file make sure to have same SYSDBA password as the target database. In this case, RMAN copies the source database password file to the destination host and overwrites any existing password file for the auxiliary instance.


cd $ORACLE_HOME/dbs

orapwd password=ORCL file=orapwDUP
·         Establish Oracle Net Connectivity to the Auxiliary Instance
Auxiliary instance must be available through Oracle Net if you are duplicating from an ACTIVE database.
Add following entries into listener.ora file.
Edit the listener.ora and add following lines:







SID_LIST_LISTENER =
 (SID_LIST =
 )
 (SID_DESC =
 (SID_NAME = dup)
 (ORACLE_HOME = =/home/oracle/app/oracle/product/11.2.0/dbhome_1)
 (GLOBAL_DBNAME = dup.localdomain)
 )
 )
Add the Following entry in the tnsnames.ora
















prd =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
 (CONNECT_DATA =
 (SERVER = DEDICATED)
 (SERVICE_NAME = prd)
 )
 )

dup =
 (DESCRIPTION =
 (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
 (CONNECT_DATA =
 (SERVER = DEDICATED)
 (SERVICE_NAME = dup)
 )
 )
·         Create the directories which are required for the duplicate database.


mkdir -p /home/oracle/app/oracle/oradata/dup
mkdir -p /home/oracle/app/oracle/fast_recovery_area/dup
mkdir -p /home/oracle/app/oracle/admin/dup/pfile
·         Create the parameter file (initdup.ora).






DB_NAME=dup
diagnostic_dest='/home/oracle/app/oracle'
DB_FILE_name_CONVERT=('/home/oracle/app/oracle/oradata/prd','/home/oracle/app/oracle/oradata/dup')
LOG_FILE_NAME_CONVERT=('/home/oracle/app/oracle/oradata/prd','/home/oracle/app/oracle/oradata/dup')
Memory_TARGET=262144000
CONTROL_FILES='/home/oracle/app/oracle/oradata/dup/control01.dbf'
COMPATIBLE= 11.2.0.0.0
·         Start the Auxiliary instance from Sqlplus
Use SQL*Plus to connect to the auxiliary instance using the above created pfile and start it in NOMOUNT mode.




















[oracle@localhost admin]$ export ORACLE_SID=dup
[oracle@localhost admin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Mar 1 12:40:21 2013

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

Connected to an idle instance.

SQL> startup nomount pfile=/home/oracle/app/oracle/admin/dup/pfile/initdup.ora
ORACLE instance started.

Total System Global Area 372449280 bytes
Fixed Size 1345044 bytes
Variable Size 234883564 bytes
Database Buffers 130023424 bytes
Redo Buffers 6197248 bytes
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 -
Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
·         Test connectivity to auxiliary and target instance from the Both Sides.


sqlplus sys/ORCL@PRD as sysdba

sqlplus sys/ORCL@DUP as sysdba
·         Using RMAN, Connect to the Database Instances




























































































[oracle@localhost admin]$ rman target sys/ORCL@prd catalog rman/rman@prd

Recovery Manager: Release 11.2.0.3.0 - Production on Fri Mar 1 12:41:24 2013

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

connected to target database: PRD (DBID=1867953957)
connected to recovery catalog database

RMAN> connect auxiliary sys/ORCL@DUP
connected to auxiliary database: DUP (not mounted)
RMAN> DUPLICATE TARGET DATABASE TO 'DUP' FROM ACTIVE DATABASE
2> DB_FILE_NAME_CONVERT '/home/oracle/app/oracle/oradata/prd','/home/oracle/app/oracle/oradata/dup';

Starting Duplicate Db at 01-MAR-13
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK
contents of Memory Script:
{
 sql clone "create spfile from memory";
}
executing Memory Script

sql statement: create spfile from memory

contents of Memory Script:
{
 shutdown clone immediate;
 startup clone nomount;
}
executing Memory Script
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 372449280 bytes
Fixed Size 1345044 bytes
Variable Size 239077868 bytes
Database Buffers 125829120 bytes
Redo Buffers 6197248 bytes

contents of Memory Script:
{
 sql clone "alter system set db_name =
 ''PRD'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
 sql clone "alter system set db_unique_name =
 ''DUP'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
 shutdown clone immediate;
 startup clone force nomount
 backup as copy current controlfile auxiliary format
'/home/oracle/app/oracle/oradata/dup/control01.ctl';
 alter clone database mount;
}
executing Memory Script

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

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

Oracle instance shut down
Oracle instance started
Total System Global Area 372449280 bytes

Fixed Size 1345044 bytes
Variable Size 239077868 bytes
Database Buffers 125829120 bytes
Redo Buffers 6197248 bytes

Starting backup at 01-MAR-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=17 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file
name=/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_prd.f
tag=TAG20130301T124259 RECID=9 STAMP=808922591
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:26
Finished backup at 01-MAR-13

database mounted

contents of Memory Script:
{
set newname for datafile 1 to
"/home/oracle/app/oracle/oradata/dup/system01.dbf";
4 auxiliary format
"/home/oracle/app/oracle/oradata/dup/users01.dbf" datafile
5 auxiliary format
"/home/oracle/app/oracle/oradata/dup/example01.dbf" datafile
6 auxiliary format
"/home/oracle/app/oracle/oradata/dup/rmantbs01.dbf" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME

Starting backup at 01-MAR-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
tag=TAG20130301T124336
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 01-MAR-13

sql statement: alter system archive log current

contents of Memory Script:
{
 backup as copy reuse
 archivelog like
"/home/oracle/app/oracle/fast_recovery_area/PRD/archivelog/2013_03_01/o1_mf_1_26_8m0pf583_.arc"
auxiliary format
 "/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_26_804290346.dbf"
;
 catalog clone archivelog
"/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_26_804290346.dbf";
 switch clone datafile all;
}
executing Memory Script

Starting backup at 01-MAR-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=26 RECID=26 STAMP=808923777
output file
name=/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_26_804290346.dbf
RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:07
Finished backup at 01-MAR-13

cataloged archived log
archived log file
name=/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_26_804290346.dbf
RECID=26 STAMP=808923794

datafile 1 switched to datafile copy
input datafile copy RECID=9 STAMP=808923795 file
name=/home/oracle/app/oracle/oradata/dup/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=10 STAMP=808923795 file
name=/home/oracle/app/oracle/oradata/dup/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=11 STAMP=808923795 file
input datafile copy RECID=14 STAMP=808923795 file
name=/home/oracle/app/oracle/oradata/dup/rmantbs01.dbf

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

executing command: SET until clause

Starting recover at 01-MAR-13
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK

starting media recovery

archived log for thread 1 with sequence 26 is already on disk as file
/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_26_804290346.dbf
archived log file
name=/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_26_804290346.dbf
thread=1 sequence=26
media recovery complete, elapsed time: 00:00:02
Finished recover at 01-MAR-13
Oracle instance started

Total System Global Area 372449280 bytes

Fixed Size 1345044 bytes
Variable Size 239077868 bytes
Database Buffers 125829120 bytes
Redo Buffers 6197248 bytes

contents of Memory Script:
{
 sql clone "alter system set db_name =
 ''DUP'' 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

sql statement: alter system set db_name = ''DUP'' 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 372449280 bytes

Fixed Size 1345044 bytes
Variable Size 239077868 bytes
Database Buffers 125829120 bytes
Redo Buffers 6197248 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUP" RESETLOGS
ARCHIVELOG
 MAXLOGFILES 16
 MAXLOGMEMBERS 3
 MAXDATAFILES 100
 MAXINSTANCES 8
 MAXLOGHISTORY 292
 LOGFILE
 GROUP 1 ( '/home/oracle/app/oracle/oradata/dup/redo01.log' ) SIZE 50 M
REUSE,
 GROUP 2 ( '/home/oracle/app/oracle/oradata/dup/redo02.log' ) SIZE 50 M
REUSE,
 GROUP 3 ( '/home/oracle/app/oracle/oradata/dup/redo03.log' ) SIZE 50 M
REUSE
 DATAFILE
 '/home/oracle/app/oracle/oradata/dup/system01.dbf'
 CHARACTER SET AL32UTF8
contents of Memory Script:
{
 set newname for tempfile 1 to
 "/home/oracle/app/oracle/oradata/dup/temp01.dbf";
 switch clone tempfile all;
 catalog clone datafilecopy
"/home/oracle/app/oracle/oradata/dup/sysaux01.dbf",
 "/home/oracle/app/oracle/oradata/dup/undotbs01.dbf",
 "/home/oracle/app/oracle/oradata/dup/users01.dbf",
 "/home/oracle/app/oracle/oradata/dup/example01.dbf",
 "/home/oracle/app/oracle/oradata/dup/rmantbs01.dbf";
 switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /home/oracle/app/oracle/oradata/dup/temp01.dbf in
control file

cataloged datafile copy
datafile copy file name=/home/oracle/app/oracle/oradata/dup/sysaux01.dbf
RECID=1 STAMP=808923861
cataloged datafile copy
datafile copy file name=/home/oracle/app/oracle/oradata/dup/undotbs01.dbf
RECID=2 STAMP=808923861
cataloged datafile copy
 Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 01-MAR-13
Duplicate database is successfully created.


No comments:

Post a Comment