我们知道通过设置nologging选项。能够加快oracle的某些操作的运行速度,这在运行某些维护任务时是非常实用的,可是该选项也非常危急,假设使用不当,就可能导致数据库发生ORA-26040错误。

首先。构造使用环境。

SQL> select tablespace_name,logging,force_logging from dba_tablespaces;

TABLESPACE_NAME 	       LOGGING	 FOR
------------------------------ --------- ---
SYSTEM LOGGING NO
UNDOTBS1 LOGGING NO
SYSAUX LOGGING NO
TEMP NOLOGGING NO
USERS LOGGING NO
LOGGING LOGGING NO 6 rows selected.
SQL> show user
USER is "LOGGING"
SQL> select table_name,logging from user_tables; TABLE_NAME LOG
------------------------------ ---
SOURCE YES
NOLOG NO
NOLOG1 NO

我们使用create table table_name nologging as select * from user_tables创建了表nolog和nolog1。在创建表之前,先使用rman进行全库的备份,表创建完毕后,关闭数据库,并使用备份来恢复,结果例如以下:

[oraten@yue bdump]$ rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on 星期四 11月 13 17:21:02 2014

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: ORATEN (DBID=3658365464, not open)

RMAN> list backup;

using target database control file instead of recovery catalog

List of Backup Sets
=================== BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
97 Full 565.31M DISK 00:00:41 2014-11-12 09:34:45
BP Key: 65 Status: AVAILABLE Compressed: NO Tag: TAG20141112T093404
Piece Name: /home/app/oraten/flash_recovery_area/ORATEN/backupset/2014_11_12/o1_mf_nnndf_TAG20141112T093404_b65g8fc3_.bkp
List of Datafiles in backup set 97
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
1 Full 1276159 2014-11-12 09:34:04 /home/app/oraten/oradata/oraten/system01.dbf
2 Full 1276159 2014-11-12 09:34:04 /home/app/oraten/oradata/oraten/undotbs01.dbf
3 Full 1276159 2014-11-12 09:34:04 /home/app/oraten/oradata/oraten/sysaux01.dbf
4 Full 1276159 2014-11-12 09:34:04 /home/app/oraten/oradata/oraten/users01.dbf
5 Full 1276159 2014-11-12 09:34:04 /home/app/oraten/oradata/oraten/logging01.dbf BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
98 Full 6.86M DISK 00:00:02 2014-11-12 09:34:52
BP Key: 66 Status: AVAILABLE Compressed: NO Tag: TAG20141112T093404
Piece Name: /home/app/oraten/flash_recovery_area/ORATEN/backupset/2014_11_12/o1_mf_ncsnf_TAG20141112T093404_b65g9vx2_.bkp
Control File Included: Ckp SCN: 1276545 Ckp time: 2014-11-12 09:34:50
SPFILE Included: Modification time: 2014-11-12 09:14:00 RMAN> restore database; Starting restore at 2014-11-13 17:21:19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /home/app/oraten/oradata/oraten/system01.dbf
restoring datafile 00002 to /home/app/oraten/oradata/oraten/undotbs01.dbf
restoring datafile 00003 to /home/app/oraten/oradata/oraten/sysaux01.dbf
restoring datafile 00004 to /home/app/oraten/oradata/oraten/users01.dbf
restoring datafile 00005 to /home/app/oraten/oradata/oraten/logging01.dbf
channel ORA_DISK_1: reading from backup piece /home/app/oraten/flash_recovery_area/ORATEN/backupset/2014_11_12/o1_mf_nnndf_TAG20141112T093404_b65g8fc3_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/app/oraten/flash_recovery_area/ORATEN/backupset/2014_11_12/o1_mf_nnndf_TAG20141112T093404_b65g8fc3_.bkp tag=TAG20141112T093404
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 2014-11-13 17:21:45 RMAN> recover database; Starting recover at 2014-11-13 17:21:50
using channel ORA_DISK_1 starting media recovery archive log thread 1 sequence 53 is already on disk as file /home/app/oraten/flash_recovery_area/ORATEN/archivelog/2014_11_12/o1_mf_1_53_b65gj7m2_.arc
archive log thread 1 sequence 54 is already on disk as file /home/app/oraten/flash_recovery_area/ORATEN/archivelog/2014_11_12/o1_mf_1_54_b65kj77p_.arc
archive log thread 1 sequence 55 is already on disk as file /home/app/oraten/flash_recovery_area/ORATEN/archivelog/2014_11_13/o1_mf_1_55_b68w6tft_.arc
archive log filename=/home/app/oraten/flash_recovery_area/ORATEN/archivelog/2014_11_12/o1_mf_1_53_b65gj7m2_.arc thread=1 sequence=53
media recovery complete, elapsed time: 00:00:14
Finished recover at 2014-11-13 17:22:05 RMAN> alter database open; database opened RMAN>

alert 文件里的内容例如以下:

Thu Nov 13 17:21:20 CST 2014
Full restore complete of datafile 5 /home/app/oraten/oradata/oraten/logging01.dbf. Elapsed time: 0:00:00
checkpoint is 1276159
Full restore complete of datafile 4 /home/app/oraten/oradata/oraten/users01.dbf. Elapsed time: 0:00:00
checkpoint is 1276159
last deallocation scn is 672889
Full restore complete of datafile 2 /home/app/oraten/oradata/oraten/undotbs01.dbf. Elapsed time: 0:00:01
checkpoint is 1276159
last deallocation scn is 1252646
Full restore complete of datafile 3 /home/app/oraten/oradata/oraten/sysaux01.dbf. Elapsed time: 0:00:03
checkpoint is 1276159
last deallocation scn is 842824
Thu Nov 13 17:21:41 CST 2014
Full restore complete of datafile 1 /home/app/oraten/oradata/oraten/system01.dbf. Elapsed time: 0:00:10
checkpoint is 1276159
last deallocation scn is 399219
Thu Nov 13 17:21:51 CST 2014
alter database recover datafile list clear
Thu Nov 13 17:21:51 CST 2014
Completed: alter database recover datafile list clear
Thu Nov 13 17:21:51 CST 2014
alter database recover datafile list
1 , 2 , 3 , 4 , 5
Completed: alter database recover datafile list
1 , 2 , 3 , 4 , 5
Thu Nov 13 17:21:51 CST 2014
alter database recover if needed
start
Media Recovery Start
parallel recovery started with 2 processes
ORA-279 signalled during: alter database recover if needed
start
...
Thu Nov 13 17:21:51 CST 2014
alter database recover logfile '/home/app/oraten/flash_recovery_area/ORATEN/archivelog/2014_11_12/o1_mf_1_53_b65gj7m2_.arc'
Thu Nov 13 17:21:51 CST 2014
Media Recovery Log /home/app/oraten/flash_recovery_area/ORATEN/archivelog/2014_11_12/o1_mf_1_53_b65gj7m2_.arc
Thu Nov 13 17:21:52 CST 2014
Recovery of Online Redo Log: Thread 1 Group 3 Seq 54 Reading mem 0
Mem# 0: /home/app/oraten/oradata/oraten/redo03.log
Thu Nov 13 17:21:54 CST 2014
Recovery of Online Redo Log: Thread 1 Group 1 Seq 55 Reading mem 0
Mem# 0: /home/app/oraten/oradata/oraten/redo01.log
Thu Nov 13 17:21:59 CST 2014
Recovery of Online Redo Log: Thread 1 Group 2 Seq 56 Reading mem 0
Mem# 0: /home/app/oraten/oradata/oraten/redo02.log
Thu Nov 13 17:22:02 CST 2014
Media Recovery Complete (oraten)
Completed: alter database recover logfile '/home/app/oraten/flash_recovery_area/ORATEN/archivelog/2014_11_12/o1_mf_1_53_b65gj7m2_.arc'
Thu Nov 13 17:22:11 CST 2014
alter database open
Thu Nov 13 17:22:11 CST 2014
LGWR: STARTING ARCH PROCESSES
ARC0 started with pid=21, OS id=6628
Thu Nov 13 17:22:11 CST 2014
ARC0: Archival started
ARC1: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC1 started with pid=22, OS id=6630
Thu Nov 13 17:22:12 CST 2014
Thread 1 opened at log sequence 56
Current log# 2 seq# 56 mem# 0: /home/app/oraten/oradata/oraten/redo02.log
Successful open of redo thread 1
Thu Nov 13 17:22:12 CST 2014
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Thu Nov 13 17:22:12 CST 2014
ARC0: Becoming the 'no FAL' ARCH
ARC0: Becoming the 'no SRL' ARCH
Thu Nov 13 17:22:12 CST 2014
ARC1: Becoming the heartbeat ARCH
Thu Nov 13 17:22:12 CST 2014
SMON: enabling cache recovery
Thu Nov 13 17:22:12 CST 2014
Successfully onlined Undo Tablespace 1.
Thu Nov 13 17:22:12 CST 2014
SMON: enabling tx recovery
Thu Nov 13 17:22:12 CST 2014
Database Characterset is AL32UTF8
Opening with internal Resource Manager plan
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
QMNC started with pid=23, OS id=6632
Thu Nov 13 17:22:12 CST 2014
db_recovery_file_dest_size of 2048 MB is 28.34% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Thu Nov 13 17:22:13 CST 2014
Completed: alter database open

从上面我们看出。一切正常,数据库成功恢复了。可是:

SQL> conn logging/logging
Connected.
SQL> select * from nolog;
select * from nolog
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 5, block # 44)
ORA-01110: data file 5: '/home/app/oraten/oradata/oraten/logging01.dbf'
ORA-26040: Data block was loaded using the NOLOGGING option

数据库报错,看来恢复成功并不一定数据库就是正常的。

再看一下,日志的的dump内容,

[oraten@yue udump]$ strings oraten_ora_10509.trc | grep oad
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry
Direct Loader invalidate block range redo entry

看来日志中对nologging是有记录的,在rman恢复时,会依据记录将某些块设置为逻辑损坏。

模拟ORA-26040: Data block was loaded using the NOLOGGING option的更多相关文章

  1. ORA-01578 ORACLE data block corrupted (file # 29, block # 2889087)

    BW数据库后台报错如下:F:\oracle\SBP\saptrace\diag\rdbms\sbp\sbp\trace ORA-01578: ORACLE data block corrupted ( ...

  2. Populating Tabular Data Block Manually Using Cursor in Oracle Forms

    Suppose you want to populate a non-database data block with records manually in Oracle forms. This t ...

  3. ORA-01578 data block corrupted 数据文件损坏 与 修复 (多为借鉴 linux)

    好吧,先说说造成崩溃的原因: 使用redhat 5.9 Linux 作为数据库服务器, 周五数据库正在使用中,硬关机造成数据库文件部分损坏(周一上班时,应用程序启动不起来,查看日志文件时,发现一个数据 ...

  4. Data Block Compression

    The database can use table compression to eliminate duplicate values in a data block. This section d ...

  5. Data Block -- Uncompressed

    Overview of Data Blocks Oracle Database manages the logical storage space in the data files of a dat ...

  6. Hadoop EC 踩坑 :data block 缺失导致的 HDFS 传输速率下降

    环境:hadoop-3.0.2 + 11 机集群 + RS-6-3-1024K 的EC策略 状况:某天,往 HDFS 上日常 put 业务数据时,发现传输速率严重下降 分析: 检查集群发现,在之前的传 ...

  7. block(data block,directory block)、inode、块位图、inode位图和super block概念详解【转】

    本文转载自:https://blog.csdn.net/jhndiuowehu/article/details/50788287 一.基本概念:      1.block:文件系统中存储数据的最小单元 ...

  8. oracle --(一)数据块(data Block)

    基本关系:数据库---表空间---数据段---分区---数据块 数据块(data Block)一.数据块Block是Oracle存储数据信息的最小单位.这里说的是Oracle环境下的最小单位.Orac ...

  9. Copy Records From One Data Block To Another Data Block In Oracle Forms

    In this tutorial you will learn to copy the records from one data block to another data block on sam ...

随机推荐

  1. Drupal的system_list()函数解析

    system_list()函数的目的是根据传入的资源类型,返回一个数组列表: function system_list($type) { ... ... } 参数$type支持下面三种类型: boot ...

  2. docker中批量删除 tag为none的镜像

    添加定时任务,批量删除tag 为none 的镜像  ,释放磁盘空间 [root@weifeng]:~# crontab -l */ * * * /usr/bin/docker rmi `docker ...

  3. 将table中的值转换成json格式传到后台接收处理。

    table数据 <table style="border:1px" id="tableID"> <tr> <th>编号< ...

  4. spring中添加redis缓存

    1.单机版的添加 spring里面配置 <bean id="redisClient" class="redis.clients.jedis.JedisPool&qu ...

  5. 使用AsParallel 进行并行化处理数据

    using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using S ...

  6. angularJS 使用自定义指令输出模板

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script sr ...

  7. Firefly 3288又一次制作android和lubuntu双系统固件

    又一次制作android和lubuntu双系统固件 因为本人改动了lubuntu的驱动和设备树信息,为了方便烧写系统,所以又一次制作了双系统的固件. Firefly wiki教程里有android固件 ...

  8. 聚合类新闻client的改进

         zaker和鲜果是最早的聚合类新闻产品.前几年发展非常快.迅速占据了市场,但近两年发展变得缓慢.而今日头条自公布以来才两年.用户量就迅速超过了zaker和鲜果.使用起来非常easy,左右滑动 ...

  9. 跨Server查询

    GO RECONFIGURE GO GO RECONFIGURE GO SELECT MAX(OldestCall) FROM ( SELECT FeildAA As FeildAAFROM OPEN ...

  10. 如何通过 AAR 形式集成 leakcanary-android 服务

    如何通过 AAR 形式集成 leakcanary-android 服务 如何通过在线引用的方式拿到所有相关的依赖项文件? #1.禁用 Gradle 离线模式 #2.按照文档要求添加项目依赖 #3.Sy ...