1748177 Members
4189 Online
108758 Solutions
New Discussion юеВ

Re: Cloning a database

 
SOLVED
Go to solution
Brendan McDonald
Frequent Advisor

Cloning a database

Hi, i'm using RMAN to backup my production database and would now liek to clone this database to my DEV environment.

Now, I unerstand that RMAN can do this by connecting to the DEV database but I have firewalls in the way and a total seperation of Prod and DEV environments (it's just the way we do things round here).

I've tried renaming (after copying to tape and back off tape) the RMAN backups to their original data file names and running a create database and recreating the control files and then recover database from archive files but however far I go with this method (approx 12 hours after the backup was taken) i get datafiel 1 (system) still needs recovery.

Has anyone ever doen anything like this before ?? Is there a way of registering my PROD RMAN backups with my DEV RMAN so I can import the backups and then do a complete recovery ???

Any help on this would be much appreciated.

Thanks
16 REPLIES 16
Steven E. Protter
Exalted Contributor

Re: Cloning a database

Shalom,

Best method to clone.

Get a cold backup and copy it to the new server and follow Oracle cloning procedures.

You will have to get rman to make this database a physical file that you can move, copy it and use RMAN to import it on the second system. This is much harder than the ideal methodology.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Yogeeraj_1
Honored Contributor

Re: Cloning a database

hi,

there must be a problem with the restore of your control files. Can you verify that it has been restored correctly prior to the recovery?

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Nanjappa
New Member

Re: Cloning a database

Hi,
10 steps for cloning a database.

The following steps must be on Source -Production instance/Server
Step 1. Shutdown database in normal mode and start it up in restricted mode.
Step 2. Take the backup of control file
Step 3. Shutdown database again in normal mode.
Step 4. Copy /FTP init parameter file ,control file script and all the database file on the destination server/location, once all the files are successfully copied, you may startup the database normally.

The following step must be on destination ├в Clone instance/server
Step 5. Edit init parameter file and control file script.
Step 6. New Environment setup .
Step 7. Connect with svrmgrl and recreate control file
Step 8. Open the database in resetlogs.
Step 9. Shutdown the database in normal mode
Step 10. Take the cold backup and start the database in archive/non archive mode.

If your database is 10g then you have an hyper link in Enterprise Manager for clonning database.
Eric Antunes
Honored Contributor

Re: Cloning a database

Hi Brendan,

Avoid all this cloning work and just use the same SID on both servers (environments).

That's how I have things here and all I just need to do to refresh the DEV environment is to copy the PROD files to the DEV server.

Best Regards,

Eric Antunes
Each and every day is a good day to learn.
Yogeeraj_1
Honored Contributor

Re: Cloning a database

hi again,

concerning cloning, i would also choose Eric's method of managing the production and test environment.

if need be, the global name can also be changed using:
alter database rename global_name to dev.domain.mu;

you should keep things simple.

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Brendan McDonald
Frequent Advisor

Re: Cloning a database

Hi guys, thanks for your input.

My problem is my PROD server is a 24 / 7 server and can never be shut down (unscheduled at least), that's why i'm doing online backups using RMAN. My environments are exactly the same Prod & DEV (same oracle_home, sid & even file structures).

As i said, i've tried renaming (after copying to tape and back off tape) the RMAN backups to their original data file names and running a create database and recreating the control files and then recover database from archive files but however far I go with this method (approx 12 hours after the backup was taken) I get datafile 1 (system01.dbf) still needs recovery. As you know you can't copy your RMAN files onto the DEV server and start up the database without some sort of recovery being needed.

I found mention of being able to register other backups with RMAN (so it puts a record into the control file) and then once registered you can then do your database recovery the standard way. But I can't find a detailed way of doing this.

Maybe i'm barking up the wrong tree but I need to be able to clone from PROD to DEV. I thought this would be a relatively simple matter with RMAN.

All help with this conundrum would be much appreciated.
spex
Honored Contributor

Re: Cloning a database

Hi,

The last logfile you need to apply for recovery will be an online redo logfile.

After you back up the datafiles and archivelogs, force a logfile switch. Then make sure to also back up this last logfile (it will be smaller in size than the others, ending with sequence # N-1).

PCS
Yogeeraj_1
Honored Contributor
Solution

Re: Cloning a database

hi,

your FULL RMAN recovery steps should be as follows:

1. Database startup (nomount)
sqlplus "/ as sysdba" <startup nomount;
exit;
EOF

2. RMAN recover the control files

#!/usr/bin/ksh
rman target system/manager rcvcat rman/rman@catalogdb <run{
allocate channel c1 type disk;
restore controlfile;
}
exit;
EOF

3. Mount the database
sqlplus "/ as sysdba" <alter database mount;
exit;
EOF

4. RMAN full database recover

#!/usr/bin/ksh
rman target system/manager rcvcat rman/rman@catalogdb log=rman_reco_full.log
<run {
allocate channel c1 type disk;
allocate channel c2 type disk;
set newname for datafile 1 to '/d01/oracle/oradata/mydb/system01.dbf';
...
restore database;
switch datafile all;
}
exit;
EOF

5. Recover your archived logs

rman target system/manager rcvcat rman/rman@catalogdb log=rman_reco_al.log <run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
set archivelog destination to "/d01/app/oracle/admin/mydb/arch/";
restore archivelog from logseq= until logseq=;
}
exit;
EOF

6. Recover the database itself!
sqlplus "/ as sysdba" <recover automatic database using backup controlfile;
exit;
EOF

7. Open the database for use
sqlplus "/ as sysdba" <alter database open resetlogs;
exit;
EOF


do this helps?

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
gthai
Occasional Advisor

Re: Cloning a database

Follow spex advice.
You're too far along the way to go back and take another backup. BTW, if you're using RCAT do pay attention to DBID. You'll find that it is the same as your production so be careful not restore/recover the wrong database.

(set NLS_DATE_FORMAT if recover unitl time)
SQL>recover database using backup controlfile until cancel;
apply all the archivelogs up to the last online redolog.
type cancel
SQL>alter databse open resetlogs;