10g duplicate .快速的恢復與建立備份資料庫

jidongzheng發表於2009-03-30

測試環境: 2 臺 linux (192.168.1.4,192.168.1.5) ,

oracle 10.2.0.3

1.備份主庫.

swithc logfile

backup full database;

2. 建立一個空的備庫.

dbca

3.配置tnanames.ora

使得主庫可以rman到從庫.

4. 將主庫的備份檔案傳到備庫相同目錄.

5.啟動備庫到 nomount狀態下.

6.透過主庫複製備庫.

7.開啟備庫.有條件的使用resetlogs

.以下是整個操作的日誌.

[@more@]

backup full database;

dbca.

/-----------------------------------------------------------------------------------------------------------------------------/

RMAN> duplicate target database to orcl5 nofilenamecheck;

Starting Duplicate Db at 20090328054815
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=155 devtype=DISK

contents of Memory Script:
{
set until scn 472272998;
set newname for datafile 1 to
"/dbHome/orcl/system01.dbf";
set newname for datafile 2 to
"/dbHome/orcl/undotbs01.dbf";
set newname for datafile 3 to
"/dbHome/orcl/sysaux01.dbf";
set newname for datafile 4 to
"/dbHome/orcl/users01.dbf";
set newname for datafile 5 to
"/dbHome/orcl/testtbs01.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 20090328054816
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 /dbHome/orcl/system01.dbf
restoring datafile 00002 to /dbHome/orcl/undotbs01.dbf
restoring datafile 00003 to /dbHome/orcl/sysaux01.dbf
restoring datafile 00004 to /dbHome/orcl/users01.dbf
restoring datafile 00005 to /dbHome/orcl/testtbs01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /dbHome/05karmo0682482432.bak
ORA-19870: error reading backup piece /dbHome/05karmo0682482432.bak
ORA-19505: failed to identify file "/dbHome/05karmo0682482432.bak"
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
failover to previous backup

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/28/2009 17:48:18
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore

/-----------------------------------------------------------------------------------------------------------------------------/
RMAN> duplicate target database to orcl5 nofilenamecheck;

Starting Duplicate Db at 20090328055337
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK

contents of Memory Script:
{
set until scn 472272998;
set newname for datafile 1 to
"/dbHome/orcl/system01.dbf";
set newname for datafile 2 to
"/dbHome/orcl/undotbs01.dbf";
set newname for datafile 3 to
"/dbHome/orcl/sysaux01.dbf";
set newname for datafile 4 to
"/dbHome/orcl/users01.dbf";
set newname for datafile 5 to
"/dbHome/orcl/testtbs01.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 20090328055338
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 /dbHome/orcl/system01.dbf
restoring datafile 00002 to /dbHome/orcl/undotbs01.dbf
restoring datafile 00003 to /dbHome/orcl/sysaux01.dbf
restoring datafile 00004 to /dbHome/orcl/users01.dbf
restoring datafile 00005 to /dbHome/orcl/testtbs01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /dbHome/05karmo0682482432.bak
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/dbHome/05karmo0682482432.bak tag=TAG20090326T022712
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:02:17
Finished restore at 20090328055535
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORCL5" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/dbHome/orcl/redo01.log' ) SIZE 50 M REUSE,
GROUP 2 ( '/dbHome/orcl/redo02.log' ) SIZE 50 M REUSE,
GROUP 3 ( '/dbHome/orcl/redo03.log' ) SIZE 50 M REUSE
DATAFILE
'/dbHome/orcl/system01.dbf'
CHARACTER SET ZHS16GBK


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=682710869 filename=/dbHome/orcl/undotbs01.dbf
datafile 3 switched to datafile copy
input datafile copy recid=2 stamp=682710869 filename=/dbHome/orcl/sysaux01.dbf
datafile 4 switched to datafile copy
input datafile copy recid=3 stamp=682710869 filename=/dbHome/orcl/users01.dbf
datafile 5 switched to datafile copy
input datafile copy recid=4 stamp=682710869 filename=/dbHome/orcl/testtbs01.dbf

contents of Memory Script:
{
set until scn 472272998;
recover
clone database
delete archivelog
;
}
executing Memory Script

executing command: SET until clause

Starting recover at 20090328055540
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=156 devtype=DISK

starting media recovery

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 03/28/2009 17:55:42
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 82 lowscn 472250467 found to restore
RMAN-06025: no backup of log thread 1 seq 81 lowscn 472230041 found to restore
RMAN-06025: no backup of log thread 1 seq 80 lowscn 472224080 found to restore

/-----------------------------------------------------------------------------------------------------------------------------/
[oracle@oradb dbHome]$ sqlplus "sys/sysdba as sysdba"

SQL*Plus: Release 10.2.0.3.0 - Production on ÐÇÆÚÁù 3ÔÂ 28 17:55:37 2009

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> alter database open resetlogs;

Database altered.

SQL>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/197458/viewspace-1019575/,如需轉載,請註明出處,否則將追究法律責任。

相關文章