Skip to Main Content
  • Questions
  • restore + rename database in one step

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Markus.

Asked: January 27, 2016 - 3:50 pm UTC

Last updated: January 29, 2016 - 1:54 am UTC

Version: 11.2.0.2

Viewed 1000+ times

You Asked

Hi,

We want to
1. restore the database _without_ RMAN (classical shutdown + copy all files) to a new destination
2. rename the database + datafile locations by recreating the controlfile

Source Binary Set: 11.2.0.2
Target Binary Set: 11.2.0.3

Is this possible in ONE step (shutdown - copy files - recreate controlfile - startup open resetlogs)?

We tried this but always get "ORA-01113: file x needs media recovery" or "ORA-16433: The database must be opened in read/write mode".

Thanks,
Markus



and Connor said...

restore + rename - sounds like duplicate from backup to me ?

Good examples in the doc about duplicating the database from a backup

http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmdupdb.htm#BRADV435

Hope this helps

Rating

  (5 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Cannot use RMAN

Markus, January 28, 2016 - 7:49 am UTC

Hi,

We can't use RMAN (it's a SAP database backuped with SAP tools). We have to do it the "old" way.

Question was if this should work: shutdown - copy files - recreate controlfile - startup open resetlogs on different patchset levels

Cheers,
Markus

don't create controlfile

Laurent Schneider, January 28, 2016 - 7:58 am UTC

This is one of the most dangerous things to do.

I would restore the controlfile, rename the log/data/temp-files (alter database rename file1,file2 to newfile1,newfile2) drop the tempfiles, use NID to change the database.

and run catupgrd

Laurent Schneider, January 28, 2016 - 8:01 am UTC

you mount the 11.2.0.2 controfile with 11.2.0.2 binary, the rename, then startup migrate with 11.2.0.3 and run catupgrd

new destination

Markus, January 28, 2016 - 9:25 am UTC

Hi Laurant,

Wie did the restore to a new host. We don't have the 11.2.0.2 binaries there. We also have another file path.

That's why we can't use the current controlfile. Any other idea?

Cheers, Markus

binary

Laurent Schneider, January 28, 2016 - 11:57 am UTC

maybe you don't need them.

If you clone from P01 to Q01 you could do

1) restore with sap tool
2) set db_name=P01 , db_unique_name=Q01 in initQ01.ora
3) startup migrate with the 11.2.0.3 binaries
startup migrate

ignore ORA-01157
4) rename file
either
alter database rename file '/oracle/P01/sapdata1/system_1/system.data1' to '/oracle/Q01/sapdata1/system_1/system.data1'

or dynamically with
select 'alter database rename file '''||name||''' to '''||replace(name,'P01','Q01')||''';' from v$datafile

select 'alter database rename file '''||name||''' to '''||replace(name,'P01','Q01')||''';' from v$tempfile

select 'alter database rename file '''||member||''' to '''||replace(member,'P01','Q01')||''';' from v$logfile


5) do this until no more error ORA-1157 (you may need to check the location...)
shutdown immediate
startup migrate

6) run catupgrd
@?/rdbms/admin/catupgr

7) run NID to change the database name back to Q01
nid dbname=Q01 target=sys/manager

8) change the database to Q01 in pfile

This is a bit of a prototype, I hope it works

Connor McDonald
January 29, 2016 - 1:54 am UTC


Thanks for your input Laurent!

Markus - Unsaid but I'm guessing implied is that we probably want keep 'compatible' set to 11.2.0.2 until you're done upgrading. Also be prepared for the fact (depending on what options are installed), the 'catupgrd' may take a while to run.


More to Explore

Backup/Recovery

Check out the complete guide to all of the Backup & Recovery techniques in the Oracle Database.