Sunday, August 12, 2012

HOT CLONING USING RMAN CATALOG

STEPS FOR THE hot rman CLONING


 LETS ASSUME

SERVER 1 192.168.188.128 ORCL

SERVER 2 192.168.188.129 RCAT AND HERE NEW DATABASE ORCLON WILL BE CREATED AUTOMATICALLY



1. TAKE THE BACKUP OF (ORCL) DATABASE USING RECOVERY CATALOG (RCAT)
2. ON SERVER 2 CREATE FOLDERS ADMIN...ADUMP...BDUMP..CDUMP..PFILE... CREATE FOLDER IN ORADATA..ORCLON (CLONE DATABASE)
3. CREATE THE PFILE FOR ORCLON
4. ADD THE DB_FILE_NAME_CONVERT AND LOG_FILE_NAME_CONVERT
5. COPY THE BACKUP OF ORCL DATABASE TO THE SERVER 2 TO THE EXACT LOCATION WHICH IS ON SERVER 1
6. ORCLON DATABASE NOMOUNT MODE
7. RMAN TARGET SYS/ORACLE@ORCL CATALOG RMS/RMS@RCAT AUXILIARY /
8. DUPLICATE TARGET DATABASE TO "CLONE";

AT THE SERVER 1
[oracle@localhost archivelog]$ cat /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = orcl) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521)) ) )

[oracle@localhost archivelog]$ cat /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora # Generated by Oracle configuration tools.
RCAT = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.188.129)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = rcat) ) )
ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.188.128)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) ) ORCLON = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.188.129)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orclon) ) ) EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) ) )

[oracle@localhost archivelog]$

BACKUPOF THE DATABASE orcl AND SCP IT TO THE SERVER 2

[oracle@localhost ]$ scp /u01/app/oracle/flash_recovery_area/ORCL/* oracle@192.168.188.129:/u01/app/oracle/flash_recovery_area/ORCL/
The authenticity of host '192.168.188.129 (192.168.188.129)' can't be established. RSA key fingerprint is d0:ae:ae:5d:21:de:d3:f8:74:16:84:64:1a:8e:80:11. Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.188.129' (RSA) to the list of known hosts.

oracle@192.168.188.129's password:

NOW ON THE SERVER 2

CREATE THE FOLDERS IN ADMIN AND ORADATA CREATE THE PFILE AND PASSWORD FILE

orapwd file=orapworclon password=oracle entries=5 force=y initfile entries

[oracle@localhost orclon]$ cat /u01/app/oracle/product/10.2.0/db_1/dbs/initorclon.ora ##############################################################################
# Copyright (c) 1991, 2001, 2002 by Oracle Corporation
##############################################################################
###########################################
# Cache and I/O
###########################################
db_block_size=8192
db_file_multiblock_read_count=16
###########################################
# Cursors and Library Cache
###########################################
open_cursors=300
db_file_name_convert=('/u01/app/oracle/oradata/orcl', '/u01/app/oracle/oradata/orclon')  <---------------- added
log_file_name_convert=('/u01/app/oracle/oradata/orcl', '/u01/app/oracle/oradata/orclon') <---------------- added
###########################################
# Database Identification
###########################################
db_domain=""
db_name=orclon
###########################################
# Diagnostics and Statistics
###########################################
background_dump_dest=/u01/app/oracle/admin/orclon/bdump
core_dump_dest=/u01/app/oracle/admin/orclon/cdump
user_dump_dest=/u01/app/oracle/admin/orclon/udump
###########################################
# File Configuration
###########################################
control_files=("/u01/app/oracle/oradata/orclon/control01.ctl",
"/u01/app/oracle/oradata/orclon/control02.ctl",
"/u01/app/oracle/oradata/orclon/control03.ctl")
db_recovery_file_dest=/u01/app/oracle/flash_recovery_area
db_recovery_file_dest_size=116391936
###########################################
# Job Queues
###########################################
job_queue_processes=10
###########################################
# Miscellaneous
###########################################
compatible=10.2.0.1.0
###########################################
# Processes and Sessions
###########################################
processes=150
###########################################
# SGA Memory
###########################################
sga_target=285212672
###########################################
# Security and Auditing
###########################################
audit_file_dest=/u01/app/oracle/admin/orclon/adump
remote_login_passwordfile=EXCLUSIVE
###########################################
# Shared Server
###########################################
dispatchers="(PROTOCOL=TCP) (SERVICE=orclonXDB)"
###########################################
# Sort, Hash Joins, Bitmap Indexes
###########################################
pga_aggregate_target=94371840
###########################################
# System Managed Undo and Rollback Segments
###########################################
undo_management=AUTO
undo_tablespace=UNDOTBS1



 export ORACLE_SID=orclon

 startup nomount



 rman taget sys/oracle@orcl catalog rms/rms@rcat auxiliary /



RMAN>duplicate target database to "orclon";

Starting Duplicate Db at 11-AUG-12
using channel ORA_AUX_DISK_1
contents of Memory Script:
{ set until scn 549336;
set newname for datafile 1 to "/u01/app/oracle/oradata/orclon/system01.dbf";
set newname for datafile 2 to "/u01/app/oracle/oradata/orclon/undotbs01.dbf";
set newname for datafile 3 to "/u01/app/oracle/oradata/orclon/sysaux01.dbf";
set newname for datafile 4 to "/u01/app/oracle/oradata/orclon/users01.dbf";
set newname for datafile 5 to "/u01/app/oracle/oradata/orclon/example01.dbf";
restore check readonly clone database ;
}
executing Memory Script executing command:
SET until clause executing command:
SET NEWNAME executing command:
SET NEWNAME executing command:
SET NEWNAME executing command:
SET NEWNAME executing command:
SET NEWNAME

Starting restore at 11-AUG-12
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1:
starting datafile backupset restore
channel ORA_AUX_DISK_1:
specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/oradata/orclon/system01.dbf
restoring datafile 00002 to /u01/app/oracle/oradata/orclon/undotbs01.dbf
restoring datafile 00003 to /u01/app/oracle/oradata/orclon/sysaux01.dbf
restoring datafile 00004 to /u01/app/oracle/oradata/orclon/users01.dbf
restoring datafile 00005 to /u01/app/oracle/oradata/orclon/example01.dbf
channel ORA_AUX_DISK_1:
reading from backup piece /u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_08_11/o1_mf_nnndf_TAG20120811T140610_82d6cwcz_.bkp
channel ORA_AUX_DISK_1:
restored backup piece 1 piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_08_11/o1_mf_nnndf_TAG20120811T140610_82d6cwcz_.bkp tag=TAG20120811T140610
channel ORA_AUX_DISK_1:
restore complete,
elapsed time: 00:01:45
Finished restore at 11-AUG-12 sql statement:
CREATE CONTROLFILE REUSE SET DATABASE "ORCLON" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE GROUP 1 ( '/u01/app/oracle/oradata/orclon/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/u01/app/oracle/oradata/orclon/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/u01/app/oracle/oradata/orclon/redo03.log' ) SIZE 50 M REUSE
DATAFILE '/u01/app/oracle/oradata/orclon/system01.dbf'
CHARACTER SET WE8ISO8859P1
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
released channel: ORA_AUX_DISK_1
datafile 2 switched to datafile copy input datafile copy recid=1 stamp=791044660 filename=/u01/app/oracle/oradata/orclon/undotbs01.dbf
datafile 3 switched to datafile copy input datafile copy recid=2 stamp=791044660 filename=/u01/app/oracle/oradata/orclon/sysaux01.dbf
datafile 4 switched to datafile copy input datafile copy recid=3 stamp=791044660 filename=/u01/app/oracle/oradata/orclon/users01.dbf
datafile 5 switched to datafile copy input datafile copy recid=4 stamp=791044660 filename=/u01/app/oracle/oradata/orclon/example01.dbf

contents of Memory Script:
{
set until scn 549336;
recover clone database delete archivelog ;
}
executing Memory Script executing command:
SET until clause Starting recover at 11-AUG-12
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=158
devtype=DISK starting media recovery
archive log thread 1 sequence 4 is already on disk as file /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2012_08_11/o1_mf_1_4_82d6zol9_.arc
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2012_08_11/o1_mf_1_4_82d6zol9_.arc thread=1 sequence=4 media recovery complete, elapsed time: 00:00:06
Finished recover at 11-AUG-12
contents of Memory Script:
{
shutdown clone;
startup clone nomount ;
}
executing Memory Script
database dismounted
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes
sql statement:
CREATE CONTROLFILE REUSE SET DATABASE "ORCLON" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE GROUP 1 ( '/u01/app/oracle/oradata/orclon/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/u01/app/oracle/oradata/orclon/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/u01/app/oracle/oradata/orclon/redo03.log' ) SIZE 50 M REUSE
DATAFILE '/u01/app/oracle/oradata/orclon/system01.dbf'
CHARACTER SET WE8ISO8859P1
contents of Memory Script:
{
set newname for tempfile 1 to "/u01/app/oracle/oradata/orclon/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/u01/app/oracle/oradata/orclon/undotbs01.dbf";
catalog clone datafilecopy "/u01/app/oracle/oradata/orclon/sysaux01.dbf";
catalog clone datafilecopy "/u01/app/oracle/oradata/orclon/users01.dbf";
catalog clone datafilecopy "/u01/app/oracle/oradata/orclon/example01.dbf";
switch clone datafile all;
}
executing Memory Script executing command:
SET NEWNAME renamed temporary file 1 to /u01/app/oracle/oradata/orclon/temp01.dbf in control file cataloged datafile copy
datafile copy filename=/u01/app/oracle/oradata/orclon/undotbs01.dbf recid=1 stamp=791044678 cataloged datafile copy
datafile copy filename=/u01/app/oracle/oradata/orclon/sysaux01.dbf recid=2 stamp=791044679 cataloged datafile copy
datafile copy filename=/u01/app/oracle/oradata/orclon/users01.dbf recid=3 stamp=791044679 cataloged datafile copy
datafile copy filename=/u01/app/oracle/oradata/orclon/example01.dbf recid=4 stamp=791044679
datafile 2 switched to datafile copy input datafile copy recid=1 stamp=791044678 filename=/u01/app/oracle/oradata/orclon/undotbs01.dbf
datafile 3 switched to datafile copy input datafile copy recid=2 stamp=791044679 filename=/u01/app/oracle/oradata/orclon/sysaux01.dbf
datafile 4 switched to datafile copy input datafile copy recid=3 stamp=791044679 filename=/u01/app/oracle/oradata/orclon/users01.dbf datafile
5 switched to datafile copy input datafile copy recid=4 stamp=791044679 filename=/u01/app/oracle/oradata/orclon/example01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 11-AUG-12

RMAN>exit
Recovery Manager complete.



 [oracle@localhost ~]$ export ORACLE_SID=orclon

 [oracle@localhost ~]$ sqlplus "/as sysdba"



SQL*Plus: Release 10.2.0.1.0 - Production on Sat Aug 11 14:44:38 2012 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options



SQL> select name,open_mode from v$database;

NAME          OPEN_MODE

---------    ----------------------

ORCLON       READ WRITE

SQL>

No comments:

Post a Comment

ORA-12519: TNS:no appropriate service handler found error

ORA-12519: TNS: no appropriate service handler found error The real problem lies in the PROCESSES parameter All you need ...