Oracle Consulting, Oracle Support and Oracle Training by Spyridon N. Kaparelis
osCommerce

Oracle

My Account      
  Oracle Scripts (Search) » Categories » Administration » Backup - Recovery » My Account          
Categories
Free Oracle Support (1)
Administration-> (120)
  Alertlog (3)
  Archivelog (5)
  Auditing (1)
  Backup - Recovery (11)
  Database files (5)
  Database options (2)
  DB links (2)
  Dependencies (1)
  Dictionary (2)
  Export Import Datapump (2)
  Jobs (2)
  Mview (2)
  Networking (2)
  Objects (7)
  Parameters (2)
  Redologs (6)
  Roles (1)
  Rollback - Undo (8)
  Segments (2)
  Sequences (2)
  Sessions (14)
  SGA (10)
  Tables (10)
  Tablespaces (9)
  Temp (5)
  Transactions (1)
  Users (3)
FlexCube (4)
ORA errors (14)
Oracle Application Server (1)
Oracle APPS DBA-> (38)
Oracle APPS DBA jobs (1)
Oracle Books (18)
Oracle RAC (3)
Oracle Real Cases (29)
Oracle Security (6)
Oracle SQL tricks (32)
Other Oracle sites (3)
Performance Tuning-> (53)
Site info
About Spyridon N. Kaparelis
Privacy Notice & Disclaimer
Buy Oracle APPS DBA Books
Ask for Free Oracle Support
Clone database with RMAN

Summary
RMAN can be used to duplicate, or clone, a database from a previous backup. The clone can be done in the same server or on a remote server. Here I will demonstrate how to do it, with Oracle9i, RMAN and on a remote server with different filesystems.

Prepare the environment on the remote server
In order to make the clone on the new remote server you must set up:

1. A new unix user with the same privileges like the production unix user
2. Copy the $ORACLE_HOME binaries from the production server to the new remote server.
    This will be your new $ORACLE_HOME for the clone. Relink to make it valid!
3. Add alias entries in tnsnames.ora for RMAN database, production database and new clone on the remote server.
4. Add a new listener.ora on the remote server.
5. Create directory structured for dump_dest trace files, datafiles_new, controlfiles, 
    redologs_new on the remote server.
6. Create a new init.ora file for the process on the remote server at $ORACLE_HOME/dbs location
In the example the production database is ANDR, DUP will be the clone and RMAN is the rman database
ANDR =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = crmcc)(PORT = 1521))
    (CONNECT_DATA =
      (SID = ANDR)))

DUP =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rp1dev)(PORT = 1551))
    (CONNECT_DATA =
      (SID = DUP)))

RMAN =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = bserver)(PORT = 1521))
    (CONNECT_DATA =
      (SID = RMAN)))
the new listener.ora file on the remote server is
# LISTENER.ORA Network Configuration File: /ora1/androm/9.2.0/network/admin/listener.ora
# Generated by Oracle configuration tools.

DUP =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rp1dev)(PORT = 1551)))

SID_LIST_DUP =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = DUP)
      (ORACLE_HOME = /orandr/ANDR/9.2.0)
      (SID_NAME = DUP)))

Start the new listener!
$lsnrctl start DUP
Now you have to create the initDUP.ora, at $ORACLE_HOME/dbs - here is the example
db_name = "DUP"
instance_name = DUP
control_files = (/orandr/ANDR/controlfiles/control01.ctl, /orandr/ANDR/controlfiles/control02.ctl, 
/orandr/ANDR/controlfiles/control03.ctl)
db_file_name_convert=(/orandr/ANDR/datafiles/,/orandr/ANDR/datafiles_new/)
log_file_name_convert=(/orandr/ANDR/redologs/,/orandr/ANDR/redologs_new/)
db_block_size = 8192
compatible = 9.2.0.0.0
background_dump_dest = '/orandr/ANDR/9.2.0/admin/DUP/bdump/'
user_dump_dest = '/orandr/ANDR/9.2.0/admin/DUP/udump/'
core_dump_dest = '/orandr/ANDR/9.2.0/admin/DUP/cdump/'
***control_files*** is where the new controlfiles will be created

After setting new $ORACLE_HOME, $ORACLE_SID, $PATH for the new clone execute on the remote server the following:
export NLS_DATE_FORMAT='DD-MM-YYYY HH24:MI'
sqlplus /nolog
CONNECT / AS SYSDBA
STARTUP nomount PFILE=$ORACLE_HOME/dbs/initDUP.ora
exit sqlplus and run from the shell
rman TARGET sys/t3mpl8@ANDR CATALOG rman/atromhtos@RMAN AUXILIARY / 
from the RMAN command line execute (line by line )
RUN { 
allocate auxiliary channel ch01 TYPE 'SBT_TAPE';
allocate auxiliary channel ch02 TYPE 'SBT_TAPE';
allocate auxiliary channel ch03 TYPE 'SBT_TAPE';
send 'NB_ORA_CLIENT=crmcc';
SET UNTIL TIME 'SYSDATE-7';
DUPLICATE TARGET DATABASE TO DUP;
}
*** NB_ORA_CLIENT=crmcc is the production server!

if you get errors like this
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ==========================================================
RMAN-03009: failure of allocate command on ch01 channel at 07/05/2010 15:51:45
ORA-19554: error allocating device, device type: SBT_TAPE, device name: 
ORA-27211: Failed to load Media Management Library
Additional information: 2

then execute:
ln -s /usr/openv/netbackup/bin/libobk.sl64 libobk.sl
The script steps executed in RMAN can be found here : Rman output script for creating DUPLICATE database
The contents of alert log while doing the Clone can be found here: Alert log contents while cloning with RMAN
Usually get this error after the cloning: ORA-01552: cannot use system rollback segment for non-system tablespace

Added by Spyridon N. Kaparelis at Wednesday 11 November, 2009
Notifications more
NotificationsNotify me of updates to Clone database with RMAN
Tell A Friend
 
Reviews more
Write ReviewWrite review for the script
Read Latest Oracle News
Search at the site
 
Press Enter to search

Advanced Search
Search Error Messages

Oracle8i
Oracle9i
Oracle10g
Oracle11g
Search Oracle Docs

Metalink
Oracle8i
Oracle9i
Oracle10g
Oracle11g


osCommerce
Oracle APPS DBA Kaparelis | Oracle RAC | Oracle PLSQL | Oracle Tips | Oracle Consulting | Oracle Metalink | Oracle Support Oracle Training | Oracle Certification | Oracle Articles | Oracle DBA | Oracle Magazine | Oracle User Groups Oracle 7.3 Oracle 8 Oracle 8i Oracle9i Oracle10g Oracle11g EBS E-Business Suite 11.5.10 Oracle Apps Tuning Oracle SGA tuning sql tracing oracle session oracle errros ORA error ORA-600 Ora-00600 oracle jobs dba jobs apps dba jobs oracle experts oracle guru oracle oracle real application cluster oracle index oracle optimazation query oracle explain plan query optimization oracle I/O oracle memory tuning oracle xstress test oracle education oracle university oracle certification OCP OCA oracle support contracts oracle monitoring RAC interconnect developer oracle forms reports oracle application server Rman spyros dba oracle backup Veritas recovery catalog rcvcat oracle Σπυρίδων Καπαρέλης Ora-00600:[] Sp???d?? ?. ?apa????? oracle monitor daily operations free oracle support free consulting oracle seminars oracle arhitecture Unix linux HP-UX AIX Sun Solaris Windows TAR Service Request Metalink oracle disaster recovery oracle Data Guard Oracle Database Administrator Oracle Services low cost oracle support oracle patches upgrades apps dba spyros patch upgrade oracle opatch OUI export import oracle data pump ADDM ASM oracle OAS PGA shared pool ?p?st????? Oracle Application Server 10g consultans Oracle ERP CRM Apache WebUtil oracle 10g 11g 12g New Features Oracle courses development Oracle News forums Oracle Technical Docs FAQ Oracle Professionals Oracle DataCenter Data Center IT Oracle prices oracle software pricelist oracle carriers Oracle RDBMS Oracle Σπύρος Καπαρέλης Oracle Fusion Spiros Kaparelis oracle Spyros Kaparelis