打算做一个Oracle索引的专题技术笔记,因为今天帮我一个深圳的朋友做过rman的测试,在 恢复我原始数据的时候,发现存在ORA-XXXXX错误,测试结果如下:
run {
allocate channel ch1 type disk;
allocate channel ch2 type disk;
allocate channel ch3 type disk;
allocate channel ch4 type disk;
allocate channel ch5 type disk;
allocate channel ch6 type disk;
restore database;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
release channel ch5;
release channel ch6;
}
备份过程:
oracle@oracle-one ~]$ exit
exit
host command complete
RMAN> backup database plus archivelog delete input;
Starting backup at 13-JAN-14
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=32 RECID=38 STAMP=835887568
input archived log thread=1 sequence=33 RECID=43 STAMP=835983664
input archived log thread=1 sequence=34 RECID=41 STAMP=835983651
input archived log thread=1 sequence=35 RECID=42 STAMP=835983661
channel ORA_DISK_1: starting piece 1 at 13-JAN-14
channel ORA_DISK_1: finished piece 1 at 13-JAN-14
piece handle=+DATAGROUP1/rhys/backupset/2014_01_13/annnf0_tag20140113t100050_0.302.836733655 tag=TAG20140113T100050 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: deleting archived log(s)
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_03/thread_1_seq_32.312.835887567 RECID=38 STAMP=835887568
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_04/thread_1_seq_33.310.835983663 RECID=43 STAMP=835983664
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_04/thread_1_seq_34.282.835983651 RECID=41 STAMP=835983651
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_04/thread_1_seq_35.297.835983653 RECID=42 STAMP=835983661
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=44 STAMP=836132585
input archived log thread=1 sequence=2 RECID=45 STAMP=836165566
input archived log thread=1 sequence=3 RECID=46 STAMP=836176676
input archived log thread=1 sequence=4 RECID=47 STAMP=836178950
input archived log thread=1 sequence=5 RECID=48 STAMP=836232017
input archived log thread=1 sequence=6 RECID=49 STAMP=836234531
input archived log thread=1 sequence=7 RECID=50 STAMP=836237972
input archived log thread=1 sequence=8 RECID=51 STAMP=836256318
input archived log thread=1 sequence=9 RECID=52 STAMP=836299719
input archived log thread=1 sequence=10 RECID=53 STAMP=836337512
input archived log thread=1 sequence=11 RECID=54 STAMP=836494626
input archived log thread=1 sequence=12 RECID=55 STAMP=836498150
input archived log thread=1 sequence=13 RECID=56 STAMP=836731893
input archived log thread=1 sequence=14 RECID=57 STAMP=836733316
input archived log thread=1 sequence=15 RECID=58 STAMP=836733649
channel ORA_DISK_1: starting piece 1 at 13-JAN-14
channel ORA_DISK_1: finished piece 1 at 13-JAN-14
piece handle=+DATAGROUP1/rhys/backupset/2014_01_13/annnf0_tag20140113t100050_0.297.836733683 tag=TAG20140113T100050 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: deleting archived log(s)
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_06/thread_1_seq_1.313.836132583 RECID=44 STAMP=836132585
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_06/thread_1_seq_2.314.836165563 RECID=45 STAMP=836165566
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_06/thread_1_seq_3.315.836176677 RECID=46 STAMP=836176676
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_06/thread_1_seq_4.273.836178949 RECID=47 STAMP=836178950
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_07/thread_1_seq_5.280.836232005 RECID=48 STAMP=836232017
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_07/thread_1_seq_6.278.836234531 RECID=49 STAMP=836234531
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_07/thread_1_seq_7.277.836237959 RECID=50 STAMP=836237972
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_07/thread_1_seq_8.272.836256311 RECID=51 STAMP=836256318
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_08/thread_1_seq_9.271.836299715 RECID=52 STAMP=836299719
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_08/thread_1_seq_10.308.836337507 RECID=53 STAMP=836337512
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_10/thread_1_seq_11.307.836494623 RECID=54 STAMP=836494626
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_10/thread_1_seq_12.306.836498149 RECID=55 STAMP=836498150
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_13.304.836731889 RECID=56 STAMP=836731893
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_14.305.836733317 RECID=57 STAMP=836733316
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_15.303.836733649 RECID=58 STAMP=836733649
Finished backup at 13-JAN-14
Starting backup at 13-JAN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATAGROUP1/rhys/datafile/system.257.833999503
input datafile file number=00002 name=+DATAGROUP1/rhys/datafile/sysaux.256.833999647
input datafile file number=00006 name=+DATAGROUP1/rhys/datafile/rhys.309.835132099
input datafile file number=00004 name=+DATAGROUP1/rhys/datafile/users.261.833999767
input datafile file number=00003 name=+DATAGROUP1/rhys/datafile/undotbs1.260.833999753
input datafile file number=00005 name=+DATAGROUP1/rhys/datafile/test.dbf
channel ORA_DISK_1: starting piece 1 at 13-JAN-14
channel ORA_DISK_1: finished piece 1 at 13-JAN-14
piece handle=+DATAGROUP1/rhys/backupset/2014_01_13/nnndf0_tag20140113t100212_0.303.836733737 tag=TAG20140113T100212 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:06:26
Finished backup at 13-JAN-14
Starting backup at 13-JAN-14
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=16 RECID=59 STAMP=836734121
channel ORA_DISK_1: starting piece 1 at 13-JAN-14
channel ORA_DISK_1: finished piece 1 at 13-JAN-14
piece handle=+DATAGROUP1/rhys/backupset/2014_01_13/annnf0_tag20140113t100843_0.274.836734125 tag=TAG20140113T100843 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: deleting archived log(s)
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_16.276.836734121 RECID=59 STAMP=836734121
Finished backup at 13-JAN-14
Starting Control File and SPFILE Autobackup at 13-JAN-14
piece handle=+DATAGROUP1/rhys/autobackup/2014_01_13/s_836734128.276.836734133 comment=NONE
Finished Control File and SPFILE Autobackup at 13-JAN-14
RMAN> exit
Recovery Manager complete.
恢复过程:
[oracle@oracle-one ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Jan 13 20:41:18 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: RHYS (DBID=2745484551, not open)
RMAN> run {
2> allocate channel ch1 type disk;
allocate channel ch2 type disk;
3> 4> allocate channel ch3 type disk;
5> allocate channel ch4 type disk;
6> allocate channel ch5 type disk;
7> allocate channel ch6 type disk;
8> restore database;
9> release channel ch1;
10> release channel ch2;
11> release channel ch3;
12> release channel ch4;
13> release channel ch5;
14> release channel ch6;
15> }
using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: SID=30 device type=DISK
allocated channel: ch2
channel ch2: SID=29 device type=DISK
allocated channel: ch3
channel ch3: SID=21 device type=DISK
allocated channel: ch4
channel ch4: SID=28 device type=DISK
allocated channel: ch5
channel ch5: SID=24 device type=DISK
allocated channel: ch6
channel ch6: SID=23 device type=DISK
Starting restore at 13-JAN-14
channel ch1: restoring datafile 00001
input datafile copy RECID=9 STAMP=836771958 file name=+DATAGROUP1/rhys/datafile/system.311.836735137
destination for restore of datafile 00001: +DATAGROUP1/rhys/datafile/system.257.833999503
channel ch2: starting datafile backup set restore
channel ch2: specifying datafile(s) to restore from backup set
channel ch2: restoring datafile 00004 to +DATAGROUP1/rhys/datafile/users.283.836771979
channel ch2: restoring datafile 00005 to +DATAGROUP1/rhys/datafile/test.dbf
channel ch2: restoring datafile 00006 to +DATAGROUP1/rhys/datafile/rhys.304.836771979
channel ch2: reading from backup piece +DATAGROUP1/rhys/backupset/2014_01_13/nnndf0_tag20140113t100212_0.303.836733737
channel ch3: restoring datafile 00002
input datafile copy RECID=10 STAMP=836771958 file name=+DATAGROUP1/rhys/datafile/sysaux.279.836735137
destination for restore of datafile 00002: +DATAGROUP1/rhys/datafile/sysaux.256.833999647
channel ch4: restoring datafile 00003
input datafile copy RECID=11 STAMP=836771958 file name=+DATAGROUP1/rhys/datafile/undotbs1.257.836735137
destination for restore of datafile 00003: +DATAGROUP1/rhys/datafile/undotbs1.308.836771963
ORA-19505: failed to identify file "+DATAGROUP1/rhys/datafile/system.311.836735137"
ORA-17503: ksfdopn:2 Failed to open file +DATAGROUP1/rhys/datafile/system.311.836735137
ORA-15012: ASM file '+DATAGROUP1/rhys/datafile/system.311.836735137' does not exist
ORA-19600: input file is datafile-copy 9 (+DATAGROUP1/rhys/datafile/system.311.836735137)
ORA-19601: output file is datafile 1 (+DATAGROUP1)
ORA-19505: failed to identify file "+DATAGROUP1/rhys/datafile/sysaux.279.836735137"
ORA-17503: ksfdopn:2 Failed to open file +DATAGROUP1/rhys/datafile/sysaux.279.836735137
ORA-15012: ASM file '+DATAGROUP1/rhys/datafile/sysaux.279.836735137' does not exist
ORA-19600: input file is datafile-copy 10 (+DATAGROUP1/rhys/datafile/sysaux.279.836735137)
ORA-19601: output file is datafile 2 (+DATAGROUP1)
ORA-19505: failed to identify file "+DATAGROUP1/rhys/datafile/undotbs1.257.836735137"
ORA-17503: ksfdopn:2 Failed to open file +DATAGROUP1/rhys/datafile/undotbs1.257.836735137
ORA-15012: ASM file '+DATAGROUP1/rhys/datafile/undotbs1.257.836735137' does not exist
ORA-19600: input file is datafile-copy 11 (+DATAGROUP1/rhys/datafile/undotbs1.257.836735137)
ORA-19601: output file is datafile 3 (+DATAGROUP1)
channel ch2: piece handle=+DATAGROUP1/rhys/backupset/2014_01_13/nnndf0_tag20140113t100212_0.303.836733737 tag=TAG20140113T100212
channel ch2: restored backup piece 1
channel ch2: restore complete, elapsed time: 00:00:35
failover to previous backup
channel ch1: starting datafile backup set restore
channel ch1: specifying datafile(s) to restore from backup set
channel ch1: restoring datafile 00001 to +DATAGROUP1/rhys/datafile/system.257.833999503
channel ch1: restoring datafile 00002 to +DATAGROUP1/rhys/datafile/sysaux.256.833999647
channel ch1: restoring datafile 00003 to +DATAGROUP1/rhys/datafile/undotbs1.308.836771963
channel ch1: reading from backup piece +DATAGROUP1/rhys/backupset/2014_01_13/nnndf0_tag20140113t100212_0.303.836733737
channel ch1: piece handle=+DATAGROUP1/rhys/backupset/2014_01_13/nnndf0_tag20140113t100212_0.303.836733737 tag=TAG20140113T100212
channel ch1: restored backup piece 1
channel ch1: restore complete, elapsed time: 00:03:25
Finished restore at 13-JAN-14
released channel: ch1
released channel: ch2
released channel: ch3
released channel: ch4
released channel: ch5
released channel: ch6
RMAN>
RMAN>
RMAN>
RMAN>
RMAN> recover database;
Starting recover at 13-JAN-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=30 device type=DISK
starting media recovery
archived log for thread 1 with sequence 16 is already on disk as file +DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_16.275.836735655
archived log for thread 1 with sequence 17 is already on disk as file +DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_17.260.836735657
archived log for thread 1 with sequence 18 is already on disk as file +DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_18.261.836735659
archived log for thread 1 with sequence 1 is already on disk as file +DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_1.305.836751051
archived log for thread 1 with sequence 2 is already on disk as file +DATAGROUP1/rhys/onlinelog/group_2.286.833999961
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_16.275.836735655 thread=1 sequence=16
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_17.260.836735657 thread=1 sequence=17
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_18.261.836735659 thread=1 sequence=18
archived log file name=+DATAGROUP1/rhys/archivelog/2014_01_13/thread_1_seq_1.305.836751051 thread=1 sequence=1
archived log file name=+DATAGROUP1/rhys/onlinelog/group_2.286.833999961 thread=1 sequence=2
media recovery complete, elapsed time: 00:00:59
Finished recover at 13-JAN-14
RMAN> exit
Recovery Manager complete.
[oracle@oracle-one ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Jan 13 20:48:36 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing 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>
总结:在11G新版本中增加了对原始数据文件的验证过程。