Anda di halaman 1dari 3

RMAN cloning: DATABASE CLOANING WITH RMAN STEP BY STEP:Suppose we are working in following two machines 1. 99.99.23.

15- db30 (source database) 2. 99.99.23.14- dup30 (clone also called target database) and orcl (for RMAN bac kup also called catalog database) In first phase we start the listener $>lsnrctl start In second phase create connection strings 1. One string for orcl 2. One string for db30 3. One string for dup30 and also define a listener where global name dup30.serve r.com Sid dup30 99.99.23.14> netmgr (create connation strings for all database) 99.99.23.14>lsnrctl stop 99.99.23.14>lsnrctl start Second phase is completed. In third phase we set networking management. 99.99.23.15> cat /etc/host Entry of this file will copy in 99.99.23.14 99.99.23.14> VI /etc/hosts Pest here 99.99.23.15 root> mkdir /backup (here we put default backup of db30) 99.99.23.15 root>chown R oracle: oinstall /backup/ 99.99.23.15 root>chmod R 755 /backup /backup is a default location of backup of db30. Now we will share this director y, /backup with other machines namely 99.99.23.14 99.99.23.15 root> VI /etc/exports /backup *(rw, sync) 99.99.23.15 root>service nfs restart 99.99.23.15 root>service nfslock restart 99.99.23.15 root>service netfs restart 99.99.23.15 root>showmount e atpl2315 (machine name) Now /backup directory has shared. After sharing this directory we will mount in9 9.99.23.14 machine. For this purpose we do following thing 99.99.23.14 root> mkdir /backup 99.99.23.14 root> mkdir /backup_remote 99.99.23.14 root>chown R oracle: oinstall /backup/ 99.99.23.14 root>chmod R 777 /backup 99.99.23.14 root>chown R oracle: oinstall /backup_remote/ 99.99.23.14 root>chmod R 777 /backup_remote 99.99.23.14 root>mount atpl2315:/backup /backup_remote For permanent mounting put the entry in following file 99.99.23.14 root> cat /etc/fstab 99.99.23.15>export ORACLE_SID=db30 (in xmanager) 99.99.23.15>sqlplus /as sysdba SQL>create pfile= /backup/init1.ora from spfile; SQL>alter user sys identified by oracle; SQL>alter user system identified by oracle; SQL>shutdown immediate SQL>exit 99.99.23.15>cd /backup 99.99.23.15>VI init1.ora And change in following location Db_recovery_file_dest= /backup/fast_recovery_area : wq 99.99.23.15>mkdir fast_recovery_area (inside /backup) 99.99.23.15>sqlplus /as sysdba SQL>create spfile from pfile= /backup/init1.ora ;

SQL>startup mount SQL>alter database archivelog; SQL>alter database open; SQL>alter database force logging; SQL>archive log list; SQL>show parameter db_rec; Here we are just checking the connection string 99.99.23.14>sqlplus system/oracle@db30 SQL>select * from V$instance; SQL>exit Here we will create a tablespace or increase the size of existing table space fo r RMAN backup 99.99.23.14>export ORACLE_SID=orcl (for recovery catalog) 99.99.23.14>sqlplus /as sysdba SQL>select tablespace_name|| ||file_name|| || (bytes/1024)/1024 from dba_data_files; SQL>alter database datafile /oracle/orcl/user01.dbf resize 500m; SQL>alter database datafile /oracle/orcl/user01.dbf autoextend on next 100m; SQL> alter database default tablespace users; SQL>create user RMAN30 identified by nbsingh1; SQL>grant connect, resource, recovery_catalog_owner, dba to RMAN30; Now we have completed primary step. 99.99.23.14> cd /backup_remote/ 99.99.23.14>ls l Note that /backup_remote is a mount point of /backup directory which are the loc ation of default backup of database db30. Note that in 99.99.23.14>/backup directory we keep all clone files. These files are mounted in of 99.99.23.14>/backup_remote directory. Means after editing we t ransfer all files of 99.99.23.14>/backup_remote directory in 99.99.23.14>/backup directory. We have already created init1.ora file 99.99.23.15>/backup. It must be mounted i n 99.99.23.14>/backup_remote directory. 99.99.23.14> cp init1.ora /backup 99.99.23.14> cd /backup 99.99.23.14>VI init1.ora (we will modify this file for dup 30) (Remove all parameter before audit_file_dest and start with db30. Everything sho uld be inside /backup directory) Audit_file_dest= /backup/adump Control_file= /backup/dup30/control.ctl Db_name= dup30 Db_recovery_area= /backup/fast_recovery_area Diagnostic_dest= /backup/dup30' Db_file_name_convert= oracle/app/oracle/oradata/db30 , /backup/dup30 log_file_name_convert= oracle/app/oracle/oradata/db30 , /backup/dup30 To find the source path login in 99.99.23.15 machine. Export db30 and run follow ing query SQL>select tablespace_name|| ||file_name|| || (bytes/1024)/1024 from dba_data_files; 99.99.23.14>pwd /backup 99.99.23.14>mkdir adump fast_recovery_area diag 99.99.23.14>mkdir dup30 (Now we will export dup30) 99.99.23.14>export ORACLE_SID=dup30 99.99.23.14>orapwd file=$ORACLE_HOME/dbs/orapwdup30 Password=oracle 99.99.23.14>sqlplus sys/oracle@dup30 as sysdba SQL>create spfile from pfile= /backup/init1.ora SQL>startup force nomount SQL> Now second window for 99.99.23.14 and export database orcl means catalog databas e 99.99.23.14>rman target sys/oracle@db30 catalog RMAN30/nbsingh1@orcl auxiliary s

ys/oracle@dup30 RMAN>create catalog; RMAN>register database; RMAN>run { ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT /backup/dec30_%s.%t.%p; (This is a original path means backup will go 99.99.23.15>/backup) BACKUP DATABASE PLUS ARCHIVELOG; BACKUP CURRENT CONTROL FILE FORMAT /backup/dec_%s.%t.%p; } This backup will go to the 99.99.23.15 /backup directory and this is also availa ble in 99.99.23.14 /backup_remote directory because mounting is going on. Now if you see 99.99.23.15> cd /backup 99.99.23.15>ls l OR ll It will show the backup 99.99.23.14> cd /backup_remote 99.99.23.14>ls l 99.99.23.14>cp r * /backup This means that we have copy all files of 99.99.23.14/backup_remote directory to 99.99.23.14/backup directory. After completing the copy we go 99.99.23.14 machi ne where catalog database is open and RMAN already running. RMAN>run { Allocate channel t1 type disk; Allocate auxiliary channel t2 type disk; Duplicate target database to dup30 NOFILENAMECHECK; }

Anda mungkin juga menyukai