当前位置:  数据库>oracle

Oracle 10g表空间联机脱机跟检查点的关系

    来源: 互联网  发布时间:2017-04-05

    本文导语: 一般,归档下offline tablespace有3种方式:normal(默认),immediate,temporary Normal会对该表空间所有文件执行检查点,会将对应的db_buffer中的脏数据写到数据文件中,online时不需要recover,只需要将当前的scn写到数据文件头即可; Immediate 不...

一般,归档下offline tablespace有3种方式:normal(默认),immediate,temporary

Normal会对该表空间所有文件执行检查点,会将对应的db_buffer中的脏数据写到数据文件中,online时不需要recover,只需要将当前的scn写到数据文件头即可;

Immediate 不会对该表空间执行检查点,立即脱机,不会转储任何脏数据。所以online的时候需要应用日志做recover。只有文件受到损坏以至没法完成检查点时,通常才这么做;

Temporary 介于normal跟immediate之间,能执行检查点的执行检查点,不能执行检查点的(如文件损坏)就立即脱机,当然online时也相应的需要恢复。

数据文件的offline相当于immediate方式,不写检查点,但online时需要recover


archive mode

1. tablespace offline: normal(默认)
SQL> select dbms_flashback.get_system_change_number from dual;

GET_SYSTEM_CHANGE_NUMBER
------------------------
                  493517

SQL> select FILE#,NAME,STATUS,CHECKPOINT_CHANGE# from v$datafile;

     FILE# NAME                                     STATUS CHECKPOINT_CHANGE#
---------- ---------------------------------------- ------- ------------------
         1 C:OracleORADATARCSYSTEM01.DBF        SYSTEM              493334
         2 C:ORACLEORADATARCUNDOTBS01.DBF       ONLINE              493334
         3 C:ORACLEORADATARCSYSAUX01.DBF        ONLINE              493334
         4 C:ORACLEORADATARCUSERS01.DBF         ONLINE              493334
         5 C:ORACLEORADATARCCQF01.DBF           ONLINE              493334
         6 C:ORACLEORADATARCCQF02.DBF           ONLINE              493334






6 rows selected.

SQL> select FILE#,NAME,STATUS,CHECKPOINT_CHANGE# from v$datafile;

     FILE# NAME                                     STATUS CHECKPOINT_CHANGE#
---------- ---------------------------------------- ------- ------------------
         1 C:ORACLEORADATARCSYSTEM01.DBF        SYSTEM              493334
         2 C:ORACLEORADATARCUNDOTBS01.DBF       ONLINE              493334
         3 C:ORACLEORADATARCSYSAUX01.DBF        ONLINE              493334
         4 C:ORACLEORADATARCUSERS01.DBF         ONLINE              493334
         5 C:ORACLEORADATARCCQF01.DBF           ONLINE              493334
         6 C:ORACLEORADATARCCQF02.DBF           ONLINE              493334






6 rows selected.

SQL> alter tablespace cqf offline normal;

Tablespace altered.

SQL> select FILE#,NAME,STATUS,CHECKPOINT_CHANGE# from v$datafile;

     FILE# NAME                                     STATUS CHECKPOINT_CHANGE#
---------- ---------------------------------------- ------- ------------------
         1 C:ORACLEORADATARCSYSTEM01.DBF        SYSTEM              493334
         2 C:ORACLEORADATARCUNDOTBS01.DBF       ONLINE              493334
         3 C:ORACLEORADATARCSYSAUX01.DBF        ONLINE              493334
         4 C:ORACLEORADATARCUSERS01.DBF         ONLINE              493334
         5 C:ORACLEORADATARCCQF01.DBF           OFFLINE             493550
         6 C:ORACLEORADATARCCQF02.DBF           OFFLINE             493550






6 rows selected.

SQL> alter tablespace cqf online;

Tablespace altered.

SQL> select FILE#,NAME,STATUS,CHECKPOINT_CHANGE# from v$datafile;

     FILE# NAME                                     STATUS CHECKPOINT_CHANGE#
---------- ---------------------------------------- ------- ------------------
         1 C:ORACLEORADATARCSYSTEM01.DBF        SYSTEM              493334
         2 C:ORACLEORADATARCUNDOTBS01.DBF       ONLINE              493334
         3 C:ORACLEORADATARCSYSAUX01.DBF        ONLINE              493334
         4 C:ORACLEORADATARCUSERS01.DBF         ONLINE              493334
         5 C:ORACLEORADATARCCQF01.DBF           ONLINE              493623
         6 C:ORACLEORADATARCCQF02.DBF           ONLINE              493623






6 rows selected.

SQL> select dbms_flashback.get_system_change_number from dual;

GET_SYSTEM_CHANGE_NUMBER
------------------------
                  493647

2. tablespace offline: immediate
SQL> alter tablespace cqf offline immediate;

Tablespace altered.

SQL> select FILE#,NAME,STATUS,CHECKPOINT_CHANGE# from v$datafile;

     FILE# NAME                                     STATUS CHECKPOINT_CHANGE#
---------- ---------------------------------------- ------- ------------------
         1 C:ORACLEORADATARCSYSTEM01.DBF        SYSTEM              493334
         2 C:ORACLEORADATARCUNDOTBS01.DBF       ONLINE              493334
         3 C:ORACLEORADATARCSYSAUX01.DBF        ONLINE              493334
         4 C:ORACLEORADATARCUSERS01.DBF         ONLINE              493334
         5 C:ORACLEORADATARCCQF01.DBF           RECOVER             493623
         6 C:ORACLEORADATARCCQF02.DBF           RECOVER             493623






6 rows selected.

SQL> alter tablespace cqf online;
alter tablespace cqf online
*
ERROR at line 1:
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: 'C:ORACLEORADATARCCQF01.DBF'





SQL> recover tablespace cqf;
Media recovery complete.
SQL> alter tablespace cqf online;


Tablespace altered.

SQL> select FILE#,NAME,STATUS,CHECKPOINT_CHANGE# from v$datafile;

     FILE# NAME                                     STATUS CHECKPOINT_CHANGE#
---------- ---------------------------------------- ------- ------------------
         1 C:ORACLEORADATARCSYSTEM01.DBF        SYSTEM              493334
         2 C:ORACLEORADATARCUNDOTBS01.DBF       ONLINE              493334
         3 C:ORACLEORADATARCSYSAUX01.DBF        ONLINE              493334
         4 C:ORACLEORADATARCUSERS01.DBF         ONLINE              493334
         5 C:ORACLEORADATARCCQF01.DBF           ONLINE              493752
         6 C:ORACLEORADATARCCQF02.DBF           ONLINE              493752






6 rows selected.

3. Datafile offline
SQL> alter database datafile 5 offline;

Database altered.

SQL> select FILE#,NAME,STATUS,CHECKPOINT_CHANGE# from v$datafile;

     FILE# NAME                                     STATUS CHECKPOINT_CHANGE#
---------- ---------------------------------------- ------- ------------------
         1 C:ORACLEORADATARCSYSTEM01.DBF        SYSTEM              493334
         2 C:ORACLEORADATARCUNDOTBS01.DBF       ONLINE              493334
         3 C:ORACLEORADATARCSYSAUX01.DBF        ONLINE              493334
         4 C:ORACLEORADATARCUSERS01.DBF         ONLINE              493334
         5 C:ORACLEORADATARCCQF01.DBF           RECOVER             493752
         6 C:ORACLEORADATARCCQF02.DBF           ONLINE              493752






6 rows selected.

SQL> alter database datafile 5 online;
alter database datafile 5 online
*
ERROR at line 1:
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: 'C:ORACLEORADATARCCQF01.DBF'





SQL> recover datafile 5;
Media recovery complete.
SQL> alter database datafile 5 online;


Database altered.

SQL> select FILE#,NAME,STATUS,CHECKPOINT_CHANGE# from v$datafile;

     FILE# NAME                                     STATUS CHECKPOINT_CHANGE#
---------- ---------------------------------------- ------- ------------------
         1 C:ORACLEORADATARCSYSTEM01.DBF        SYSTEM              493334
         2 C:ORACLEORADATARCUNDOTBS01.DBF       ONLINE              493334
         3 C:ORACLEORADATARCSYSAUX01.DBF        ONLINE              493334
         4 C:ORACLEORADATARCUSERS01.DBF         ONLINE              493334
         5 C:ORACLEORADATARCCQF01.DBF           ONLINE              493876
         6 C:ORACLEORADATARCCQF02.DBF           ONLINE              493752






6 rows selected.

Noarchive mode

表空间脱机只有normal模式,没有immediate的原因我们也能猜的到,没有开归档,online的时候就有可能没法完全应用自offline以来的日志(日志可能被覆盖)。跟检查点的关系同归档模式。
数据文件脱机只有offline drop模式,没有offline模式,原因同上。

事实上,noarchivelog 下的数据文件脱机offline drop = offline for drop ,意思是这个文件以后不再需要,但物理层面上并没有真正删除,一般在某个数据文件丢失以至于没法open数据库的时候才做datafile offline。如果在数据库open的情况下做offline datafile,这种文件一般就没法再online了。不过只要redo日志没有切换一个循环(最初日志没被覆盖),还是可以实现online的。

SQL> alter database datafile 5 offline drop;

Database altered.

SQL> select FILE#,NAME,STATUS,CHECKPOINT_CHANGE# from v$datafile;

     FILE# NAME                                     STATUS CHECKPOINT_CHANGE#
---------- ---------------------------------------- ------- ------------------
         1 C:ORACLEORADATARCSYSTEM01.DBF        SYSTEM              494175
         2 C:ORACLEORADATARCUNDOTBS01.DBF       ONLINE              494175
         3 C:ORACLEORADATARCSYSAUX01.DBF        ONLINE              494175
         4 C:ORACLEORADATARCUSERS01.DBF         ONLINE              494175
         5 C:ORACLEORADATARCCQF01.DBF           RECOVER             494331
         6 C:ORACLEORADATARCCQF02.DBF           ONLINE              494331






6 rows selected.

SQL> alter database datafile 5 online;
alter database datafile 5 online
*
ERROR at line 1:
ORA-01113: file 5 needs media recovery
ORA-01110: data file 5: 'C:ORACLEORADATARCCQF01.DBF'





SQL> recover datafile 5;
Media recovery complete.
SQL> alter database datafile 5 online;


Database altered.

SQL> select FILE#,NAME,STATUS,CHECKPOINT_CHANGE# from v$datafile;

     FILE# NAME                                     STATUS CHECKPOINT_CHANGE#
---------- ---------------------------------------- ------- ------------------
         1 C:ORACLEORADATARCSYSTEM01.DBF        SYSTEM              494175
         2 C:ORACLEORADATARCUNDOTBS01.DBF       ONLINE              494175
         3 C:ORACLEORADATARCSYSAUX01.DBF        ONLINE              494175
         4 C:ORACLEORADATARCUSERS01.DBF         ONLINE              494175
         5 C:ORACLEORADATARCCQF01.DBF           ONLINE              494626
         6 C:ORACLEORADATARCCQF02.DBF           ONLINE              494331






6 rows selected.


    
 
 

您可能感兴趣的文章:

 
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • oracle联机数据库备份详解
  • Oracle 12c发布简单介绍及官方下载地址
  • 在linux下安装oracle,如何设置让oracle自动启动!也就是让oracle那个服务自动启动,不是手动的
  • oracle 11g最新版官方下载地址
  • 请问su oracle 和su - oracle有什么不同?
  • Oracle 数据库(oracle Database)Select 多表关联查询方式
  • 虚拟机装Oracle R12与Oracle10g
  • Oracle数据库(Oracle Database)体系结构及基本组成介绍
  • Oracle 数据库开发工具 Oracle SQL Developer
  • 如何设置让Oracle SQL Developer显示的时间包含时分秒
  • Oracle EBS R12 支持 Oracle Database 11g
  • Oracle 10g和Oracle 11g网格技术介绍
  • SCO unix下安装oracle,但没有光盘,请大家推荐一个oracle下载站点(unix版本的)。谢谢!!!!
  • oracle中如何把表中具有相同值列的多行数据合并成一行
  • 请问大家用oracle数据库, 用import oracle.*;下的东西么? 还是用标准库?
  • Oracle 数据库(oracle Database)性能调优技术详解
  • Linux /$ORACLE_HOME $ORACLE_HOME
  • ORACLE日期相关操作
  • Linux系统下Oracle的启动与Oracle监听的启动
  • ORACLE数据库常用字段数据类型介绍
  • 请问在solaris下安装ORACLE,用root用户和用oracle用户安装有什么区别么?
  • Oracle 12c的九大最新技术特性介绍
  • 网间Oracle的连接,远程连接Oracle服务器??


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3