Pavan DBA's Blog

The DBA Knowledge Store

Archive for the ‘cloning’ Category

Database cloning using hot backup (if directory structure is different)

Posted by Pavan DBA on March 26, 2010


Below steps helps you in performing database cloning using hot backup
Assumptions:
1. directory structure is different in both source and target servers
2. Oracle version : 10.2.0.4
3. OS version : Linux 5
4. target database name is same as source database name

step 1 :  Take the hot backup of source database
sql> alter database begin backup;
$ copy datafiles to backup location
sql> alter database end backup;

step 2 : Take controlfile trace and pfile or spfile (that was using by the source database)

step 3 : Install Oracle software on another machine (choose “Install only” option in OUI). Don’t create any database

step 4 : Copy all the files (including trace file and pfile or spfile) from source server to target server either using FTP or rcp
Note: Not necessary in copying control files and redologfiles

step 5 : Place pfile or spfile in “dbs” directory on target

step 6 : Copy the remaining files to their respective locations (If any directories are missing, do create them)

step 7 : Connect as sysdba and Startup the database in nomount stage

step 8 : Edit the trace file (that was copied) and generate a create controlfile script from it. Modify the script and specify the new locations of  the files.

step 9 : Execute the controlfile script which will create controlfiles in the location specified in CONTROL_FILES parameter. Once control files are created, database will be forwarded to MOUNT state.
sql> @create_controlfile.sql

step 10 : Finally, Open the database with resetlogs option
sql> alter database open resetlogs;

Posted in cloning | Tagged: , , | 5 Comments »

Database cloning with hot backup (if directory structure is same)

Posted by Pavan DBA on March 26, 2010


Here are the steps for performing database cloning using hot backup to a different server. I am assuming you are using same directory structure in the target server also.
Assumed Oracle version : 10.2.0.4, OS version : Linux 5

Step 1 : Take database hot backup as follows
sql> alter system switch logfile;
sql> alter database begin backup;
$ cp *.dbf to backup location (as it is hot backup, we will not take backup of redolog files)
sql> alter database end backup;
sql> alter system switch logfile;
$ cp *.ctl to backup location
Note: If you are using 9i database, use “tablespace begin backup/end backup” clauses

step 2 : Take backup of spfile or pfile of source database and also archives

step 3 : Install oracle software in target server (select “software only” option in OUI)

step 4 : copy the files to target server either using FTP or any methods

step 5 : place pfile or spfile in dbs directory

step 6 : copy all files (datafiles, controlfiles and archives) to respective locations

step 7 : do the following
sql> startup nomount
sql> alter database mount;
sql> recover database using backup controlfile until cancel;
here it will ask to apply archives and will give suggestion as file name and path. apply required archives

step 8 : finally, open your database with resetlogs option
sql> alter database open resetlogs;

Sometimes you may get following error while doing hot backup cloning

ORA-01194 file 1 needs more recovery to be consistent error

in such cases, do a switch logfile in source server and copy & apply that archive logfile in target server

Posted in cloning | Tagged: , , | Leave a Comment »

Database cloning with cold backup when using diff directory structure

Posted by Pavan DBA on December 17, 2009


Hi Folks, Long back i posted steps for database cloning using cold backup. In that post, we assumed that directory structure is same on both the server (ofcourse OS version also :-))

Now, the below steps will let you understand how we can perform database cloning using cold backup, when you are not following the same directory structure in the target machine (Remember, here also OS is same)

1. Take the cold backup of source database

2. Take controlfile trace and pfile or spfile (that was using by the source database)

3. Install Oracle software on another machine (choose “Install only” option in OUI). Don’t create any database

4. Copy all the files (including trace file and pfile or spfile) from source server to target server either using FTP or rcp
Note: Not necessary in copying control files

5. Place pfile or spfile in “dbs” directory on target

6. Copy the remaining files to their respective locations (If any directories are missing, do create them)

7. Open bash_profile file and set ORACLE_HOME and ORACLE_SID

8. Connect as sysdba and Startup the database in nomount stage

9. Edit the trace file (that was copied) and generate a create controlfile script from it. Modify the script and specify the new locations of  the files.

10. Execute the controlfile script which will create controlfiles in the location specified in CONTROL_FILES parameter. Once control files are created, database will be forwarded to MOUNT state.

11. Finally, Open the database.

Posted in cloning | Leave a Comment »

Database cloning using cold backup

Posted by Pavan DBA on November 13, 2009


The following are the steps for performing database cloning using cold backup

Assumptions : You are using Linux flavour OS and following same directory structure

1. Take the cold backup of source database

2. Take controlfile trace and pfile or spfile (that was using by the source database)

3. Install Oracle software on another machine (choose “Install only” option in OUI). Don’t create any database

4. Copy all the files (including trace file and pfile or spfile) from source server to target server either using FTP or rcp

5. Place pfile or spfile in “dbs” directory on target

6. Copy the remaining files to their respective locations (If any directories are missing, do create them)

7. Open bash_profile file and set ORACLE_HOME and ORACLE_SID

8. Connect as sysdba and Startup the database

Posted in cloning | Tagged: , , , | 2 Comments »

 
%d bloggers like this: