|
课程第27次(2016-05-27星期五):闪回数据库和不完全恢复的对比:
磁带机列出备份:
5号实验的恢复过程:
- [root@station90 桌面]# su - orace
- su: 用户orace 不存在
- [root@station90 桌面]# su - oracle
- [oracle@station90 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Fri May 27 20:33:35 2016
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn hr/oracle_4U
- ERROR:
- ORA-28002: the password will expire within 7 days
- Connected.
- SQL> select * from hr.t806;
- select * from hr.t806
- *
- ERROR at line 1:
- ORA-00942: table or view does not exist
- SQL> conn / as sysdba
- Connected.
- SQL> select open_mode from v$database;
- OPEN_MODE
- --------------------
- READ WRITE
- SQL> shutdown abort
- ORACLE instance shut down.
- SQL> startup mount
- ORACLE instance started.
- Total System Global Area 6680915968 bytes
- Fixed Size 2213936 bytes
- Variable Size 3556771792 bytes
- Database Buffers 3087007744 bytes
- Redo Buffers 34922496 bytes
- Database mounted.
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
- With the Partitioning, Automatic Storage Management, OLAP, Data Mining
- and Real Application Testing options
- [oracle@station90 ~]$ rman target /
- Recovery Manager: Release 11.2.0.1.0 - Production on Fri May 27 20:36:06 2016
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: ORCL (DBID=1343950367, not open)
- RMAN> run {
- 2> sql "alter session set nls_date_format=''YYYY-MM-DD:HH24:MI:SS''";
- 3> set until time '2016-05-27:20:26:34';
- 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 27-MAY-16
- allocated channel: ORA_DISK_1
- channel ORA_DISK_1: SID=7 device type=DISK
- allocated channel: ORA_DISK_2
- channel ORA_DISK_2: SID=68 device type=DISK
- allocated channel: ORA_DISK_3
- channel ORA_DISK_3: SID=131 device type=DISK
- allocated channel: ORA_DISK_4
- channel ORA_DISK_4: SID=192 device type=DISK
- allocated channel: ORA_DISK_5
- channel ORA_DISK_5: SID=8 device type=DISK
- allocated channel: ORA_DISK_6
- channel ORA_DISK_6: SID=69 device type=DISK
- allocated channel: ORA_DISK_7
- channel ORA_DISK_7: SID=132 device type=DISK
- allocated channel: ORA_DISK_8
- channel ORA_DISK_8: SID=193 device type=DISK
- allocated channel: ORA_SBT_TAPE_1
- channel ORA_SBT_TAPE_1: SID=9 device type=SBT_TAPE
- channel ORA_SBT_TAPE_1: Oracle Secure Backup
- allocated channel: ORA_SBT_TAPE_2
- channel ORA_SBT_TAPE_2: SID=70 device type=SBT_TAPE
- channel ORA_SBT_TAPE_2: Oracle Secure Backup
- allocated channel: ORA_SBT_TAPE_3
- channel ORA_SBT_TAPE_3: SID=133 device type=SBT_TAPE
- channel ORA_SBT_TAPE_3: Oracle Secure Backup
- allocated channel: ORA_SBT_TAPE_4
- channel ORA_SBT_TAPE_4: SID=194 device type=SBT_TAPE
- channel ORA_SBT_TAPE_4: Oracle Secure Backup
- allocated channel: ORA_SBT_TAPE_5
- channel ORA_SBT_TAPE_5: SID=10 device type=SBT_TAPE
- channel ORA_SBT_TAPE_5: Oracle Secure Backup
- allocated channel: ORA_SBT_TAPE_6
- channel ORA_SBT_TAPE_6: SID=71 device type=SBT_TAPE
- channel ORA_SBT_TAPE_6: Oracle Secure Backup
- allocated channel: ORA_SBT_TAPE_7
- channel ORA_SBT_TAPE_7: SID=134 device type=SBT_TAPE
- channel ORA_SBT_TAPE_7: Oracle Secure Backup
- allocated channel: ORA_SBT_TAPE_8
- channel ORA_SBT_TAPE_8: SID=195 device type=SBT_TAPE
- channel ORA_SBT_TAPE_8: Oracle Secure Backup
- channel ORA_SBT_TAPE_1: starting datafile backup set restore
- channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
- channel ORA_SBT_TAPE_1: restoring datafile 00005 to +DATA/orcl/datafile/example.265.816169651
- channel ORA_SBT_TAPE_1: reading from backup piece 05omt45l_1_1
- channel ORA_SBT_TAPE_2: starting datafile backup set restore
- channel ORA_SBT_TAPE_2: specifying datafile(s) to restore from backup set
- channel ORA_SBT_TAPE_2: restoring datafile 00001 to +DATA/orcl/datafile/system.256.816169553
- channel ORA_SBT_TAPE_2: reading from backup piece 02omt45k_1_1
- channel ORA_SBT_TAPE_1: piece handle=05omt45l_1_1 tag=1T_WHOLE_INCR0
- channel ORA_SBT_TAPE_1: restored backup piece 1
- channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:37
- channel ORA_SBT_TAPE_1: starting datafile backup set restore
- channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
- channel ORA_SBT_TAPE_1: restoring datafile 00002 to +DATA/orcl/datafile/sysaux.257.816169553
- channel ORA_SBT_TAPE_1: reading from backup piece 03omt45k_1_1
- channel ORA_SBT_TAPE_2: piece handle=02omt45k_1_1 tag=1T_WHOLE_INCR0
- channel ORA_SBT_TAPE_2: restored backup piece 1
- channel ORA_SBT_TAPE_2: restore complete, elapsed time: 00:00:52
- channel ORA_SBT_TAPE_2: starting datafile backup set restore
- channel ORA_SBT_TAPE_2: specifying datafile(s) to restore from backup set
- channel ORA_SBT_TAPE_2: restoring datafile 00004 to +DATA/orcl/datafile/users.259.816169553
- channel ORA_SBT_TAPE_2: reading from backup piece 06omt45l_1_1
- channel ORA_SBT_TAPE_1: piece handle=03omt45k_1_1 tag=1T_WHOLE_INCR0
- channel ORA_SBT_TAPE_1: restored backup piece 1
- channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:40
- channel ORA_SBT_TAPE_2: piece handle=06omt45l_1_1 tag=1T_WHOLE_INCR0
- channel ORA_SBT_TAPE_2: restored backup piece 1
- channel ORA_SBT_TAPE_2: restore complete, elapsed time: 00:00:25
- channel ORA_SBT_TAPE_2: starting datafile backup set restore
- channel ORA_SBT_TAPE_2: specifying datafile(s) to restore from backup set
- channel ORA_SBT_TAPE_2: restoring datafile 00003 to +DATA/orcl/datafile/undotbs1.258.816169553
- channel ORA_SBT_TAPE_2: reading from backup piece 04omt45k_1_1
- channel ORA_SBT_TAPE_2: piece handle=04omt45k_1_1 tag=1T_WHOLE_INCR0
- channel ORA_SBT_TAPE_2: restored backup piece 1
- channel ORA_SBT_TAPE_2: restore complete, elapsed time: 00:00:25
- Finished restore at 27-MAY-16
- Starting recover at 27-MAY-16
- 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
- using channel ORA_SBT_TAPE_1
- using channel ORA_SBT_TAPE_2
- using channel ORA_SBT_TAPE_3
- using channel ORA_SBT_TAPE_4
- using channel ORA_SBT_TAPE_5
- using channel ORA_SBT_TAPE_6
- using channel ORA_SBT_TAPE_7
- using channel ORA_SBT_TAPE_8
- channel ORA_SBT_TAPE_1: starting incremental datafile backup set restore
- channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
- destination for restore of datafile 00001: +DATA/orcl/datafile/system.256.816169553
- channel ORA_SBT_TAPE_1: reading from backup piece 0iomt4hq_1_1
- channel ORA_SBT_TAPE_2: starting incremental datafile backup set restore
- channel ORA_SBT_TAPE_2: specifying datafile(s) to restore from backup set
- destination for restore of datafile 00002: +DATA/orcl/datafile/sysaux.257.816169553
- channel ORA_SBT_TAPE_2: reading from backup piece 0jomt4hq_1_1
- channel ORA_SBT_TAPE_1: piece handle=0iomt4hq_1_1 tag=3TCUMU_WHOLE_INCR1
- channel ORA_SBT_TAPE_1: restored backup piece 1
- channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:35
- channel ORA_SBT_TAPE_1: starting incremental datafile backup set restore
- channel ORA_SBT_TAPE_1: specifying datafile(s) to restore from backup set
- destination for restore of datafile 00005: +DATA/orcl/datafile/example.265.816169651
- channel ORA_SBT_TAPE_1: reading from backup piece 0lomt4hq_1_1
- channel ORA_SBT_TAPE_2: piece handle=0jomt4hq_1_1 tag=3TCUMU_WHOLE_INCR1
- channel ORA_SBT_TAPE_2: restored backup piece 1
- channel ORA_SBT_TAPE_2: restore complete, elapsed time: 00:00:35
- channel ORA_SBT_TAPE_2: starting incremental datafile backup set restore
- channel ORA_SBT_TAPE_2: specifying datafile(s) to restore from backup set
- destination for restore of datafile 00003: +DATA/orcl/datafile/undotbs1.258.816169553
- channel ORA_SBT_TAPE_2: reading from backup piece 0komt4hq_1_1
- channel ORA_SBT_TAPE_1: piece handle=0lomt4hq_1_1 tag=3TCUMU_WHOLE_INCR1
- channel ORA_SBT_TAPE_1: restored backup piece 1
- channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:35
- channel ORA_SBT_TAPE_2: piece handle=0komt4hq_1_1 tag=3TCUMU_WHOLE_INCR1
- channel ORA_SBT_TAPE_2: restored backup piece 1
- channel ORA_SBT_TAPE_2: restore complete, elapsed time: 00:00:36
- channel ORA_SBT_TAPE_2: starting incremental datafile backup set restore
- channel ORA_SBT_TAPE_2: specifying datafile(s) to restore from backup set
- destination for restore of datafile 00004: +DATA/orcl/datafile/users.259.816169553
- channel ORA_SBT_TAPE_2: reading from backup piece 0momt4hr_1_1
- channel ORA_SBT_TAPE_2: piece handle=0momt4hr_1_1 tag=3TCUMU_WHOLE_INCR1
- channel ORA_SBT_TAPE_2: restored backup piece 1
- channel ORA_SBT_TAPE_2: restore complete, elapsed time: 00:00:25
- starting media recovery
- archived log for thread 1 with sequence 15 is already on disk as file +FRA/orcl/archivelog/2013_12_11/thread_1_seq_15.261.833878627
- archived log for thread 1 with sequence 16 is already on disk as file +FRA/orcl/archivelog/2013_12_11/thread_1_seq_16.262.833879059
- archived log for thread 1 with sequence 17 is already on disk as file +FRA/orcl/archivelog/2016_05_27/thread_1_seq_17.263.912957557
- archived log for thread 1 with sequence 18 is already on disk as file +FRA/orcl/archivelog/2016_05_27/thread_1_seq_18.264.912959275
- archived log for thread 1 with sequence 19 is already on disk as file +FRA/orcl/archivelog/2016_05_27/thread_1_seq_19.265.912964019
- archived log for thread 1 with sequence 20 is already on disk as file +FRA/orcl/archivelog/2016_05_27/thread_1_seq_20.266.912975989
- archived log for thread 1 with sequence 21 is already on disk as file +FRA/orcl/archivelog/2016_05_27/thread_1_seq_21.267.912975989
- archived log for thread 1 with sequence 22 is already on disk as file +FRA/orcl/archivelog/2016_05_27/thread_1_seq_22.268.912975999
- channel ORA_SBT_TAPE_1: starting archived log restore to default destination
- channel ORA_SBT_TAPE_1: restoring archived log
- archived log thread=1 sequence=14
- channel ORA_SBT_TAPE_1: reading from backup piece 0nomt4ji_1_1
- channel ORA_SBT_TAPE_1: piece handle=0nomt4ji_1_1 tag=3TCUMU_WHOLE_INCR1
- channel ORA_SBT_TAPE_1: restored backup piece 1
- channel ORA_SBT_TAPE_1: restore complete, elapsed time: 00:00:24
- archived log file name=+FRA/orcl/archivelog/2016_05_27/thread_1_seq_14.272.912977425 thread=1 sequence=14
- channel default: deleting archived log(s)
- archived log file name=+FRA/orcl/archivelog/2016_05_27/thread_1_seq_14.272.912977425 RECID=18 STAMP=912977425
- archived log file name=+FRA/orcl/archivelog/2013_12_11/thread_1_seq_15.261.833878627 thread=1 sequence=15
- archived log file name=+FRA/orcl/archivelog/2013_12_11/thread_1_seq_16.262.833879059 thread=1 sequence=16
- archived log file name=+FRA/orcl/archivelog/2016_05_27/thread_1_seq_17.263.912957557 thread=1 sequence=17
- archived log file name=+FRA/orcl/archivelog/2016_05_27/thread_1_seq_18.264.912959275 thread=1 sequence=18
- archived log file name=+FRA/orcl/archivelog/2016_05_27/thread_1_seq_19.265.912964019 thread=1 sequence=19
- archived log file name=+FRA/orcl/archivelog/2016_05_27/thread_1_seq_20.266.912975989 thread=1 sequence=20
- archived log file name=+FRA/orcl/archivelog/2016_05_27/thread_1_seq_21.267.912975989 thread=1 sequence=21
- archived log file name=+FRA/orcl/archivelog/2016_05_27/thread_1_seq_22.268.912975999 thread=1 sequence=22
- media recovery complete, elapsed time: 00:00:25
- Finished recover at 27-MAY-16
- RMAN> alter database open ;
- RMAN-00571: ===========================================================
- RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
- RMAN-00571: ===========================================================
- RMAN-03002: failure of alter db command at 05/27/2016 20:51:47
- ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
- 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 1343950367 PARENT 1 15-AUG-09
- 2 2 ORCL 1343950367 CURRENT 945184 23-MAY-13
- RMAN> alter database open resetlogs;
- database opened
- RMAN> exit
- Recovery Manager complete.
- [oracle@station90 ~]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.1.0 Production on Fri May 27 20:53:46 2016
- Copyright (c) 1982, 2009, Oracle. All rights reserved.
- SQL> conn / as sysdba
- Connected.
- SQL> archive log list;
- Database log mode Archive Mode
- Automatic archival Enabled
- Archive destination USE_DB_RECOVERY_FILE_DEST
- Oldest online log sequence 1
- Next log sequence to archive 1
- Current log sequence 1
- SQL> exit
- Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
- With the Partitioning, Automatic Storage Management, OLAP, Data Mining
- and Real Application Testing options
- [oracle@station90 ~]$ rman target /
- Recovery Manager: Release 11.2.0.1.0 - Production on Fri May 27 20:53:57 2016
- Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
- connected to target database: ORCL (DBID=1343950367)
- 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 1343950367 PARENT 1 15-AUG-09
- 2 2 ORCL 1343950367 PARENT 945184 23-MAY-13
- 3 3 ORCL 1343950367 CURRENT 1068604 27-MAY-16
- RMAN> exit
复制代码
刚打开的闪回日志的大小:
[root@station90 mymachine]# watch -n 0.1 "ps aux | grep rvwr"
[root@station90 mymachine]# watch -n 0.1 "ps aux | grep rvwr"
[root@station90 mymachine]# bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
scale=4
33*1024*1024*8
276824064
33*1024*1024*8/1000000
276.8240(说明闪回日志刚开始时有2亿7千万比特,我叫“基底位图”)
- [oracle@station90 ~]$ . oraenv
- ORACLE_SID = [orcl] ? +ASM
- The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/grid is /u01/app/oracle
- [oracle@station90 ~]$ asmcmd
- ASMCMD> ls
- DATA/
- FRA/
- ASMCMD> cd FRA/
- ASMCMD> ls
- ORCL/
- ASMCMD> cd ORCL/
- ASMCMD> ls
- ARCHIVELOG/
- AUTOBACKUP/
- CHANGETRACKING/
- CONTROLFILE/
- ONLINELOG/
- ASMCMD> ls
- ARCHIVELOG/
- AUTOBACKUP/
- CHANGETRACKING/
- CONTROLFILE/
- FLASHBACK/
- ONLINELOG/
- ASMCMD> cd FLASHBACK/
- ASMCMD> ls
- log_1.274.912980547
- ASMCMD> du -sh
- Unknown option: s
- Unknown option: h
- usage: du [-H] [dir]
- help: help du
- ASMCMD> du
- Used_MB Mirror_used_MB
- 33 33
- ASMCMD>
复制代码
PL/SQL窗口:
- select * from v$flashback_database_log;
- select * from v$flashback_database_stat;
复制代码
|
|