Document Sample
Using_RMAN Powered By Docstoc
					RMAN - Duplicate Database on the same host Thursday, June 5, 2008 Email this | Share on Facebook | Subscribe to this feed Primary DB : ORCL Clone DB : AUX

Production Database should be archive enabled. Startup mount; alter database archivelog; alter database open; archive log list; Recovery catalog for RMAN Creating the Recovery Catalog Owner Start by creating a database schema (usually called rman). Assign an appropriate tablespace to it and grant it the recovery_catalog_owner role. Look at this example:

% sqlplus '/ as sysdba' SQL> CREATE USER rman IDENTIFIED BY rman DEFAULT TABLESPACE tools TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON tools; SQL> GRANT CONNECT, RECOVERY_CATALOG_OWNER TO rman Creating the Recovery Catalog % rman catalog rman/rman@ORCL RMAN> CREATE CATALOG; Registering the target database % rman TARGET / CATALOG rman/rman@ORCL RMAN> REGISTER DATABASE; Reference : RMAN: How to Query the RMAN Recovery Catalog ( Note:98342.1 )

Example Source Listener.ora

SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /newpart//product/10.2.0/) (PROGRAM = extproc) ) (SID_DESC = (GLOBAL_DBNAME = ORCL) (ORACLE_HOME = /newpart//product/10.2.0) (SID_NAME = ORCL) ) (SID_DESC = (GLOBAL_DBNAME = AUX) (ORACLE_HOME = /newpart//product/10.2.0) (SID_NAME = AUX) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0)) ) ) Example Source tnsnames.ora


Note : Make use of netca and netmgr to configure listener and tnsnames

# Find Production Database Files: SQL> select name from v$datafile; Create the Auxiliary Database directories needed cd $ORACLE_HOME/dbs create parameter file initAUX.ora

db_file_name_convert = ('/old/path1', '/new/path1', '/old/path2', '/new/path2', '/old/path3', '/new/path3') log_file_name_convert = ('/old/path1', '/new/path1', '/old/path2', '/new/path2', '/old/path3', '/new/path3') eg:db_name = aux db_block_size = 8192 compatible = remote_login_passwordfile = exclusive control_files = ('/newpart/oradata/aux/control01.ctl', '/newpart/oradata/aux/control02.ctl') db_file_name_convert = ('/newpart/oradata/orcl', '/newpart/oradata/aux') log_file_name_convert = ('/newpart/oradata/orcl', '/newpart/oradata/aux') *.undo_management='AUTO' *.undo_tablespace='UNDOTBS1'

# create a passwordfile for remote connections as sysdba

% orapwd password=<sys_pwd> file=orapwAUX % sqlplus /nolog SQL> connect / as sysdba SQL> startup nomount pfile=$ORACLE_HOME/dbs/initAUX.ora SQL> exit Start the Duplication ORACLE_SID=AUX; export ORACLE_SID # ksh sqlplus /nolog SQL> connect / as sysdba Connected to an idle instance SQL> startup nomount pfile=$ORACLE_HOME/dbs/initAUX.ora SQL> exit

# Set your SID back to the TARGET for duplication. > rman trace.log Recovery Manager: Release - Production Copyright (c) Oracle. All rights reserved. RMAN> connect target connected to target database: V10GREL4 (DBID=2510891965)

RMAN>backup database; RMAN>sql 'alter system switch logfile'; RMAN> connect auxiliary sys/pwd@AUX connected to auxiliary database: AUX (not mounted) RMAN> duplicate target database to AUX device type disk; Once this is done, login to duplicate database with alter database open resetlogs.

Read more! Posted by Famy Rasheed 0 comments RMAN - Duplicate Database on a New host Email this | Share on Facebook | Subscribe to this feed

How To Create A Production Duplicate On a New Host using RMAN

Primary Database SID: ORCL Duplicate Database SID: AUX RMAN Catalog SID: RMAN

Backup of the primary database. Host A (Target)

# export ORACLE_SID=ORCL # rman catalog

rman/rman@ORCL target internal/oracle@prod

RMAN> run { allocate channel d1 type disk; backup format '/backups/PROD/df_t%t_s%s_p%p' database; sql 'alter system archive log current'; backup format '/backups/PROD/al_t%t_s%s_p%p' archivelog all; release channel d1; } This command will perform a full database backup including archivelogs and the current controlfile. Host B (Aux) Making the backup available for the duplicate process. If your backup resides on disk you will need to copy this back up from host A to host B. Ensure you place it in the same directory as where it was created. RMAN> list backup; Create same directory of host b and give appropriate permissions for the oracle user. Create the pfile initAUX.ora parameter file in the $ORACLE_HOME/dbs directory for the auxiliary database.

---------------------------------------------------------------------db_name = aux db_block_size = 8192 compatible = remote_login_passwordfile = exclusive control_files = ('/d02/oradata/aux/control01.ctl') db_file_name_convert = ('/newpart/oradata/orcl', '/d02/oradata/aux') log_file_name_convert = ('/newpart/oradata/orcl', '/d02/oradata/aux') *.undo_management='AUTO' *.undo_tablespace='UNDOTBS1' -----------------------------------------------------------------------------Following the creation of the initAUX.ora startup nomount the auxiliary instance export ORACLE_SID=AUX sqlplus '/as sysdba' startup nomount; Ensuring SQL*NET connections to primary database and RMAN catalog are working Host B(AUX) sqlplus 'sys/oracle@PROD as sysdba' sqlplus rman/rman@PROD (not mandatory) Add tnsnames.ora entry - Eg: ORCL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521)) ) (CONNECT_DATA =

(SERVICE_NAME = ORCL) ) ) Prepare RMAN duplicate script run { allocate auxiliary channel C1 device type disk; duplicate target database to AUX; } Save it as dup.sql

Execute the RMAN script Start RMAN, connect to the production target, the catalog instance and also the auxiliary clone. Run the RMAN duplicate script as shown below. Before doing this ensure that the Oracle SID environment variable is set to the duplicate clone database. # export ORACLE_SID=AUX # rman target sys/pwd@ORCL catalog rman/rman@ORCL auxiliary / RMAN> @dup.sql After this, login to aux database and alter database open with resetlogs option.

Shared By: