Assume:
ORACLE_HOME=/oracle/product/10.1.0/db/
TARGET DB=db
AUX DB=dupdb
Begin..... Duplicate until time '2008-01-22:09:00:00'
1. Create password file.
$orapwd file=/oracle/product/10.1.0/db/dbs/orapwdupdb password=password
2. Create init file (initdupdb.ora) on /oracle/product/10.1.0/db/dbs/ PATH
compatible=10.1.0.2.0
control_files=("/oradata/dbfile1/dupdb/control01.ctl")
core_dump_dest=/oracle/admin/dupdb/cdump
db_block_size=8192
db_cache_size=25165824
db_domain=""
db_name=dupdb
java_pool_size=5033164
job_queue_processes=10
large_pool_size=838860
open_cursors=50
pga_aggregate_target=12516582
processes=30
remote_login_passwordfile=exclusive
sga_max_size=1G
sga_target=1G
shared_pool_size=59961472
sort_area_size=65536
undo_management=AUTO
user_dump_dest=/oracle/admin/dupdb/udump
3. create folders
/oracle/admin/dupdb/udump
/oracle/admin/dupdb/cdump
/oracle/admin/dupdb/bdump
4. create rman script
run {
allocate auxiliary channel t1 type 'SBT_TAPE';
SEND 'NB_ORA_SERV=backupserver,NB_ORA_CLIENT=db_host,NB_ORA_POLICY=XXXXX';
set until time = '2008-01-22:09:00:00';
CONFIGURE AUXNAME FOR DATAFILE 1 TO '/oradata/dbfile1/dupdb/system01.dbf';
CONFIGURE AUXNAME FOR DATAFILE 3 TO '/oradata/dbfile1/dupdb/sysaux01.dbf';
CONFIGURE AUXNAME FOR DATAFILE 6 TO '/oradata/dbfile1/dupdb/bb_xxx01.dbf';
CONFIGURE AUXNAME FOR DATAFILE 7 TO '/oradata/dbfile1/dupdb/bb_xxx_indx01.dbf';
CONFIGURE AUXNAME FOR DATAFILE 36 TO '/oradata/dbfile1/dupdb/bb_xxx02.dbf';
DUPLICATE TARGET DATABASE TO dupdb
SKIP TABLESPACE IM_AVATAR_TEST,...,UNDOTBS1,UNDOTBS2
LOGFILE
GROUP 1 ('/oradata/dbfile1/dupdb/redo01a.log',
'/oradata/dbfile1/dupdb/redo01b.log') SIZE 20M,
GROUP 2 ('/oradata/dbfile1/dupdb/redo02a.log',
'/oradata/dbfile1/dupdb/redo02b.log') SIZE 20M;
}
5. modify tnsnames.ora file.
DB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = db_host)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = db)
)
)
6. run script
$export NLS_LANG=american
$export NLS_DATE_FORMAT=YYYY-MM-DD:HH24:MI:SS
$export ORACLE_SID=dupdb
$ rman target sys/password@db catalog rman/pass@catalog AUXILIARY / @fileman-script
7. create temp tablespace
create temporary tablespace temp2 tempfile '/oradata/dbfile1/dupdb/temp01.dbf' size 50M;
alter database default temporary tablespace temp;
Wow, It's FUN.....
Tuesday, January 29, 2008
Subscribe to:
Post Comments (Atom)
1 comment:
Hi Surachart,
Getting the following error while trying to execute the script.
Script :
rman target sys/ent@ent17san.world catalog rman/rman@oemrep.san AUXILIARY / @rm.txt
Error :
36> GROUP 1 ('c:\oradb\db2\log\redo01.log') SIZE 200k REUSE,
37> GROUP 2 ('c:\oradb\db2\log\redo02.log') SIZE 200k REUSE,
38> GROUP 3 ('c:\oradb\db2\log\redo03.log') SIZE 200k REUSE;
39> }
40>
41>
allocated channel: t1
channel t1: sid=12 devtype=DISK
executing command: SET until clause
released channel: t1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of set command at 05/01/2008 15:56:54
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20011: target database incarnation is not current in recov
ery catalog
Recovery Manager complete.
C:\>
Could you please help ?
Regards
Sanal Panicker
Sanal.Panicker@communitynews.com.au
Post a Comment