|
做实验时,在bcpserver虚拟机的以下目录建选黑的文件:
文件内容:
- 192.168.0.11 192.168.0.4 192.168.0.8 192.168.0.10 192.168.0.87
复制代码 对自己的环境执行实验破坏,命令是:
- [root@station90 ~]# bcl --O11g05 6b
复制代码
删除表空间的恢复,如果不把控制文件restore,只是做了时间点恢复,必然出现uname000X的错误:
- RMAN> run {
- 2> sql "alter session set nls_Date_format=''YYYY-MM-DD:HH24:MI:SS''";
- 3> set until time '2018-05-19:19:44:46';
- 4> restore database;
- 5> recover database;
- 6> }
- using target database control file instead of recovery catalog
- sql statement: alter session set nls_Date_format=''YYYY-MM-DD:HH24:MI:SS''
- executing command: SET until clause
- Starting restore at 19-MAY-18
- allocated channel: ORA_DISK_1
- channel ORA_DISK_1: SID=137 device type=DISK
- allocated channel: ORA_DISK_2
- channel ORA_DISK_2: SID=12 device type=DISK
- allocated channel: ORA_DISK_3
- channel ORA_DISK_3: SID=140 device type=DISK
- allocated channel: ORA_DISK_4
- channel ORA_DISK_4: SID=13 device type=DISK
- allocated channel: ORA_DISK_5
- channel ORA_DISK_5: SID=141 device type=DISK
- allocated channel: ORA_DISK_6
- channel ORA_DISK_6: SID=14 device type=DISK
- allocated channel: ORA_DISK_7
- channel ORA_DISK_7: SID=142 device type=DISK
- allocated channel: ORA_DISK_8
- channel ORA_DISK_8: SID=15 device type=DISK
- flashing back control file to SCN 1115587
- RMAN-00571: ===========================================================
- RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
- RMAN-00571: ===========================================================
- RMAN-03002: failure of restore command at 05/19/2018 19:53:33
- RMAN-06085: must use SET NEWNAME command to restore datafile /u01/app/oracle/product/11.2.0/dbhome_1/dbs/UNNAMED00004
复制代码 restore point 以及它在数据库化身时间轴上的应用:
- select * from v$flashback_database_stat;
- select * from v$restore_point;
- create restore point rsp1;
复制代码- [root@station90 ~]# ssh station87
- Last login: Sat May 19 23:30:16 2018 from station90.example.com
- [root@station87 ~]# su - oracle
- [oracle@station87 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Sat May 19 23:55:54 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> exit
- [oracle@station87 ~]$ rman target /
- Recovery Manager: Release 11.2.0.1.0 - Production on Sat May 19 23:56:02 2018
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: ORCL (DBID=1359978017)
- RMAN> list incarnation of database;
- using target database control file instead of recovery catalog
- List of Database Incarnations
- DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
- ------- ------- -------- ---------------- --- ---------- ----------
- 1 1 ORCL 1359978017 PARENT 1 13-AUG-09
- 2 2 ORCL 1359978017 PARENT 754488 22-NOV-13
- 3 3 ORCL 1359978017 PARENT 1108732 19-MAY-18
- 4 4 ORCL 1359978017 PARENT 1121631 19-MAY-18
- 5 5 ORCL 1359978017 ORPHAN 1144059 19-MAY-18
- 6 6 ORCL 1359978017 CURRENT 1144059 19-MAY-18
- RMAN> shutdown abort
- Oracle instance shut down
- RMAN> startup mount
- connected to target database (not started)
- Oracle instance started
- database mounted
- Total System Global Area 820236288 bytes
- Fixed Size 1339628 bytes
- Variable Size 587206420 bytes
- Database Buffers 226492416 bytes
- Redo Buffers 5197824 bytes
- RMAN> exit
- Recovery Manager complete.
- [oracle@station87 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Sat May 19 23:57:20 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> flashback database to restore point rsp1;
- SP2-0640: Not connected
- SQL> conn / as sysdba
- Connected.
- SQL> flashback database to restore point rsp1;
- Flashback complete.
- SQL> alter database open resetlogs;
- Database altered.
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
- With the Partitioning, Automatic Storage Management, OLAP, Data Mining
- and Real Application Testing options
- [oracle@station87 ~]$ rman target /
- Recovery Manager: Release 11.2.0.1.0 - Production on Sat May 19 23:58:17 2018
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: ORCL (DBID=1359978017)
- RMAN> list incarnation of database;
- using target database control file instead of recovery catalog
- List of Database Incarnations
- DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
- ------- ------- -------- ---------------- --- ---------- ----------
- 1 1 ORCL 1359978017 PARENT 1 13-AUG-09
- 2 2 ORCL 1359978017 PARENT 754488 22-NOV-13
- 3 3 ORCL 1359978017 PARENT 1108732 19-MAY-18
- 4 4 ORCL 1359978017 PARENT 1121631 19-MAY-18
- 5 5 ORCL 1359978017 ORPHAN 1144059 19-MAY-18
- 6 6 ORCL 1359978017 PARENT 1144059 19-MAY-18
- 7 7 ORCL 1359978017 CURRENT 1144593 19-MAY-18
- RMAN> exit
- Recovery Manager complete.
- [oracle@station87 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Sat May 19 23:59:21 2018
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> alter database flashback off;
- Database altered.
- SQL> shutdown abort
- ORACLE instance shut down.
- SQL> startup mount
- ORACLE instance started.
- Total System Global Area 820236288 bytes
- Fixed Size 1339628 bytes
- Variable Size 587206420 bytes
- Database Buffers 226492416 bytes
- Redo Buffers 5197824 bytes
- Database mounted.
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
- With the Partitioning, Automatic Storage Management, OLAP, Data Mining
- and Real Application Testing options
- [oracle@station87 ~]$ rman target /
- Recovery Manager: Release 11.2.0.1.0 - Production on Sun May 20 00:00:38 2018
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: ORCL (DBID=1359978017, not open)
- RMAN> run {
- 2> set until restore point rsp1;
- 3> restore database;
- 4> recover database;
- 5> }
- executing command: SET until clause
- Starting restore at 20-MAY-18
- using target database control file instead of recovery catalog
- RMAN-00571: ===========================================================
- RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
- RMAN-00571: ===========================================================
- RMAN-03002: failure of restore command at 05/20/2018 00:01:01
- RMAN-20208: UNTIL CHANGE is before RESETLOGS change
- RMAN> list incarnation of database;
- List of Database Incarnations
- DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
- ------- ------- -------- ---------------- --- ---------- ----------
- 1 1 ORCL 1359978017 PARENT 1 13-AUG-09
- 2 2 ORCL 1359978017 PARENT 754488 22-NOV-13
- 3 3 ORCL 1359978017 PARENT 1108732 19-MAY-18
- 4 4 ORCL 1359978017 PARENT 1121631 19-MAY-18
- 5 5 ORCL 1359978017 ORPHAN 1144059 19-MAY-18
- 6 6 ORCL 1359978017 PARENT 1144059 19-MAY-18
- 7 7 ORCL 1359978017 CURRENT 1144593 19-MAY-18
- RMAN> reset database to incarnation 6;
- database reset to incarnation 6
- RMAN> list incarnation of database;
- List of Database Incarnations
- DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
- ------- ------- -------- ---------------- --- ---------- ----------
- 1 1 ORCL 1359978017 PARENT 1 13-AUG-09
- 2 2 ORCL 1359978017 PARENT 754488 22-NOV-13
- 3 3 ORCL 1359978017 PARENT 1108732 19-MAY-18
- 4 4 ORCL 1359978017 PARENT 1121631 19-MAY-18
- 5 5 ORCL 1359978017 ORPHAN 1144059 19-MAY-18
- 6 6 ORCL 1359978017 CURRENT 1144059 19-MAY-18
- 7 7 ORCL 1359978017 ORPHAN 1144593 19-MAY-18
- RMAN> run {
- 2> set until restore point rsp1;
- 3> restore database;
- 4> recover database;
- 5> }
- executing command: SET until clause
- Starting restore at 20-MAY-18
- allocated channel: ORA_DISK_1
- channel ORA_DISK_1: SID=14 device type=DISK
- allocated channel: ORA_DISK_2
- channel ORA_DISK_2: SID=136 device type=DISK
- allocated channel: ORA_DISK_3
- channel ORA_DISK_3: SID=15 device type=DISK
- allocated channel: ORA_DISK_4
- channel ORA_DISK_4: SID=137 device type=DISK
- allocated channel: ORA_DISK_5
- channel ORA_DISK_5: SID=16 device type=DISK
- allocated channel: ORA_DISK_6
- channel ORA_DISK_6: SID=138 device type=DISK
- allocated channel: ORA_DISK_7
- channel ORA_DISK_7: SID=17 device type=DISK
- allocated channel: ORA_DISK_8
- channel ORA_DISK_8: SID=139 device type=DISK
- channel ORA_DISK_1: starting datafile backup set restore
- channel ORA_DISK_1: specifying datafile(s) to restore from backup set
- channel ORA_DISK_1: restoring datafile 00003 to +DATA/orcl/datafile/undotbs1.259.976558179
- channel ORA_DISK_1: reading from backup piece +FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.301.976561875
- channel ORA_DISK_2: starting datafile backup set restore
- channel ORA_DISK_2: specifying datafile(s) to restore from backup set
- channel ORA_DISK_2: restoring datafile 00004 to +DATA/orcl/datafile/users.265.976575785
- channel ORA_DISK_2: reading from backup piece +FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.298.976561883
- channel ORA_DISK_3: starting datafile backup set restore
- channel ORA_DISK_3: specifying datafile(s) to restore from backup set
- channel ORA_DISK_3: restoring datafile 00005 to +DATA/orcl/datafile/example.257.976558179
- channel ORA_DISK_3: reading from backup piece +FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.299.976561877
- channel ORA_DISK_4: starting datafile backup set restore
- channel ORA_DISK_4: specifying datafile(s) to restore from backup set
- channel ORA_DISK_4: restoring datafile 00002 to +DATA/orcl/datafile/sysaux.258.976558179
- channel ORA_DISK_4: reading from backup piece +FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.302.976561873
- channel ORA_DISK_5: starting datafile backup set restore
- channel ORA_DISK_5: specifying datafile(s) to restore from backup set
- channel ORA_DISK_5: restoring datafile 00001 to +DATA/orcl/datafile/system.256.976558181
- channel ORA_DISK_5: reading from backup piece +FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.300.976561871
- channel ORA_DISK_2: piece handle=+FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.298.976561883 tag=TAG20180519T191110
- channel ORA_DISK_2: restored backup piece 1
- channel ORA_DISK_2: restore complete, elapsed time: 00:00:03
- channel ORA_DISK_3: piece handle=+FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.299.976561877 tag=TAG20180519T191110
- channel ORA_DISK_3: restored backup piece 1
- channel ORA_DISK_3: restore complete, elapsed time: 00:00:37
- channel ORA_DISK_1: piece handle=+FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.301.976561875 tag=TAG20180519T191110
- channel ORA_DISK_1: restored backup piece 1
- channel ORA_DISK_1: restore complete, elapsed time: 00:00:47
- channel ORA_DISK_4: piece handle=+FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.302.976561873 tag=TAG20180519T191110
- channel ORA_DISK_4: restored backup piece 1
- channel ORA_DISK_4: restore complete, elapsed time: 00:01:37
- channel ORA_DISK_5: piece handle=+FRA/orcl/backupset/2018_05_19/nnndf0_tag20180519t191110_0.300.976561871 tag=TAG20180519T191110
- channel ORA_DISK_5: restored backup piece 1
- channel ORA_DISK_5: restore complete, elapsed time: 00:01:56
- Finished restore at 20-MAY-18
- Starting recover at 20-MAY-18
- using channel ORA_DISK_1
- using channel ORA_DISK_2
- using channel ORA_DISK_3
- using channel ORA_DISK_4
- using channel ORA_DISK_5
- using channel ORA_DISK_6
- using channel ORA_DISK_7
- using channel ORA_DISK_8
- starting media recovery
- archived log for thread 1 with sequence 1 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_1.285.976563839
- archived log for thread 1 with sequence 2 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_2.284.976563839
- archived log for thread 1 with sequence 3 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_3.282.976563839
- archived log for thread 1 with sequence 4 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_4.281.976563843
- archived log for thread 1 with sequence 5 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_5.280.976563845
- archived log for thread 1 with sequence 6 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_6.277.976575919
- archived log for thread 1 with sequence 7 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_7.275.976575917
- archived log for thread 1 with sequence 1 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_1.283.976577949
- archived log for thread 1 with sequence 2 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_2.308.976577967
- archived log for thread 1 with sequence 3 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_3.307.976577967
- archived log for thread 1 with sequence 4 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_4.306.976577971
- archived log for thread 1 with sequence 1 is already on disk as file +FRA/orcl/archivelog/2018_05_19/thread_1_seq_1.269.976579079
- archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_1.285.976563839 thread=1 sequence=1
- archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_2.284.976563839 thread=1 sequence=2
- archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_3.282.976563839 thread=1 sequence=3
- archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_4.281.976563843 thread=1 sequence=4
- archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_5.280.976563845 thread=1 sequence=5
- archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_6.277.976575919 thread=1 sequence=6
- archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_7.275.976575917 thread=1 sequence=7
- archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_1.283.976577949 thread=1 sequence=1
- archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_2.308.976577967 thread=1 sequence=2
- archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_3.307.976577967 thread=1 sequence=3
- archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_4.306.976577971 thread=1 sequence=4
- archived log file name=+FRA/orcl/archivelog/2018_05_19/thread_1_seq_1.269.976579079 thread=1 sequence=1
- media recovery complete, elapsed time: 00:00:05
- Finished recover at 20-MAY-18
- RMAN> alter database open resetlogs;
- database opened
- RMAN>
复制代码 保障闪回还原点:
- select * from v$flashback_database_stat;
- select * from v$restore_point;
- create restore point rsp1;
- create restore point rsp2 guarantee flashback database;
- select * from v$restore_point;
复制代码
|
|