Restore/Create Database from file copy method -- Method 2


Assumption
source database exist and target database is not exist , and all the folders have been created in the target server.

source db = sourcedb
target db = targetdb


1.execute the "alter database backup controlfile to trace" in source database and save as .SQL file.
  this will generate a script containing a create controlfile command and store it in the trace  directory identified in the user_dump_dest parameter of the init.ora file.

given below is the sample script, and you can change the data file and log file paths.

2. Cold backup of sourcedb( shutdown db and take a OS copy of .dbf files only)
3. Copy .DBF files from sourcedb to targetdb (only all .dbf files to targetdb datafile folder)
4.In terminal export ORACLE_SID=targetdb in order to Recreate control files in targetdb by running the SQL script attached.

    > run the script generated in step 1



step 1 output script

STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE  "targetdb "  RESETLOGS  NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    'E:\oracle\oradata\targetdb \redo011.log',
    'E:\oracle\oradata\targetdb \redo012.log'
  ) SIZE 50M,
  GROUP 2 (
    'E:\oracle\oradata\targetdb \redo021.log',
    'E:\oracle\oradata\targetdb \redo022.log'
  ) SIZE 50M,
  GROUP 3 (
    'E:\oracle\oradata\targetdb \redo031.log',
    'E:\oracle\oradata\targetdb \redo032.log'
  ) SIZE 50M
DATAFILE
  'E:\oracle\oradata\targetdb \system01.dbf',
  'E:\oracle\oradata\targetdb \undotbs01.dbf',
  'E:\oracle\oradata\targetdb \sysaux01.dbf',
  'E:\oracle\oradata\targetdb \STREAMS_TBS01.dbf',
  'E:\oracle\oradata\targetdb \users01.dbf'
CHARACTER SET AL32UTF8
;
ALTER DATABASE OPEN RESETLOGS;
ALTER TABLESPACE TEMP ADD TEMPFILE 'E:\oracle\oradata\targetdb \temp01.dbf'
     SIZE 209715200  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M; 

No comments:

Post a Comment