标签:闪回db
查询当前的SCN:
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
1170420
清空表(truncate表后是不能进行闪回表的)
SQL> truncate table tom.t;
Table truncated.
SQL> select * from tom.t;
no rows selected
关闭实例启动到mount状态:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 417546240 bytes
Fixed Size 2228944 bytes
Variable Size 318770480 bytes
Database Buffers 88080384 bytes
Redo Buffers 8466432 bytes
Database mounted.
闪回数据库到SNC 1170420:
SQL> flashback database to scn 1170420;
Flashback complete.
只读方式打开数据库,查询数据是否恢复:
SQL> alter database open read only;
Database altered.
SQL> select * from tom.t;
ID NAME
---------- --------------------
3 mark3
1 mark1
2 mark2
关闭数据库,以resetlogs方式打开数据库:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 417546240 bytes
Fixed Size 2228944 bytes
Variable Size 318770480 bytes
Database Buffers 88080384 bytes
Redo Buffers 8466432 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
1170730
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>
标签:闪回db
原文地址:http://4538453.blog.51cto.com/4528453/1730249