重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3422|回复: 0
打印 上一主题 下一主题

[Oracle] 基本SCN号的闪回测试

[复制链接]
跳转到指定楼层
楼主
发表于 2019-4-8 16:33:45 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
获取数据库当前scn
C:\Users\Administrator>sqlplus / assysdba
SQL*Plus: Release 11.2.0.4.0 Production on 星期一 4 8 15:52:072019
Copyright (c) 1982, 2013, Oracle.  All rights reserved.
连接到:
Oracle Database 11g Enterprise EditionRelease 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Miningand Real Application Testing options

SQL> select count(*) from test1;
COUNT(*)
----------
    84554

SQL> select current_scn from v$database;
CURRENT_SCN
-----------
2499476
删除测试表test1
SQL> drop table test1;
表已删除。
手动执行检查点
SQL> alter system checkpoint;
系统已更改。

SQL> select file#,checkpoint_change#from v$datafile;
    FILE# CHECKPOINT_CHANGE#
---------- ------------------
        1            2499604
        2            2499604
        3            2499604
        4            2499604
        5            2499604
启动数据库到mount状态
SQL> shutdown immediate;
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup mount;
ORACLE 例程已经启动。

Total System Global Area  609624064 bytes
Fixed Size                  2283664 bytes
Variable Size             230688624 bytes
Database Buffers          369098752 bytes
Redo Buffers                7553024 bytes
数据库装载完毕。
闪回数据库到之前的scn
SQL> flashback database to scn 2499476;
闪回完成。

使用resetlogs打开数据库
SQL> alter database open resetlogs;
数据库已更改。
验证表test1数据
SQL> select count(*) from test1;
COUNT(*)
----------
    84554


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-5-21 00:23 , Processed in 0.085661 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表