manual process of copy an Oracle database.

Here is a simple manual process of copy an Oracle database.

Ref: http://proora.com/oracle/copy_database

1. Copy $ORACLE_HOME/dbs/initSOURCE.ora to $ORACLE_HOME/dbs/initTARGET.ora
change in initTARGET.ora:
  db_name,
  control_files,
  user_dump_dest,
  background_dump_dest,
  core_dump_dest
and may be audit_file_dest,log_archive_dest
  Create the bdump, udump and cdump directories

2. Create the script that will re-create the controlfile
ALTER DATABASE BACKUP CONTROLFILE TO TRACE AS '/somedir/cre_controlfile.sql';

Remove everything up to the "START NOMOUNT" statement and
everything after the semicolon at the end of the "CREATE CONTROLFILE" statement.
Edit the line starting with "CREATE CONTROLFILE" and replace the word "REUSE" with the word "SET" right before the keyword DATABASE.
On the same line, modify the database name changing it from SOURCE to TARGET.
On the same line, change the keyword NORESETLOGS to RESETLOGS.
Change datafile where necessary.
remove blank lines and comments

STARTUP NOMOUNT PFILE='/dev_orahome/oracle/10.2.0/dbs/initTARGET.ora'
or
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE "TARGET" RESETLOGS  NOARCHIVELOG
    MAXLOGFILES 64
    MAXLOGMEMBERS 4
    MAXDATAFILES 512
    MAXINSTANCES 4
    MAXLOGHISTORY 10452
LOGFILE
  GROUP 1 (
    '/target/redolog01a.dbf',
    '/target/redolog01b.dbf'
  ) SIZE 512M,
  GROUP 2 (
    '/target/redolog02a.dbf',
    '/target/redolog02b.dbf'
  ) SIZE 512M,
DATAFILE
  '/target/system01.dbf',
  '/target/undotbs01.dbf',
  '/target/users01.dbf',
  '/target/sysaux01.dbf'
;

3. Copy or FTP source database
Shutdown SOURCE
Copy data files and redo log files ( v$datafile, v$logfile )
Do not copy v$controlfile -- it will be created in next step
Do not copy v$tempfile -- it will be created in step 6
SOURCE could startup

4.Create the new controlfile for TARGET using cre_controlfile.sql
sqlplus /nolog
connect / as sysdba
STARTUP NOMOUNT
@/somedir/cre_controlfile.sql
Control file created.

5.Open the TARGET database
--alter database recover database until ccanccel using backup controlfile;
--alter database recover cancel;
alter database open resetlogs;

6. Check the source and create temp files
select substr(name,1,40),BYTES from v$tempfile;
SUBSTR(NAME,1,40)                             BYTES
----------------------------------------  -----------
/source/temp01.dbf                       2147483648


ALTER TABLESPACE temp ADD TEMPFILE '/target/temp01.dbf' size 2G;

Comments

Popular posts from this blog

QUERY DATAGUARD AND STANDBY STATUS

Blocking session on RAC database

Finding object size in Oracle database