oracle hot cloning 10g
Source Database Name: k
Clone Database Name: kCLON
Source Database physical files path=/u01/k/oradata
Cloned Database physical files path=/u02/kCLON/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 ‘k’ database is using spfile create pfile,
SQL> create pfile=’/u02/kCLON/initkCLON.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 ‘k’ database to a clone location.
$ mkdir /u02/kCLON/oradata
$ cp /u01/k/source/oradata/*.dbf /u02/kCLON/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/kCLON
$ mkdir bdump udump
11. Edit the clone database parameter file and make necessary changes to the clone database
$ cd /u02/kCLON
$ vi initkCLON.ora
db_name=kCLON
control_files=/u02/kCLON/oradata/cntrl01.ctl
background_dump_dest=/u02/kCLON/bdump
user_dump_dest=/u02/kCLON/udump
. . .
. . .
:wq!
12. Startup the cloned database in NOMOUNT phase.
$ export ORACLE_SID=kCLON
SQL> startup nomount pfile=’/u02/kCLON/initkCLON.ora’
13. Create the control file for the clone database using the trace control file.
CREATE CONTROLFILE SET DATABASE “kCLON” RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ‘/u02/kCLON/oradata/redo01.log’ SIZE 5M,
GROUP 2 ‘/u02/kCLON/oradata/redo02.log’ SIZE 5M,
DATAFILE
‘/u02/kCLON/oradata/system01.dbf’,
‘/u02/kCLON/oradata/undotbs01.dbf’,
‘/u02/kCLON/oradata/sysaux01.dbf’,
‘/u02/kCLON/oradata/users01.dbf’,
‘/u02/kCLON/oradata/example01.dbf’
CHARACTER SET AL32UTF8;
14. Create the control file by running trace file from the trace path
SQL> @u01/k/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;
Clone Database Name: kCLON
Source Database physical files path=/u01/k/oradata
Cloned Database physical files path=/u02/kCLON/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 ‘k’ database is using spfile create pfile,
SQL> create pfile=’/u02/kCLON/initkCLON.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 ‘k’ database to a clone location.
$ mkdir /u02/kCLON/oradata
$ cp /u01/k/source/oradata/*.dbf /u02/kCLON/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/kCLON
$ mkdir bdump udump
11. Edit the clone database parameter file and make necessary changes to the clone database
$ cd /u02/kCLON
$ vi initkCLON.ora
db_name=kCLON
control_files=/u02/kCLON/oradata/cntrl01.ctl
background_dump_dest=/u02/kCLON/bdump
user_dump_dest=/u02/kCLON/udump
. . .
. . .
:wq!
12. Startup the cloned database in NOMOUNT phase.
$ export ORACLE_SID=kCLON
SQL> startup nomount pfile=’/u02/kCLON/initkCLON.ora’
13. Create the control file for the clone database using the trace control file.
CREATE CONTROLFILE SET DATABASE “kCLON” RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ‘/u02/kCLON/oradata/redo01.log’ SIZE 5M,
GROUP 2 ‘/u02/kCLON/oradata/redo02.log’ SIZE 5M,
DATAFILE
‘/u02/kCLON/oradata/system01.dbf’,
‘/u02/kCLON/oradata/undotbs01.dbf’,
‘/u02/kCLON/oradata/sysaux01.dbf’,
‘/u02/kCLON/oradata/users01.dbf’,
‘/u02/kCLON/oradata/example01.dbf’
CHARACTER SET AL32UTF8;
14. Create the control file by running trace file from the trace path
SQL> @u01/k/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;
Comments
Post a Comment