Académique Documents
Professionnel Documents
Culture Documents
Alejandro Vargas
February 4, 2007.
PRACTICE OBJECTIVES: .................................................................................................................................................................................................................................. 2
PRACTICE DESCRIPTION: ............................................................................................................................................................................................................................... 2
STEPS: ................................................................................................................................................................................................................................................................... 2
TASK ........................................................................................................................................................................................................................................................................ 2
1. CREATE AN ORACLE PASSWORD FILE FOR THE AUXILIARY INSTANCE................................................................................................................................... 2
2. CREATE A NEW INIT.ORA FOR THE DATABASE ................................................................................................................................................................................ 2
3. CONFIGURE SQL NET FOR THE NEW DATABASE ................................................................................................................................................................................ 3
4. CREATE REQUIRED DIRECTORIES AS DEFINED ON INIT.ORA ................................................................................................................................................... 4
5. STARTUP NOMOUNT THE AUXILIARY INSTANCE ON TARGET NODE ............................................................................................................................................ 4
6.CHECK THAT SOURCE DATABASE IS MOUNTED OR OPEN.................................................................................................................................................................. 5
7. CHECK THAT A BACKUP OF ALL REQUIRED DATAFILES AND ARCHIVED LOGS EXIST ON THE TARGET SERVER .................................................... 5
8. START RMAN AND ALLOCATE AUXILIARY CHANNELS TO THE NEW DATABASE ....................................................................................................................... 5
9. EXECUTE THE DUPLICATE DATABASE COMMAND ................................................................................................................................................................................ 6
10. CHECK THE NEW DATABASE.................................................................................................................................................................................................................. 12
REFERENCES........................................................................................................................................................................................................................................................ 13
Practice Objectives:
Build skills to create a clone of a Database based on ASM using RMAN.
Practice Description:
Duplicate Instance from Node 2 of a RAC on ASM as a new Database in Node 1
Steps:
Task
Action
On the target Oracle Home, create password file:
1. Create an
Oracle Password
File for the
Auxiliary
Instance
2. Create a new
init.ora for the
database
Use the db_create_file_dest init.ora parameter to setup all new database file names using
Oracle Managed Files, this simplify cloning because all names are automatically changed to
match database name and assigned location:
Used an existing spfile to create the new pfile and then edited it:
strings spfilewhiteowl.ora >initrmdupl.ora
rmdupl.__db_cache_size=92274688
rmdupl.__java_pool_size=4194304
rmdupl.__large_pool_size=4194304
rmdupl.__shared_pool_size=62914560
rmdupl.__streams_pool_size=0
*.compatible='10.2.0.1.0'
*.audit_file_dest
='/oradisk/app01/oracle/admin/rmdupl/adump'
*.background_dump_dest ='/oradisk/app01/oracle/admin/rmdupl/bdump'
*.user_dump_dest
='/oradisk/app01/oracle/admin/rmdupl/udump'
*.core_dump_dest
='/oradisk/app01/oracle/admin/rmdupl/cdump'
*.log_archive_dest
='/vmasmtest/od01/rmdupl/archives'
*.db_create_file_dest
='/vmasmtest/od01/rmdupl'
*.control_files
='/vmasmtest/od01/rmdupl/controlfile/rmdupl_01.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='rmdupl'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=rmduplXDB)'
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
On Source Node add to tnsnames an entry to get to the database:
3. Configure SQL
Net for the new
database
rmdupl =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vmractest1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rmdupl)
)
)
On Target Node add an entry to the Listener.ora:
SID_LIST_LISTENER.VMRACTEST1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = rmdupl)
(ORACLE_HOME = /oradisk/app01/oracle/product/10gDB)
(SID_NAME = rmdupl)
)
)
Check from source node SqlNet connectivity:
> tnsping rmdupl
TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 04-FEB-2007 15:58:52
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
/oradisk/app01/oracle/product/10gDB/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = vmractest1)(PORT =
1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = rmdupl)))
OK (0 msec)
Get Directory names from init.ora and create all required files:
4. Create
required
directories as
defined on
init.ora
5. Startup
nomount the
auxiliary
instance on
target node
ORACLE_BASE=/oradisk/app01/oracle
ORACLE_HOME=/oradisk/app01/oracle/product/10gDB
ORACLE_SID=rmdupl
Startup nomount force the auxiliary instance:
{oracle} /oradisk/app01/oracle/product/10gDB/dbs [vmractest1.partnergsm.co.il] > sqlplus /
as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Feb 4 16:17:16 2007
Copyright (c) 1982, 2005, Oracle.
167772160
1218316
71305460
92274688
bytes
bytes
bytes
bytes
Redo Buffers
2973696 bytes
6.Check that
source database
is mounted or
open
ORACLE_BASE=/oradisk/app01/oracle
ORACLE_HOME=/oradisk/app01/oracle/product/10gDB
ORACLE_SID=racdbtst2
{oracle} /home/oracle [vmractest2.partnergsm.co.il] > sqlplus /
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Feb 4 17:51:40 2007
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, Real Application Clusters, OLAP and Data Mining options
SQL> select status from v$instance
2 /
STATUS
-----------OPEN
Add all archived logs from the existing database to backup destination using rman:
7. Check that a
backup of all
required
datafiles and
archived logs
exist on the
target server
ORACLE_BASE=/oradisk/app01/oracle
ORACLE_HOME=/oradisk/app01/oracle/product/10gDB
ORACLE_SID=racdbtst2
Invoke rman on the source database and target auxiliary instance:
{oracle} /home/oracle [vmractest2.partnergsm.co.il] > rman TARGET / nocatalog AUXILIARY
sys/oracle@rmdupl
9. Execute the
duplicate
database command
RMAN> run {
2> ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
3> DUPLICATE TARGET DATABASE TO rmdupl;
4> }
allocated channel: aux1
channel aux1: sid=153 devtype=DISK
Starting Duplicate Db at 04/02/2007 17:04:14
contents of Memory Script:
{
set until scn 18923772;
set newname for clone datafile
set newname for clone datafile
set newname for clone datafile
set newname for clone datafile
set newname for clone datafile
set newname for clone datafile
restore
check readonly
clone database
;
}
executing Memory Script
1
2
3
4
5
6
to
to
to
to
to
to
new;
new;
new;
new;
new;
new;
167772160 bytes
Fixed Size
1218316 bytes
Variable Size
71305460 bytes
Database Buffers
92274688 bytes
Redo Buffers
2973696 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "RMDUPL" RESETLOGS ARCHIVELOG
MAXLOGFILES
192
MAXLOGMEMBERS
3
MAXDATAFILES
1024
MAXINSTANCES
32
MAXLOGHISTORY
292
LOGFILE
GROUP 3 SIZE 50 M ,
GROUP 4 SIZE 50 M
DATAFILE
'/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_system_2wcxm819_.dbf'
CHARACTER SET AL32UTF8
control file
renamed temporary file 2 to /vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_temp_%u_.tmp in
control file
cataloged datafile copy
datafile copy filename=/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_undotbs1_2wcxoq56_.dbf
recid=1 stamp=613674808
cataloged datafile copy
datafile copy filename=/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_sysaux_2wcxq00y_.dbf
recid=2 stamp=613674808
cataloged datafile copy
datafile copy filename=/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_undotbs2_2wcxv3ck_.dbf
recid=3 stamp=613674809
cataloged datafile copy
datafile copy filename=/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_users_2wcxvwt9_.dbf
recid=4 stamp=613674809
cataloged datafile copy
datafile copy filename=/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_recop1_2wcxwdmv_.dbf
recid=5 stamp=613674810
datafile 2 switched to datafile copy
input datafile copy recid=1 stamp=613674808
filename=/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_undotbs1_2wcxoq56_.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=613674808
filename=/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_sysaux_2wcxq00y_.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=613674809
filename=/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_undotbs2_2wcxv3ck_.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=613674809
filename=/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_users_2wcxvwt9_.dbf
datafile 6 switched to datafile copy
input datafile copy recid=5 stamp=613674810
filename=/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_recop1_2wcxwdmv_.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
ORACLE_BASE=/oradisk/app01/oracle
ORACLE_HOME=/oradisk/app01/oracle/product/10gDB
ORACLE_SID=rmdupl
{oracle} > sqlplus '/ as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Sun Feb 4 17:16:07 2007
Copyright (c) 1982, 2005, Oracle.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
NAME
CREATED
RESETLOGS_TIME LOG_MODE
CONTROLFILE_CRE
-------- --------------- --------------- ---------- --------------RMDUPL
04-feb-07 17:13 04-feb-07 17:13 ARCHIVELOG 04-feb-07 17:13
file_name from dba_data_files;
FILE_NAME
-------------------------------------------------------------------------------/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_system_2wcxm819_.dbf
/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_undotbs1_2wcxoq56_.dbf
/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_sysaux_2wcxq00y_.dbf
/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_undotbs2_2wcxv3ck_.dbf
/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_users_2wcxvwt9_.dbf
/vmasmtest/od01/rmdupl/RMDUPL/datafile/o1_mf_recop1_2wcxwdmv_.dbf
References
6 rows selected.
How Recovery Manager Duplicates a Database
Prepare the Rman Duplicate Auxiliary Instance