Oracle10G RMAN Database Duplication (Doc ID 259694.1)
Oracle10G RMAN Database Duplication (Doc ID 259694.1)
***Checked for relevance on 29-Mar-2012***
[ Creating a duplicate database using RMAN ]
The V10gREL5 is in noarchivelog mode. The duplication is being made from
closed database consistent backups. With archivelog mode databases you can
use the "set until time | scn | sequence" clause to tell RMAN where to end
for incomplete recovery.
TARGET : V10gREL5
AUXILIARY : RMAN10
[ SQLNET setup for connectivity ]
########################################################################################
# We must use a dedicated listener configuration for RMAN. Using instance registration
# requires the database be mounted to register with the listener. Since the AUX is
# where we'll connect using sqlnet we require sysdba access to the nomount instance.
# This example is using the same server for duplication but can be used for remote
# duplication as well. If you are using a disk backup solution and duplicate to a
# remote node you must first copy the backupsets from the original hosts backup
# location to the same mount and path on the remote server. Because duplication
# uses auxiliary channels the files must be where the IO pipe is allocated. So the
# IO will take place on the remote node and disk backups must be locally available.
#########################################################################################
Listener.ora:
=============
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = stsmesun1)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /database/10i/app/oracle/product/10g_Prod_REL5)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = V10gREL5)
(ORACLE_HOME = /database/10i/app/oracle/product/10g_Prod_REL5)
(SID_NAME = V10gREL5)
)
(SID_DESC =
(GLOBAL_DBNAME = RMAN10)
(ORACLE_HOME = /database/10i/app/oracle/product/10g_Prod_REL5)
(SID_NAME = RMAN10)
)
)
tnsnames.ora:
=============
RMAN10 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = stsmesun1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RMAN10)
)
)
V10R5 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = stsmesun1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = V10gREL5)
)
)
# Target Database Files:
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/database/10i/app/oracle/oradata/V10gREL5/system01.dbf
/database/10i/app/oracle/oradata/V10gREL5/undotbs01.dbf
/database/10i/app/oracle/oradata/V10gREL5/sysaux01.dbf
/database/10i/app/oracle/oradata/V10gREL5/users01.dbf
[ Create the Auxiliary Database directories needed ]
% cd $ORACLE_HOME/dbs
# Note: I am using a single directory for my datafiles. You can use the
# parameters db_file_name_convert and log_file_name_convert and they will
# generate the "set newname for datafile" syntax needed to change the
# controlfile. These parameters accommodate up to 5 different file placement
# locations using:
db_file_name_convert = ('/old/path1', '/new/path1',
'/old/path2', '/new/path2',
'/old/path3', '/new/path3')
# up to 5 locations from Oracle9i >.
log_file_name_convert = ('/old/path1', '/new/path1',
'/old/path2', '/new/path2',
'/old/path3', '/new/path3')
# up to 5 locations from Oracle9i >.
# You can also create your own "set newname for datafile" syntax for all your
# files skipping these parameters all together. You can still use the
# log_file_name_convert parameter or you can use the 'logfile' command to
# specifiy where the logs will be created and what size.
#
# Auxiliary datafile directory for this exercise:
"/database/10i/marrocha/RMAN10/oradata"
[ Create the Auxiliary init.ora ]
# the controlfile is created during duplication with the path and name given here
#
# initRMAN10.ora
db_name = RMAN10
db_block_size = 8192
compatible = 10.1.0.1.0
remote_login_passwordfile = exclusive
control_files = ('/database/10i/marrocha/RMAN10/oradata/control01.ctl',
'/database/10i/marrocha/RMAN10/oradata/control02.ctl')
db_file_name_convert = ('/database/10i/app/oracle/oradata/V10gREL5',
'/database/10i/marrocha/RMAN10/oradata')
log_file_name_convert = ('/database/10i/app/oracle/oradata/V10gREL5',
'/database/10i/marrocha/RMAN10/oradata')
# create a passwordfile for remote connections as sysdba
% orapwd password= file=orapwRMAN10
% sqlplus /nolog
SQL> connect / as sysdba
SQL> startup nomount pfile=$ORACLE_HOME/dbs/initRMAN10.ora
SQL> exit
[ RMAN Duplication from tape backup using the Oracle disk API ]
# This is to provide an example of simulating writing to tape using RMAN and
# the Oracle disk API. RMAN Target Configuration:
% rman
RMAN> connect target
connected to target database: V10GREL5 (DBID=2510891965)
# Use the RMAN configure command to create an optimal configuration for your
# business. the channels are configured to allocate from device type SBT by
# default. Since the channels are configured here we do not need to allocate
# any channels in the RMAN scripts.
# I/O only take place over the channel allocated. If an AUX channel is allocated
# only the auxiliary will perform IO so there is not worry about overwriting the
# target database production files. As an added safegard an error would raise if
# an attempt to overwrite a target file while it's online.
RMAN> show all;
using target database controlfile instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO 'V10GREL5_%F';
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=oracle.disksbt,
ENV=(BACKUP_DIR=/backup/rman/tape)';
CONFIGURE MAXSETSIZE TO UNLIMITED;
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/backup/rman/snapcf_V10gREL5.f';
RMAN> exit
[ Start the Duplication ]
# set the env to the auxiliary to "startup nomount"
setenv ORACLE_SID RMAN10 # csh
or
ORACLE_SID=RMAN10 export ORACLE_SID # ksh
% sqlplus /nolog
SQL> connect / as sysdba
Connected to an idle instance
SQL> startup nomount pfile=$ORACLE_HOME/dbs/initRMAN10.ora
SQL> exit
# Set your SID back to the TARGET for duplication. The information in the target
# is used by the duplicate to fill in missing information like maxopenfiles,
# maxlogfiles and other values which are only changed when recreating the control
# file. Execute RMAN from the target home. The auxiliary should be a sqlnet
# connection.
[stsmesun1]/home/beta/marrocha> rman trace dup_rman10.log
Recovery Manager: Release 10.1.0.2.0 - Production
Copyright (c) 1995, 2003, Oracle. All rights reserved.
RMAN> connect target
connected to target database: V10GREL5 (DBID=2510891965)
RMAN> connect auxiliary sys/rman10@RMAN10
connected to auxiliary database: RMAN10 (not mounted)
RMAN> duplicate target database to RMAN10 device type sbt;
... snip from output...
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 09-DEC-03
>>>EOF<<<
To complete the process remove or comment out the db and log convert parameters.
Restart the database. Your duplicate database is ready for use.
***Checked for relevance on 29-Mar-2012***
[ Creating a duplicate database using RMAN ]
The V10gREL5 is in noarchivelog mode. The duplication is being made from
closed database consistent backups. With archivelog mode databases you can
use the "set until time | scn | sequence" clause to tell RMAN where to end
for incomplete recovery.
TARGET : V10gREL5
AUXILIARY : RMAN10
[ SQLNET setup for connectivity ]
########################################################################################
# We must use a dedicated listener configuration for RMAN. Using instance registration
# requires the database be mounted to register with the listener. Since the AUX is
# where we'll connect using sqlnet we require sysdba access to the nomount instance.
# This example is using the same server for duplication but can be used for remote
# duplication as well. If you are using a disk backup solution and duplicate to a
# remote node you must first copy the backupsets from the original hosts backup
# location to the same mount and path on the remote server. Because duplication
# uses auxiliary channels the files must be where the IO pipe is allocated. So the
# IO will take place on the remote node and disk backups must be locally available.
#########################################################################################
Listener.ora:
=============
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = stsmesun1)(PORT = 1521))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /database/10i/app/oracle/product/10g_Prod_REL5)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = V10gREL5)
(ORACLE_HOME = /database/10i/app/oracle/product/10g_Prod_REL5)
(SID_NAME = V10gREL5)
)
(SID_DESC =
(GLOBAL_DBNAME = RMAN10)
(ORACLE_HOME = /database/10i/app/oracle/product/10g_Prod_REL5)
(SID_NAME = RMAN10)
)
)
tnsnames.ora:
=============
RMAN10 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = stsmesun1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = RMAN10)
)
)
V10R5 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = stsmesun1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = V10gREL5)
)
)
# Target Database Files:
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/database/10i/app/oracle/oradata/V10gREL5/system01.dbf
/database/10i/app/oracle/oradata/V10gREL5/undotbs01.dbf
/database/10i/app/oracle/oradata/V10gREL5/sysaux01.dbf
/database/10i/app/oracle/oradata/V10gREL5/users01.dbf
[ Create the Auxiliary Database directories needed ]
% cd $ORACLE_HOME/dbs
# Note: I am using a single directory for my datafiles. You can use the
# parameters db_file_name_convert and log_file_name_convert and they will
# generate the "set newname for datafile" syntax needed to change the
# controlfile. These parameters accommodate up to 5 different file placement
# locations using:
db_file_name_convert = ('/old/path1', '/new/path1',
'/old/path2', '/new/path2',
'/old/path3', '/new/path3')
# up to 5 locations from Oracle9i >.
log_file_name_convert = ('/old/path1', '/new/path1',
'/old/path2', '/new/path2',
'/old/path3', '/new/path3')
# up to 5 locations from Oracle9i >.
# You can also create your own "set newname for datafile" syntax for all your
# files skipping these parameters all together. You can still use the
# log_file_name_convert parameter or you can use the 'logfile' command to
# specifiy where the logs will be created and what size.
#
# Auxiliary datafile directory for this exercise:
"/database/10i/marrocha/RMAN10/oradata"
[ Create the Auxiliary init.ora ]
# the controlfile is created during duplication with the path and name given here
#
# initRMAN10.ora
db_name = RMAN10
db_block_size = 8192
compatible = 10.1.0.1.0
remote_login_passwordfile = exclusive
control_files = ('/database/10i/marrocha/RMAN10/oradata/control01.ctl',
'/database/10i/marrocha/RMAN10/oradata/control02.ctl')
db_file_name_convert = ('/database/10i/app/oracle/oradata/V10gREL5',
'/database/10i/marrocha/RMAN10/oradata')
log_file_name_convert = ('/database/10i/app/oracle/oradata/V10gREL5',
'/database/10i/marrocha/RMAN10/oradata')
# create a passwordfile for remote connections as sysdba
% orapwd password=
% sqlplus /nolog
SQL> connect / as sysdba
SQL> startup nomount pfile=$ORACLE_HOME/dbs/initRMAN10.ora
SQL> exit
[ RMAN Duplication from tape backup using the Oracle disk API ]
# This is to provide an example of simulating writing to tape using RMAN and
# the Oracle disk API. RMAN Target Configuration:
% rman
RMAN> connect target
connected to target database: V10GREL5 (DBID=2510891965)
# Use the RMAN configure command to create an optimal configuration for your
# business. the channels are configured to allocate from device type SBT by
# default. Since the channels are configured here we do not need to allocate
# any channels in the RMAN scripts.
# I/O only take place over the channel allocated. If an AUX channel is allocated
# only the auxiliary will perform IO so there is not worry about overwriting the
# target database production files. As an added safegard an error would raise if
# an attempt to overwrite a target file while it's online.
RMAN> show all;
using target database controlfile instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE 'SBT_TAPE' TO 'V10GREL5_%F';
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=oracle.disksbt,
ENV=(BACKUP_DIR=/backup/rman/tape)';
CONFIGURE MAXSETSIZE TO UNLIMITED;
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/backup/rman/snapcf_V10gREL5.f';
RMAN> exit
[ Start the Duplication ]
# set the env to the auxiliary to "startup nomount"
setenv ORACLE_SID RMAN10 # csh
or
ORACLE_SID=RMAN10 export ORACLE_SID # ksh
% sqlplus /nolog
SQL> connect / as sysdba
Connected to an idle instance
SQL> startup nomount pfile=$ORACLE_HOME/dbs/initRMAN10.ora
SQL> exit
# Set your SID back to the TARGET for duplication. The information in the target
# is used by the duplicate to fill in missing information like maxopenfiles,
# maxlogfiles and other values which are only changed when recreating the control
# file. Execute RMAN from the target home. The auxiliary should be a sqlnet
# connection.
[stsmesun1]/home/beta/marrocha> rman trace dup_rman10.log
Recovery Manager: Release 10.1.0.2.0 - Production
Copyright (c) 1995, 2003, Oracle. All rights reserved.
RMAN> connect target
connected to target database: V10GREL5 (DBID=2510891965)
RMAN> connect auxiliary sys/rman10@RMAN10
connected to auxiliary database: RMAN10 (not mounted)
RMAN> duplicate target database to RMAN10 device type sbt;
... snip from output...
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 09-DEC-03
>>>EOF<<<
To complete the process remove or comment out the db and log convert parameters.
Restart the database. Your duplicate database is ready for use.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17252115/viewspace-1063120/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN -- Frequently Asked Question (FAQ) (Doc ID 469777.1)
- How to Collect Diagnostics for Database Hanging Issues (Doc ID 452358.1)Database
- [轉帖]Release Schedule of Current Database Releases (Doc ID 742060.1)Database
- oracle10g RMAN增量備份策略Oracle
- Oracle 最新PSU (Doc ID 2118136.2)Oracle
- expdp/impdp變慢 (Doc ID 2469587.1)
- Reading and Understanding Systemstate Dumps (Doc ID 423153.1)
- Oracle 下載最新psu (Doc ID 2118136.2)Oracle
- Converting Oracle Database from Linux to Windows using RMANOracleDatabaseLinuxWindows
- RMAN restore validate database報ORA-19693RESTDatabase
- PRCT-1011 : Failed to run "oifcfg" (Doc ID 1380183.1)AI
- 使用RMAN複製資料庫 active database資料庫Database
- 【CURSOR】How to Monitor and tune Open and Cached Cursors (Doc ID 1430255.1)
- HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another NoRESTDatabase
- 理解RMAN backup database plus archivelog delete all input命令DatabaseHivedelete
- Migration Of An Oracle Database Across OS Platforms [ID 733205.1]OracleDatabaseROSPlatform
- rfs (PID:146054): Database mount ID mismatch案例Database
- Physical Standby Switchover_status Showing Not Allowed. (Doc ID 1392763.1)
- oracle11g: Scheduler Maintenance Tasks or Autotasks (Doc ID 756734.1)OracleAINaN
- 【DBA】Relinking Oracle Home 常見問題 (Doc ID 2048232.1)Oracle
- How To Replicate Data from Oracle to Postgres Using GoldenGate (Doc ID 1544137.1OracleGo
- 11g-Reduce Transportable Tablespace Downtime using XTTS (Doc ID 1389592.1)TTS
- 透過RMAN備份standby database成功恢復還原Database
- Can GoldenGate Replicate An Oracle Table That Contains Only CLOB Column(s)? (Doc ID 971833.1)GoOracleAI
- 12c DG新特性 - Active Data Guard Far Sync (Doc ID 2179719.1)
- 【GRID】Grid Infrastructure 啟動的五大問題 (Doc ID 1526147.1)ASTStruct
- 【DATAGUARD】Data Guard 12C 新特性:Far Sync Standby (Doc ID 2179719.1)
- RMAN restore fails with ORA-01180: can not create datafile 1 (文件 ID 1265151.1)RESTAI
- ORA-04063: package body SYS.DBMS_REGISTRY_SYS has errors (Doc ID 2165402.1)PackageError
- rman duplicate建立異地auxiliary Database oracle_11g oracle_sid不同UXDatabaseOracle
- rman duplicate建立異地auxiliary Database oracle_11g oracle_sid相同UXDatabaseOracle
- 【ASM】ORA-27504 ORA-27300 ORA-27303 while starting ASM (Doc ID 2281441.1)ASMWhile
- 【RAC】Oracle 12c以及以上版本的diagsnap是什麼? (Doc ID 2469643.1)Oracle
- sqlserver docSQLServer
- oracle10g審計(轉)Oracle
- about oracle10g rac(轉)Oracle
- 【RMAN】RMAN備份至ASMASM
- Oracle 11G RAC複製備庫RMAN-03002 RMAN-05501 RMAN-03015 RMAN-03009 RMAN-10038Oracle
- 【RMAN】RMAN的備份保留策略