当前位置:  数据库>数据库 iis7站长之家

Oracle不可恢复的nologging数据库对象

    来源: 互联网  发布时间:2017-06-10

    本文导语: 不可恢复的NOLOGGING 数据库对象 1) 备份users表空间 [Oracle@ocmu ~]$ rman target / Recovery Manager: Release 11.2.0.1.0 - Production on Sat Mar 16 10:41:05 2013 Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved. connected to target database: ORA11GR2 (DBID=11...

不可恢复的NOLOGGING 数据库对象

1) 备份users表空间

[Oracle@ocmu ~]$ rman target /

Recovery Manager: Release 11.2.0.1.0 - Production on Sat Mar 16 10:41:05 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORA11GR2 (DBID=116453860)

RMAN> backup as backupset tablespace users; 

Starting backup at 16-MAR-13

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=41 device type=DISK

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

input datafile file number=00004 name=/u01/app/oracle/oradata/ORA11GR2/users01.dbf

channel ORA_DISK_1: starting piece 1 at 16-MAR-13

channel ORA_DISK_1: finished piece 1 at 16-MAR-13

piece handle=/u01/app/FRA/ORA11GR2/backupset/2013_03_16/o1_mf_nnndf_TAG20130316T104134_8n7pyymv_.bkp tag=TAG20130316T104134 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05

Finished backup at 16-MAR-13

 

Starting Control File and SPFILE Autobackup at 16-MAR-13

piece handle=/u01/app/FRA/ORA11GR2/autobackup/2013_03_16/o1_mf_s_810211299_8n7pz48h_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 16-MAR-13

 

RMAN>

2) 采用nologging属性创建表,并且以直接路径加载的方式插入数据

SCOTT@ORA11GR2>create table t_objects nologging tablespace users as select * from all_objects where 1=2;

 

Table created.

 

SCOTT@ORA11GR2>insert /*+ append */ into t_objects select * from all_objects;

 

55641 rows created.

 

SCOTT@ORA11GR2>commit;

 

Commit complete.

 

SCOTT@ORA11GR2>

3) RMAN中列出包含不可恢复数据的数据文件

RMAN>  report unrecoverable database;

 

Report of files that need backup due to unrecoverable operations

File Type of Backup Required Name

---- ----------------------- --------------------------------------------

4    full or incremental      /u01/app/oracle/oradata/ORA11GR2/users01.dbf

 

RMAN>

4) 删除users表空间,测试nologging的不可恢复性

SYS@ORA11GR2>select file_name from dba_data_files where tablespace_name='USERS';

 

FILE_NAME

--------------------------------------------------------------------------

/u01/app/oracle/oradata/ORA11GR2/users01.dbf

 

SYS@ORA11GR2>!ls /u01/app/oracle/oradata/ORA11GR2/users01.dbf

/u01/app/oracle/oradata/ORA11GR2/users01.dbf

 

SYS@ORA11GR2>!rm /u01/app/oracle/oradata/ORA11GR2/users01.dbf

 

SYS@ORA11GR2>!ls /u01/app/oracle/oradata/ORA11GR2/users01.dbf

ls: /u01/app/oracle/oradata/ORA11GR2/users01.dbf: No such file or directory

 

SYS@ORA11GR2>

5) RMAN执行恢复users表空间操作

RMAN> shutdown immediate;

 

database closed

database dismounted

Oracle instance shut down

 

RMAN> startup mount;

 

connected to target database (not started)

Oracle instance started

database mounted

 

Total System Global Area    841162752 bytes

 

Fixed Size                    1339768 bytes

Variable Size                578817672 bytes

Database Buffers            255852544 bytes

Redo Buffers                  5152768 bytes

 

RMAN> restore tablespace users;

 

Starting restore at 16-MAR-13

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=18 device type=DISK

 

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/ORA11GR2/users01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/FRA/ORA11GR2/backupset/2013_03_16/o1_mf_nnndf_TAG20130316T104134_8n7pyymv_.bkp

channel ORA_DISK_1: piece handle=/u01/app/FRA/ORA11GR2/backupset/2013_03_16/o1_mf_nnndf_TAG20130316T104134_8n7pyymv_.bkp tag=TAG20130316T104134

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:08

Finished restore at 16-MAR-13

 

RMAN> recover tablespace users;

 

Starting recover at 16-MAR-13

using channel ORA_DISK_1

 

starting media recovery

media recovery complete, elapsed time: 00:00:01

 

Finished recover at 16-MAR-13

 

RMAN> alter database open;

 

database opened

 

RMAN>

6) 验证NOLOGGING的不可恢复性

SCOTT@ORA11GR2>select count(*) from t_objects;

select count(*) from t_objects

                    *

ERROR at line 1:

ORA-01578: ORACLE data block corrupted (file # 4, block # 675)

ORA-01110: data file 4: '/u01/app/oracle/oradata/ORA11GR2/users01.dbf'

ORA-26040: Data block was loaded using the NOLOGGING option 

SCOTT@ORA11GR2>

7) 小结

NOLONGGING能让你“一时之快”,但是风险是极大的,所以要尽快备份或在空闲时间重建表。


    
 
 
 
本站(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,