4 January 2012

rman cloning steps

rman cloning steps


Primary database: prod
Duplicate database: clone
Localhost: sunmk4

We are going to create the clone database with in same server.

Step 1:

Create the clone database password file
The prod and clone password must be same
orapwd file=/opt/oracle/product/9.2.0.1.0/dbs/orapwclone password=syspassword entries=10
C:\db_1\database> orapwd FILE=PWDclone.ora PASSWORD=syspassword ENTRIES=10 (in windows platform)

Step 2:

Add the tns entry:
CLONE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST =  sunmk4)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = clone)
    )
  )

Check the listener and service name

>lsnrctl status
>export ORACLE_SID=clone (in unix )
> $ORACLE_HOME\bin\oradim -NEW -SID clone (in windows)
>set oracle_sid=clone
>tnsping clone

Step 3:

Create a default location of bdump ,cdump,udump,adump for clone db
mkdir -p /opt/oracle/admin/clone
cd opt/oracle/admin/clone
mkdir -p adump bdump cdump udump
mkdir –p  /opt/oracle/oradata/clone
in windows
cd c:\oracle\admin\
create a clone dir
cd clone
create adump,bdump,cdump,udump dir
cd c:\oracle\oradata\
mkdir clone

Step 4:

export ORACLE_SID=prod

set oracle_sid=prod(in windows)

rman target /
run{
backup database plus archivelog;
}
After the rman backup.we are going to clone the database in same server so no need to move the rman backup. 

Step 5:

Create pfile for clone db.
>create pfile=’/opt/init_clone.ora’ from spfile;
>create pfile=’c:\init_clone.ora’ from spfile;(in windows)

Edit the clone pfile

clone.__db_cache_size=180355072
clone.__java_pool_size=4194304
clone.__large_pool_size=4194304
clone.__shared_pool_size=92274688
clone.__streams_pool_size=0
*.audit_file_dest='/opt/oracle/admin/clone/adump'
*.background_dump_dest='/opt/oracle/admin/clone/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/opt/oracle/oradata/clone/control01.ctl','/opt/oracle/oradata/clone/control02.ctl','/opt/oracle/oradata/clone/control03.ctl'
*.core_dump_dest='/opt/oracle/admin/clone/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='clone'
*.job_queue_processes=10
*.log_archive_start=TRUE
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=285212672
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/opt/oracle/admin/clone/udump'
db_file_name_convert=(/opt/oracle/oradata/prod/,/opt/oracle/oradata/clone)
log_file_name_convert=(/opt/oracle/oradata/prod/,/opt/oracle/oradata/clone)

save the pfile.

Step 6:

Export ORACLE_SID=clone

set oracle_sid=clone(in windows)
>Sqlplus “/as sysdba”
>Create spfile from pfile=’/opt/ init_clone.ora’;
>Startup nomount;
>Rman target sys@prod  nocatalog auxiliary sys

enter the sys password of the prod db
enter the sys password of the clone db
Pls ensure the prod db is open stage and clone db is nomount stage

Rman>run{
DUPLICATE TARGET DATABASE TO 'CLONE';
}






No comments:

Post a Comment