`
guoyanxi
  • 浏览: 275766 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

042 nologging 题目

阅读更多
原题如下:
if the tablespace is in the NOLOGGING mode, no operation on the tablespace will generate redo.

这句话是错误的。
很容易从字面上误解了他的意思,my support上有解析到:
nologging影响到的操作有:
1.SQL*Loader的直接导入
2.直接的insert操作,或者是create table|index的命令
3.带有NOCACHE NOLOGGING 含有LOB的对象的装载

同样,只能在database,tablespace,object都NO FORCE LOGGING的情况下才能使用

原文如下:


The Gains and Pains of Nologging Operations [ID 290161.1]  

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

  Modified 02-NOV-2008     Type BULLETIN     Status PUBLISHED  

THE GAINS AND PAINS OF NOLOGGING OPERATIONS
Overview
Whereas a logged INSERT operation has to generate redo for every change data or undo block, nologging operations indicate that the database operation is not logged in the online redo log file. Even though a small invalidation redo record¹ is still written to the online redo log file, nologging operations skip the redo generation of the corresponding inserted data.  Nologging can be extremely beneficial for the following reasons:

data written to the redo is minimized dramatically
time to insert into a large table or index or LOB can be reduced dramatically
performance improves for parallel creation of large tables or indices
However, NOLOGGING is intended for configurations in which media recovery or the recovery of the corresponding object is not important. Thus, if the disk or tape or storage media fails, you will not be able to recover your changes from the redo because the changes were never logged. 

Nologging operations are invoked by any of the following:

SQL*Loader direct load operations
Direct load INSERT operations from CREATE TABLE | INDEX or INSERT commands
Loading into an object containing LOB data when its object’s segment characteristic is NOCACHE NOLOGGING

For databases in ARCHIVELOG mode, nologging operations can only occur for a particular object if and only if:

Database allows for nologging (ALTER DATABASE NO FORCE LOGGING) and
Tablespace allows for nologging (ALTER TABLESPACE <NAME> NO FORCE LOGGING) and
Object allows for nologging (ALTER TABLE <NAME> NOLOGGING)

This paper will cover the following topics:

examples of nologging operations
prevention of nologging operations
detection of nologging operations on the primary and standby databases
repair of nologged changes on the physical and logical standby databases
Examples of nologging operations
Below is a list of examples that can be used for testing purposes.   The database must be in ARCHIVELOG mode and must allow nologging operations to see the effect of nologging changes:

    1. insert /*+ APPEND */ into scott.emp select * from sys.emp2;
    2. create table emp nologging as select * from sys.emp;
    3. create index emp_i on emp(empno) nologging;
    4. sqlload operation with unrecoverable option

Prevention of nologging operations
When a standby database exists or if you want all transactions to be recoverable on a database, tablespace or object-wide perspective, it is recommended that you prevent nologging operations by issuing the relevant options.  These options include:

ALTER DATABASE FORCE LOGGING (database level) or
ALTER TABLESPACE <NAME> FORCE LOGGING (tablespace level) on the relevant tablespaces you want to protect or
[CREATE | ALTER] TABLE <NAME> LOGGING (example of object level) on the relevant objects you want to protect

This ensures that all transactions are logged and can be recovered through media recovery or Redo Apply or SQL Apply assuming appropriate data type support.

Detection of Nologging Operations On the Primary and Standby Databases
On the primary database, you can monitor for the most recent nologging operation that occurred in the database by issuing the following query:

         SELECT NAME, UNRECOVERABLE_CHANGE#,               
         TO_CHAR (UNRECOVERABLE_TIME,'DD-MON-YYYY HH:MI:SS')
         FROM V$DATAFILE;

The above primary database’s query dictates when the most recent nologging operation occurred and when the invalidation redo was written to the redo.   

Once Redo Apply (or Media Recovery) processes the invalidation redo, it marks all the corresponding data blocks corrupt.  You will detect encounter corrupted blocks on the physical standby database when you query any data that references these data blocks.   You will receive the following errors: 

                ORA-01578: ORACLE data block corrupted (file # 3, block # 514)
                ORA-01110: data file 3: '/u01/lto_linux9206/dbs/users.dbf'
                ORA-26040: Data block was loaded using the NOLOGGING option

You can proactively catch some of these corrupted blocks on Redo Apply (or media recovery) instance by running DBVERIFY on the data files.
           
        $ dbv file=users.dbf
        DBVERIFY - Verification starting : FILE = users.dbf
        DBV-00200: Block, dba 12583426, already marked corrupted
        DBV-00200: Block, dba 12583427, already marked corrupted
        DBV-00200: Block, dba 12583428, already marked corrupted

SQL apply ignores the invalidation redo since it cannot convert it to any reasonable SQL; so, the logical standby will not receive any immediate errors.   If future transactions reference the missing data, then apply slave will receive an ORA-01403 in the alert.log.   For example, the following UPDATE statement failed on the logical standby because it was referencing  “nologged” rows that do not exist on the logical standby database.

        LOGSTDBY stmt: update "SCOTT"."NOLOG"
          set
            "SAL" = 810
          where
            "EMPNO" = 7369 and
            "ENAME" = 'SMITH' and
            "JOB" = 'CLERK' and
            "MGR" = 7902 and
            "HIREDATE" = TO_DATE('17-DEC-80', 'DD-MON-RR') and
            "SAL" = 800 and
            "COMM" IS NULL and
            "DEPTNO" = 20 and
            ROWID = 'AAAAAAAAEAAAACRAAA'
        LOGSTDBY status: ORA-01403: no data found
        LOGSTDBY PID 21733, oracle@dlsun1917 (P004)
        LOGSTDBY XID 0x0001.010.00000cf3, Thread 1, RBA 0x038b.00000826.1a4
        Tue Nov  2 18:26:51 2004
        Errors in file /private/oracle/app/admin/tens/bdump/tens_lsp0_20328.trc:
        ORA-12801: error signaled in parallel query server P004
        ORA-01403: no data found
        LOGSTDBY Reader P003 pid=27 OS id=21729 stopped

Currently in Oracle 9i and Oracle 10gR1, only the primary’s database V$DATAFILE view reflects nologging operations..   In 10gR2, the V$DATAFILE view will be enhanced to include information regarding when an invalidation redo is applied and the aforementioned corrupted blocks are written to the corresponding data file on a Redo Apply (or media recovery or standby) instance. 

Repair of Nologged Changes on the Physical and Logical Standby Databases
After a nologged operation on the primary is detected, it is recommended to create a backup immediately if you want to recover from this operation in the future.  However there are additional steps required if you have an existing physical or logical standby database.    This is crucial if you want to preserve the data integrity of your standby databases.

For a physical standby database, Redo Apply will process the invalidation redo and mark the corresponding data blocks corrupt.

For a physical standby database, follow these steps² to reinstantiate the relevant data files .

    1. stop Redo Apply (recover managed standby database cancel)
    2. offline corresponding datafile(s) (alter database datafile <NAME> offline drop;)
    3. start Redo Apply (recover managed standby database disconnect)
    4. copy the appropriate backup datafiles over from the primary database (e.g. use RMAN to backup datafiles and copy them)
    5. stop Redo Apply (recover managed standby database cancel)
    6. online corresponding data files (alter database datafile <NAME> online;)
    7. start Redo Apply (recover managed standby database disconnect)

For a logical standby database, SQL Apply skips over the invalidation redo completely; so, the subsequent corresponding table or index will not be updated.   However, future reference to missing data will result in ORA-1403 (no data found).   In order to resynchronize the table with the primary table, you need to re-create it from the primary database.   Follow the steps described in Oracle Data Guard Concepts and Administration, Chapter 'Managing a Logical Standby Database', and Section 'Adding or Re-Creating Tables On a Logical Standby Database'   Basically, you will be using the DBMS_LOGSTDBY.INSTANTIATE_TABLE procedure.

¹Invalidation redo containing information about the nologging operation and the range of blocks it affects. 

²Please also refer to the Data Guard Concepts & Administration documentation.


Related



--------------------------------------------------------------------------------
Products
--------------------------------------------------------------------------------

Oracle Database Products > Oracle Database > Oracle Database > Oracle Server - Enterprise Edition

分享到:
评论

相关推荐

    oracle nologging 总结

    oracle nologging全面总结,从数据库级别,对象以及表级别都有说明,以及在生产环境的影响,和及时止损的处理方法。

    1z0 -042考点详解

    在创建表空间时,可以通过日志子句(如`LOGGING`或`NOLOGGING`)来控制表空间上用户对象的事务日志行为。`FORCE LOGGING`则强制对所有数据修改进行日志记录,除了临时段的更改,这对于确保数据的可恢复性尤为重要。 ...

    abator 生成ibaties dao xml

    Abator 是一个基于 Apache License 的开源工具,用于简化 MyBatis 框架中的 SQL 映射文件和 DAO 接口的生成工作。它通过自动化的代码生成,帮助开发者快速构建项目的数据访问层,减少手动编写重复代码的时间,提高...

    oracle 8795792补丁

    在数据库管理过程中,遇到错误代码如ORA-14102时,这通常意味着在执行某些操作,如创建表或分区时,尝试同时指定"LOGGING"和"NOLOGGING"选项,这是不被允许的。Oracle数据库系统只允许在一个语句中明确地设置其中一...

    Oracle_tablespace_(表空间)的创建、删除、修改、扩展及检查等

    在创建表空间时,可以选择 logging 或 nologging 模式,logging 模式将创建重做日志,而 nologging 模式不创建重做日志。通常情况下,在创建表空间时,选择 nologging 模式,以加快表空间的创建速度。 在创建表空间...

    oracle海量数据中提升创建索引的速度.docx

    nologging 参数可以禁止 redo 日志的生成,从而提高创建索引的速度。redo 日志是 Oracle 数据库中用于记录所有变化的日志,包括数据的插入、更新和删除等操作。在创建索引时,redo 日志会记录所有的操作,这将减慢...

    一个Oracle建表SQL语句的优化.pdf

    同时,也应当考虑使用Nologging选项来进一步提高操作速度,但要注意它对数据恢复可能产生的不利影响。最后,通过查看并分析执行计划,可以更深入地理解不同SQL语句在性能上的差异,进而选择出最适合特定情况的建表...

    Oracle创建表空间详解

    其中,`tablespace_name`是你想要创建的表空间的名称,`file_path`指定数据文件的物理路径和文件名,`size`定义了初始大小,而`AUTOEXTEND`、`MAXSIZE`、`LOGGING`/`NOLOGGING`、`EXTENT MANAGEMENT`和`SEGMENT ...

    Oracle表的类型及定义[归类].pdf

    - **LOGGING 和 NOLOGGING**:LOGGING表示所有操作记录在重做日志中,NOLOGGING则减少写入,适用于大容量加载。 - **INITRANS 和 MAXTRANS**:初始化和最大事务表条目,用于管理块中的锁定信息。 在设计和管理...

    oracle题库教程教程教程教程教程教程教程教程教程教

    - **维度(Dimensions)**:不是基于汇总(summaries),这一点在题目中被否定(选项A)。实际上,维度是在多维分析中用于组织数据的类别或属性。例如,在销售数据中,产品类别、地区、时间等都可以作为维度。 - **...

    profile和bashrc比较测试.

    profile和bashrc比较测试, 结论:bashrc文件可以在nologging状态下生效,而profile文件不可以

    oracle FORCE LOGGING.txt

    3. **对象级别**:如果设置了 NOLOGGING,则该对象的操作不会被记录。 #### 六、Force Logging 与 Non-Force Logging 的转换 1. **从非 Force Logging 转换到 Force Logging**: ```sql ALTER DATABASE FORCE ...

    mybatis源码中文注释.zip

    org.apache.ibatis.logging.nologging org.apache.ibatis.logging.slf4j org.apache.ibatis.logging.stdout 对象适配器设计模式 2.异常 org.apache.ibatis.exceptions 3.缓存 org.apache.ibatis.cache org.apache...

    Data Guard配置

    1. 启动主数据库的强制日志记录功能,避免Nologging子句的影响 ALTER DATABASE FORCE LOGGING; 2. 配置日志传递的安全认证 一般情况,设定remote_login_passwordfile=exclusive,并且配置tnsnames.ora即可 3. 配置主...

    Append原理Append原理

    在归档下nologging表或者在非归档下nologging表,只要append,undo、redo都很少生成或者不生成。 实验结果表明,在非归档模式下,使用Append操作可以大大减少redo的生成量。同时,在使用Append操作时,undo的生成量...

    Oracle 大数据量操作优化

    create table t1 nologging parallel (degree 2) as select * from t; ``` 7. **优化表参数** - 对于频繁更新的表,建议增加`PCTFREE`的值,以确保数据块中有足够的空间用于更新操作,减少行链接的发生,进一步...

    数据库建用户

    - **LOGGING/NOLOGGING/FORCE LOGGING**:这些选项决定了是否记录表空间中的操作日志,LOGGING为开启日志,NOLOGGING为关闭,FORCE LOGGING强制开启日志,即使设置了NOLOGGING。 - **COMPRESS/NOCOMPRESS**:数据...

    SQL去重 清除冗余数据

    使用Delete from Lin_test nologging where id in (select id from (select /*+full(Lin_test ) parallel(Lin_test 5)*/ id,row_number() over(partition by id, name, order by id) rn from Lin_test ) where rn &lt;&gt;...

    某省移动核心数据库迁移方案.docx

    数据库层面准备包括清理/区分无用的表、整理出可以不停应用、预先迁移的历史、静态表、整理出需要停应用才能迁移的其它表、整理出第二阶段迁移的表的索引以及约束的 ddl,并修改 nologging 以及并行属性。...

Global site tag (gtag.js) - Google Analytics