ITPub博客

首页 > 数据库 > Oracle > 热备份与文件SCN

热备份与文件SCN

原创 Oracle 作者:aidway 时间:2014-04-03 17:58:06 0 删除 编辑

查看数据文件状态,所有号码都是一致的
SYS@orcl>  select name,checkpoint_change# from v$datafile;

NAME                                                         CHECKPOINT_CHANGE#
--------------------------------------------------              ------------------
+DATA/orcl/datafile/system.256.839003427                        1044967
+DATA/orcl/datafile/sysaux.257.839003427                         1044967
+DATA/orcl/datafile/undotbs1.258.839003427                     1044967
+DATA/orcl/datafile/users.259.839003427                          1044967
+DATA/orcl/datafile/example.269.839003537                      1044967


所有文件都处于非活动状态
SYS@orcl> select * from v$backup;

FILE#     STATUS        CHANGE# TIME
---------- ---------- ---------- ------------
         1 NOT ACTIVE          0
         2 NOT ACTIVE          0
         3 NOT ACTIVE          0
         4 NOT ACTIVE          0
         5 NOT ACTIVE          0

开始热备份...
SYS@orcl> alter tablespace users begin backup;

Tablespace altered.



SYS@orcl> select * from v$backup;

FILE#     STATUS        CHANGE# TIME
---------- ---------- ---------- ------------
         1 NOT ACTIVE          0
         2 NOT ACTIVE          0
         3 NOT ACTIVE          0
         4 ACTIVE        1045293 02-APR-14
         5 NOT ACTIVE          0

 

再次查看数据文件状态,发现users文件号最大, 因为begin backup前会对该表空间的所有文件触发检查点,将脏块写到数据文件。

SYS@orcl> select name,checkpoint_change# from v$datafile;

NAME                                                        CHECKPOINT_CHANGE#
--------------------------------------------------             ------------------
+DATA/orcl/datafile/system.256.839003427                       1044967
+DATA/orcl/datafile/sysaux.257.839003427                        1044967
+DATA/orcl/datafile/undotbs1.258.839003427                    1044967
+DATA/orcl/datafile/users.259.839003427                         1045293
+DATA/orcl/datafile/example.269.839003537                     1044967


强制产生完全存盘
SYS@orcl> alter system checkpoint;

System altered.

users.259.839003427的scn号没有变化,因为它存盘了,但是没有写文件头,文件头被冷冻了。
其它文件头都写入了最新的scn,使得users.259.839003427的scn号最小了。

SYS@orcl> select name,checkpoint_change# from v$datafile;

NAME                                               CHECKPOINT_CHANGE#
-------------------------------------------------- ------------------
+DATA/orcl/datafile/system.256.839003427                        1045433
+DATA/orcl/datafile/sysaux.257.839003427                        1045433
+DATA/orcl/datafile/undotbs1.258.839003427                     1045433
+DATA/orcl/datafile/users.259.839003427                         1045293
+DATA/orcl/datafile/example.269.839003537                      1045433
 

 

结束热备份
SYS@orcl> alter tablespace users end backup;

Tablespace altered.


SYS@orcl> select * from v$backup;

FILE#     STATUS        CHANGE# TIME
---------- ---------- ---------- ------------
         1 NOT ACTIVE          0
         2 NOT ACTIVE          0
         3 NOT ACTIVE          0
         4 NOT ACTIVE    1045293 02-APR-14
         5 NOT ACTIVE          0


所有文件头一致了,文件头被解冻,一切又正常了...
SYS@orcl> select name,checkpoint_change# from v$datafile;

NAME                                                        CHECKPOINT_CHANGE#
--------------------------------------------------             ------------------
+DATA/orcl/datafile/system.256.839003427                       1045433
+DATA/orcl/datafile/sysaux.257.839003427                        1045433
+DATA/orcl/datafile/undotbs1.258.839003427                     1045433
+DATA/orcl/datafile/users.259.839003427                          1045433
+DATA/orcl/datafile/example.269.839003537                      1045433

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28675539/viewspace-1135640/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 执行计划
下一篇: 控制文件
请登录后发表评论 登录
全部评论

注册时间:2013-12-04

  • 博文量
    28
  • 访问量
    89740