In sweet memories of my ever loving brother "kutty thambi " ARUN KUMAR

Friday, August 13, 2010

Duplicate/Clone/Convert ASM file system to NON-ASM Using RMAN

CLONING THE DATABASE FROM ASM FILE SYSTEM TO NON-ASM FILE SYSTEM:
Its similar like normal cloning, Here the ASM Filesystem database is DEMODB, I am going to clone the database and also convert the file system to Non-ASM Filesystem database(DUPDB).

SOURCE MACHINE NAME: RAC2 DATABASE NAME: DEMODB
TARGET MACHINE NAME: RAC1

1. Take RMAN Backup of ASM file sytem Database.

RMAN> configure channel device type disk format '/u01/app/oracle/backup/%U';

RMAN> backup full database format '/u01/app/oracle/backup/%d_%U.bkp' plus archivelog format '/u01/app/oracle/backup/%d_%U.bckp';

RMAN> BACKUP ARCHIVELOG ALL;

2. Configure listener.ora and tnsnames.ora file on both target and the source machines.

Target system RAC1 listener.ora file

SID_LIST_LISTENER_RAC1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = dupdb)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = dupdb)
)

)


Tnsnames.ora file on both machines RAC1, RAC2

DEMODB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = demodb)
)
)
DUPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dupdb)
)
)

3. Copy the init,ora and password file from source database to $ORACLE_HOME/dbs on target machine
and change the init.ora parameters essential to clone.

sample init.ora file of clone database dupdb

dupdb.__db_cache_size=310378496
dupdb.__java_pool_size=4194304
dupdb.__large_pool_size=4194304
dupdb.__shared_pool_size=121634816
dupdb.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/dupdb/adump'
*.background_dump_dest='/u01/app/oracle/admin/dupdb/bdump'
*.compatible='10.2.0.1.0'
*.core_dump_dest='/u01/app/oracle/admin/dupdb/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='dupdb'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=dupdbXDB)'
*.job_queue_processes=10
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=147849216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=444596224
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/dupdb/udump'

db_file_name_convert='+DATA/DEMODB/DATAFILE/','/u01/app/oracle/oradata/dupdb/'
log_file_name_convert='+DATA/DEMODB/ONLINELOG/','/u01/app/oracle/oradata/dupdb/'


note: add the controlfile location later when the rman duplicate scripts run, issue show parameter control_files in target DUPDB database.
it show the location add the location to the init parameter later.
control_files='/u01/app/oracle/flash_recovery_area/DUPDB/controlfile/o1_mf_66bjo21r_.ctl'

4. create the required directories for the bdump, cdump, adump and udump locations and also directories for database files.

5. Copy the backup files from the source to the target machine. Ensure they are located in same directory name as source machine.

6. STARTUP NOMOUNT the target database

[oracle@rac1 dupdb]$ . oraenv
ORACLE_SID = [dupdb] ?
[oracle@rac1 dupdb]$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Aug 13 18:28:22 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.


7. RMAN command on the target machine:

[oracle@rac1 dupdb]$ rman target=sys/oracle@demodb auxiliary=/
RMAN> duplicate target database to dupdb nofilenamecheck;

8. Check the location of the datafiles and online redo log files

SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 0
Next log sequence to archive 1
Current log sequence 1
SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/dupdb/system.296.726853295
/u01/app/oracle/oradata/dupdb/undotbs1.298.726853331
/u01/app/oracle/oradata/dupdb/sysaux.297.726853315
/u01/app/oracle/oradata/dupdb/users.299.726853339

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/dupdb/group_3.306.726853707
/u01/app/oracle/oradata/dupdb/group_3.307.726853719
/u01/app/oracle/oradata/dupdb/group_2.304.726853687
/u01/app/oracle/oradata/dupdb/group_2.305.726853695
/u01/app/oracle/oradata/dupdb/group_1.302.726853671
/u01/app/oracle/oradata/dupdb/group_1.303.726853681

6 rows selected.

SQL> show parameter control_files

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string /u01/app/oracle/flash_recovery
_area/DUPDB/controlfile/o1_mf_
66bjo21r_.ctl
SQL>



hope, this will helps you.

2 comments:

Kim said...

A really useful information. thanks for sharing it.. :)

Disaster recovery replication

ereru said...

How can You copy the backup to the same location (#4) on the duplicate host, while production is ASM and the other is file system????

 
Share/Bookmark