0

I am a application developer doing DBA work. I have to restore an oracle database on our test server. The databases are backed up using RMAN and the last db restore that was done on this server was in the year 2011. RMAN back up is running daily. Anyways I want to restore the test database to match the production production database. Can I copy the required datafiles and control file from the production server and place it on the test server at the exact location where the back up files are placed, or how to go about this. I want to perform a point in time recovery. I don't want to corrupt the production database. Since the production servers are backing up the database daily, I thought I would copy day before yesterday's copy and put it on the test server and give the path name to RMAN while doing point in time recovery..Please suggest me what to do..And this is the code I would use to recover, please let me know if it is ok. Thanks

SET NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS" 
SET ORACLE_SID=
rman target / nocatalog 
shutdown immediate; 
startup mount; 
 run 
 { 
  SET UNTIL TIME "TO_DATE('set to whatever time you want to recover','DD-MON-YYYY  HH24:MI:SS')"; 
  restore database; 
  recover database; 
  alter database open resetlogs;
 }
2

You don't want your test database to retain the same internal id number as the production database. Hence it would be best to use RMAN's command DUPLICATE, because it sets a different id (and also a new database name). This command is specifically designed to do what you require.

0

To restore and recover the database when the current control file is available:

  1. After connecting to the target database and, optionally, the recovery catalog database, make sure the database is mounted.

    STARTUP MOUNT
    
  2. Do the following: If automatic channels are not configured, then manually allocate one or more channels.

    Run SHOW ALL to see the current configuration.

    Restore the database using the RESTORE command, and recover it using the RECOVER command.

    This example performs recovery using automatic channels and skips the read-only history tablespace:

    RESTORE DATABASE;
    
    RECOVER DATABASE
    
    # optionally, delete logs restored for recovery and limit disk space used
    DELETE ARCHIVELOG MAXSIZE 1M 
    SKIP TABLESPACE history;  # optionally, skip the recovery of some tablespaces
    
  3. Examine the output to see if recovery was successful. If so, open the database:

    ALTER DATABASE OPEN;
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.