原因
在Oracle數據庫
本文將針對此特性介紹一個詳細的參考示例:
一
$ rman target /
Recovery Manager: Release
Copyright (c)
connected to target database: EYGLE (DBID=
RMAN> backup database plus archivelog delete all input;
Starting backup at
current log archived
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
input archive log thread=
input archive log thread=
input archive log thread=
channel ORA_DISK_
channel ORA_DISK_
piece handle=/data
/o
channel ORA_DISK_
channel ORA_DISK_
archive log filename=/data
/archivelog/
/o
archive log filename=/data
/flash_recovery_area/EYGLE/archivelog/
/o
archive log filename=/data
/
Finished backup at
Starting backup at
using channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
input datafile fno=
input datafile fno=
input datafile fno=
input datafile fno=
input datafile fno=
input datafile fno=
input datafile fno=
channel ORA_DISK_
channel ORA_DISK_
piece handle=/data
/
channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
input datafile fno=
input datafile fno=
input datafile fno=
channel ORA_DISK_
channel ORA_DISK_
piece handle=/data
/o
channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
input datafile fno=
channel ORA_DISK_
channel ORA_DISK_
piece handle=/data
/
channel ORA_DISK_
Finished backup at
Starting backup at
current log archived
using channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
input archive log thread=
channel ORA_DISK_
channel ORA_DISK_
piece handle=/data
/o
channel ORA_DISK_
channel ORA_DISK_
archive log filename=/data
/
Finished backup at
Starting Control File and SPFILE Autobackup at
piece handle=/data
/
Finished Control File and SPFILE Autobackup at
RMAN> exit
Recovery Manager complete
二
$ sqlplus
SQL*Plus: Release
Tue Apr
Copyright (c)
Connected to:
Oracle Database
With the Partitioning
SYS AS SYSDBA on
System altered
SYS AS SYSDBA on
COUNT(*)
SYS AS SYSDBA on
SYS AS SYSDBA on
Commit complete
SYS AS SYSDBA on
System altered
SYS AS SYSDBA on
Table truncated
SYS AS SYSDBA on
System altered
日志序列的情況如下:
SYS AS SYSDBA on
select * from v$log_history where recid >
RECID STAMP THREAD# SEQUENCE# FIRST_CHANGE# FIRST_TIME NEXT_CHANGE# RESETLOGS_CHANGE# RESETLOGS_TIME
關閉數據庫:
SYS AS SYSDBA on
Database closed
Database dismounted
ORACLE instance shut down
SYS AS SYSDBA on
Disconnected from Oracle Database
Edition Release
With the Partitioning
三
$ rman target /
Recovery Manager: Release
Copyright (c)
connected to target database (not started)
RMAN> startup mount;
Oracle instance started
database mounted
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
RMAN> run {
executing command: SET until clause
using target database controlfile instead of recovery catalog
Starting restore at
allocated channel: ORA_DISK_
channel ORA_DISK_
datafile
channel ORA_DISK_
channel ORA_DISK_
restoring datafile
restoring datafile
restoring datafile
restoring datafile
restoring datafile
restoring datafile
channel ORA_DISK_
piece handle=/data
/
channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
restoring datafile
restoring datafile
restoring datafile
channel ORA_DISK_
piece handle=/data
/
tag=TAG
channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
restoring datafile
channel ORA_DISK_
piece handle=/data
/
tag=TAG
channel ORA_DISK_
Finished restore at
Starting recover at
using channel ORA_DISK_
datafile
starting media recovery
archive log thread
/
channel ORA_DISK_
restore to default destination
channel ORA_DISK_
archive log thread=
channel ORA_DISK_
piece handle=/data
/
tag=TAG
channel ORA_DISK_
archive log filename=/data
/
channel default: deleting archive log(s)
archive log filename=/data
/
archive log filename=/data
/
media recovery complete
Finished recover at
RMAN> alter database open resetlogs;
database opened
RMAN> exit
Recovery Manager complete
四
$ sqlplus
SQL*Plus: Release
Copyright (c)
Connected to:
Oracle Database
Release
With the Partitioning
SYS AS SYSDBA on
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence
Next log sequence to archive
Current log sequence
SYS AS SYSDBA on
COUNT(*)
五
SYS AS SYSDBA on
create table tt as select * from dba_users;
Table created
SYS AS SYSDBA on
System altered
SYS AS SYSDBA on
COUNT(*)
SYS AS SYSDBA on
SYS AS SYSDBA on
Commit complete
SYS AS SYSDBA on
System altered
此時的日志序列:
SYS AS SYSDBA on
select * from v$log_history where recid >
RECID STAMP THREAD# SEQUENCE# FIRST_CHANGE# FIRST_TIME
NEXT_CHANGE# RESETLOGS_CHANGE# RESETLOGS_TIME
SYS AS SYSDBA on
Database closed
Database dismounted
ORACLE instance shut down
SYS AS SYSDBA on
Disconnected from Oracle Database
Edition Release
With the Partitioning
六
$ rman target /
Recovery Manager: Release
Copyright (c)
connected to target database (not started)
RMAN> startup mount;
Oracle instance started
database mounted
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
RMAN> run {
Starting restore at
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_
channel ORA_DISK_
datafile
channel ORA_DISK_
channel ORA_DISK_
restoring datafile
restoring datafile
restoring datafile
restoring datafile
restoring datafile
restoring datafile
channel ORA_DISK_
piece handle=/data
/
tag=TAG
channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
restoring datafile
restoring datafile
restoring datafile
channel ORA_DISK_
piece handle=/data
/
channel ORA_DISK_
channel ORA_DISK_
channel ORA_DISK_
restoring datafile
channel ORA_DISK_
piece handle=/data
/
tag=TAG
channel ORA_DISK_
Finished restore at
Starting recover at
using channel ORA_DISK_
datafile
starting media recovery
archive log thread
/
archive log thread
/
archive log thread
/
channel ORA_DISK_
restore to default destination
channel ORA_DISK_
archive log thread=
channel ORA_DISK_
piece handle=/data
/
tag=TAG
channel ORA_DISK_
archive log filename=/data
/
channel default: deleting archive log(s)
archive log filename=/data
/
archive log filename=/data
/
media recovery complete
Finished recover at
RMAN> alter database open;
database opened
RMAN> exit
Recovery Manager complete
七
注意此次恢復跨越了resetlogs時間點
$ sqlplus
SQL*Plus: Release
Tue Apr
Copyright (c)
Connected to:
Oracle Database
With the Partitioning
SYS AS SYSDBA on
COUNT(*)
SYS AS SYSDBA on
COUNT(*)
SYS AS SYSDBA on
SYS AS SYSDBA on
至此
From:http://tw.wingwit.com/Article/program/Oracle/201311/18371.html