It is considered a skill every DBA should have, cloning a database with RMAN. But still meeting DBA’s which never used this… Decided to write down some basic RMAN-stuff , just as a notepad, and maybe it’s helpfull for others..
My own basic checklist through an example:
Cloning of the DEVDB on the node LARRIE to node ELLISON, new database name DEVDBNEW. The versions of the Oracle database on LARRY and ELLISON should be equal by the way!
On ELLISON:
– In order to get the backup on the same place where it stood on LARRIE ( RMAN gets this from the controlfile): create the same directory. E.g. create directory /backup/LARRIE/DEVDB/rman (on ELLISON!)
As root on ELLISON:
>> mkdir -p /backup/LARRIE/DEVDB/rman
>> chown -R oracle:oinstall /backup
– put the new database name and home in /etc/oratab :
>> DEVDBNEW:/software/oracle/product/10.2:N
As oracle on ELLISON:
– run oraenv, for getting your right environment:
>> . oraenv (DEVDBNEW).
– Create a password file:
>> cd $ORACLE_HOME/dbs
>> orapwd file=orapwDEVDBNEW password=<password> entries=5
– Create directories for your datafiles:
>> mkdir -p /data/oradata/DEVDBNEW/arch
>> mkdir -p /data/oradata/DEVDBNEW/directories
– Create directories for your backup:
>> mkdir -p /data/oradata/backup/DEVDBNEW/export
>> mkdir -p /data/oradata/backup/DEVDBNEW/rman
– Create directories for the admin-files:
>> mkdir -p /software/oracle/admin/DEVDBNEW/adump
>> mkdir -p /software/oracle/admin/DEVDBNEW/bdump
>> mkdir -p /software/oracle/admin/DEVDBNEW/cdump
>> mkdir -p /software/oracle/admin/DEVDBNEW/udump
>> mkdir -p /software/oracle/admin/DEVDBNEW/scripts
>> mkdir -p /software/oracle/admin/DEVDBNEW/pfile
>> mkdir -p /software/oracle/admin/DEVDBNEW/dpdump
– Create a pfileDEVDBNEW.ora in your own or temp-directory, in my case /home/oracle/dba/job:
>>cat pfileDEVDBNEW.ora:
*.audit_file_dest=’/software/oracle/admin/DEVDBNEW/adump’
*.background_dump_dest=’/software/oracle/admin/DEVDBNEW/bdump’
*.compatible=’10.2.0.3.0′
*.control_files=’/data/oradata/DEVDBNEW/control01.ctl’,’/data/oradata/DEVDBNEW/control02.ctl’,’/data/oradata/DEVDBNEW/control03.ctl’
*.core_dump_dest=’/software/oracle/admin/DEVDBNEW/cdump’
*.db_block_size=8192
*.db_domain=”
*.db_file_multiblock_read_count=16
*.db_name=’DEVDBNEW’
*.dispatchers='(PROTOCOL=TCP) (SERVICE=DEVDBNEWXDB)’
*.job_queue_processes=10
*.log_archive_dest_1=’LOCATION=/data/oradata/DEVDBNEW/arch’
*.log_archive_format=’arch_%d_%t_%r_%s.arc’
*.open_cursors=300
*.pga_aggregate_target=394264576
*.processes=150
*.remote_login_passwordfile=’EXCLUSIVE’
*.sga_target=1183842304
*.undo_management=’AUTO’
*.undo_tablespace=’UNDOTBS1′
*.user_dump_dest=’/software/oracle/admin/DEVDBNEW/udump’
*.db_file_name_convert=(‘/data10/oradata/DEVDB/DEVDB/’,’/data/oradata/DEVDBNEW/’,’/data10/oradata/DEVDB/’,’/data/oradata/DEVDBNEW/’)
*.log_file_name_convert=(‘/data10/oradata/DEVDB/DEVDB/’,’/data/oradata/DEVDBNEW/’)
Pay attention to the last two params.
In this case there had been a mistake when creating the database. The system-files were on …/DEVDB/DEVDB, the rest on …/DEVDB. To solve this, I used the parameter ‘db_file_name_convert’ in the above order.
– Create a spfile from this pfile:
>>sqlplus “/as sysdba”
Connected to an idle instance.
SQL> create spfile=’/software/oracle/product/10.2/dbs/spfileDEVDBNEW.ora’ from pfile=’/home/oracle/dba/job/pfileDEVDBNEW.ora’;
– Put DEVDBNEW in de listener.ora on ELLISON:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /software/oracle/product/10.2)
(PROGRAM = extproc)
)
(SID_DESC =
(ORACLE_HOME = /software/oracle/product/10.2)
(SID_NAME = DEVDBNEW)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ELLISON.<domain>.nl)(PORT = 1521))
)
)
– Put DEVDBNEW and DEVDB in the tnsnames.ora of ELLISON.
DEVDBNEW =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = TCP.world)
(PROTOCOL = TCP)
(Host = ELLISON)
(Port = 1521)
)
)
(CONNECT_DATA =
(SERVICE_NAME = DEVDBNEW)
)
)
DEVDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = LARRIE)
(PORT = 1521)
)
)
(CONNECT_DATA =
(SERVICE_NAME = DEVDB)
)
)
– If the backup is from a while ago, and there are activities in the database, perfirm a log-switch of DEVDB and backup all archive-logs of the DEVDB to the backup-directory:
rman>> backup as copy archivelog all;
– Copy the complete backup-directory from LARRIE to ELLISON.
– Startup the new database (DEVDBNEW on ELLISON) in nomount-mode.
– Start RMAN including the clone-process (auxiliary = DEVDBNEW):
$ORACLE_HOME/bin/rman target sys/<passwrd>@DEVDB auxiliary sys/<password>@DEVDBNEW
connected to target database: DEVDB (DBID=891379751)
connected to auxiliary database: DEVDBNEW (not mounted)
run
{
allocate auxiliary channel aux1 device type disk;
duplicate target database to DEVDBNEW;
}
And you’re done..
Leave A Comment