Supplemental Logging分为两种:Database-Level Supplemental Logging和Table-Level Supplemental Logging,即数据库级别和表级别。下面我们来看看Oracle官方文档对其的介绍和说明,引自 http://docs.oracle.com/cd/E11882_01/server.112/e22490/logminer.htm#SUTIL1582

一、Database-Level Supplemental Logging

There are two types of database-level supplemental logging: minimal supplemental logging and identification key logging.Minimal supplemental logging does not impose significant overhead on the database generating the redo log files. However, enabling database-wide identification key logging can impose overhead on the database generating the redo log files.

--数据库级别的补充日志包括两种:minimal supplement logging和identification key logging。Minimal supplemental logging不会强加太多的信息到redo log;identification key logging会强加大量的信息到redo log。

1. Minimal Supplemental Logging

Minimal supplemental logging logs the minimal amount of information needed for LogMiner to identify, group, and merge the redo operations associated with DML changes. It ensures that LogMiner (and any product building on LogMiner technology) has sufficient information to support chained rows and various storage arrangements, such as cluster tables and index-organized tables. To enable minimal supplemental logging, execute the following SQL statement:

ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

2. Database-Level Identification Key Logging

Identification key logging is necessary when redo log files will not be mined at the source database instance, for example, when the redo log files will be mined at a logical standby database.

Using database identification key logging, you can enable database-wide before-image logging for all updates by specifying one or more of the following options to the SQL ALTER DATABASE ADD SUPPLEMENTAL LOG statement:

2.1 ALL system-generated unconditional supplemental log group

This option specifies that when a row is updated, all columns of that row (except for LOBs, LONGS, and ADTs) are placed in the redo log file.

To enable all column logging at the database level, execute the following statement:

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;

--对于ALL COLUMNS补充日志来说,当行被修改时,该行的所有列都会被记录到日志文件中

2.2 PRIMARY KEY system-generated unconditional supplemental log group

This option causes the database to place all columns of a row's primary key in the redo log file whenever a row containing a primary key is updated (even if no value in the primary key has changed).

If a table does not have a primary key, but has one or more non-null unique index key constraints or index keys, then one of the unique index keys is chosen for logging as a means of uniquely identifying the row being updated.

If the table has neither a primary key nor a non-null unique index key, then all columns except LONG and LOB are supplementally logged; this is equivalent to specifying ALL supplemental logging for that row. Therefore, Oracle recommends that when you use database-level primary key supplemental logging, all or most tables be defined to have primary or unique index keys.

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;

--对于PRIMARY KYE COLUMNS补充日志来说,当行被修改时,该行的主键将被记录到日志文件中,无论该行的主键是否被修改。如果该表没有主键,但有一个或多个非空唯一键,则任意一个非空主键将被记录到日志文件中,如果该表既没有主键,也没有非空唯一键,则该行的所有列将被记录到日志文件中。

2.3 UNIQUE system-generated conditional supplemental log group

This option causes the database to place all columns of a row's composite unique key or bitmap index in the redo log file if any column belonging to the composite unique key or bitmap index is modified. The unique key can be due to either a unique constraint or a unique index.

SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (UNIQUE) COLUMNS;

--对于UNIQUE COLUMNS补充日志来说,当行被修改时,该行的唯一键或bitmap index将被记录到日志文件中。

2.4 FOREIGN KEY system-generated conditional supplemental log group

This option causes the database to place all columns of a row's foreign key in the redo log file if any column belonging to the foreign key is modified.

ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (FOREIGN KEY) COLUMNS;

注意:

1. When you enable identification key logging at the database level, minimal supplemental logging is enabled implicitly.

2. Supplemental logging statements are cumulative. If you issue the following SQL statements, then both primary key and unique key supplemental logging is enabled:

ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (UNIQUE) COLUMNS;

3. Dropping minimal supplemental log data is allowed only if no other variant of database-level supplemental logging is enabled.

--如果启动了identification key logging,则minimal supplemental logging将隐性启动;补充日志是叠加的;只有当所有identification key logging被禁止以后,minimal 补充日志才会被禁止。

禁止命令如下:

ALTER DATABASE DROP SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
ALTER DATABASE DROP SUPPLEMENTAL LOG DATA;

二、 Table-Level Supplemental Logging

Table-level supplemental logging specifies, at the table level, which columns are to be supplementally logged. You can use identification key logging or user-defined conditional and unconditional supplemental log groups to log supplemental information, as described in the following sections.

1. Table-Level Identification Key Logging  --针对所有列的

Identification key logging at the table level offers the same options as those provided at the database level: all, primary key, foreign key, and unique key. However, when you specify identification key logging at the table level, only the specified table is affected.

-- Database-Level Identification Key Logging与Table-Level Supplemental Logging的区别,前者是针对全库的,后者是针对表的。表级别的补充日志也是叠加的。

2. Table-Level User-Defined Supplemental Log Groups  --针对某些列的

In addition to table-level identification key logging, Oracle supports user-defined supplemental log groups. With user-defined supplemental log groups, you can specify which columns are supplementally logged. You can specify conditional or unconditional log groups, as follows:

2.1 User-defined unconditional log groups

To enable supplemental logging that uses user-defined unconditional log groups, use the ALWAYS clause as shown in the following example:

ALTER TABLE HR.EMPLOYEES
ADD SUPPLEMENTAL LOG GROUP emp_parttime (EMPLOYEE_ID, LAST_NAME,
DEPARTMENT_ID) ALWAYS;

This creates a log group named emp_parttime on the hr.employees table that consists of the columns employee_idlast_name, and department_id. These columns will be logged every time an UPDATE statement is executed on the hr.employees table, regardless of whether the update affected these columns.

--对于User-defined unconditional log groups,只要行被修改,无论列组中的列是否被修改,该组中的列都会被记录到日志文件中。

2.2 User-defined conditional supplemental log groups

To enable supplemental logging that uses user-defined conditional log groups, omit the ALWAYS clause from the SQL ALTER TABLE statement, as shown in the following example:

ALTER TABLE HR.EMPLOYEES
ADD SUPPLEMENTAL LOG GROUP emp_fulltime (EMPLOYEE_ID, LAST_NAME,
DEPARTMENT_ID);

This creates a log group named emp_fulltime on table hr.employees. Just like the previous example, it consists of the columns employee_idlast_name, and department_id. But because the ALWAYS clause was omitted, before-images of the columns will be logged only if at least one of the columns is updated.

--相比unconditional log groups,conditional supplemental log groups语句中只是少了关键字ALWAYS,只有该列组中的列被修改时,该组中列的信息才会记录到日志文件中。

2.3 User-defined supplemental log groups with NO LOG

For both unconditional and conditional user-defined supplemental log groups, you can explicitly specify that a column in the log group be excluded from supplemental logging by specifying the NO LOG option. When you specify a log group and use the NO LOG option, you must specify at least one column in the log group without the NO LOG option, as shown in the following example:

ALTER TABLE HR.EMPLOYEES
ADD SUPPLEMENTAL LOG GROUP emp_parttime(
DEPARTMENT_ID NO LOG, EMPLOYEE_ID);

This enables you to associate this column with other columns in the named supplemental log group such that any modification to the NO LOG column causes the other columns in the supplemental log group to be placed in the redo log file. This might be useful, for example, if you want to log certain columns in a group if a LONG column changes. You cannot supplementally log the LONG column itself; however, you can use changes to that column to trigger supplemental logging of other columns in the same row.

--譬如:新建一个表,其中,带有LONG字段,SQL> create table test(id number,ename long);

构建包括ename在内的supplemental log groups

SQL> alter table scott.test add supplemental log group test_g(loc,id) always;
           alter table scott.test add supplemental log group test_g(loc,id) always
           *
           ERROR at line 1:
           ORA-30569: data type of given column is not supported in a log group

可见,在log group中,long类型不支持。

在此,我们可以对long类型的列指定为NO LOG。如下所示:

SQL> alter table scott.test add supplemental log group test_g(ename no log,id) always;

Table altered.

Supplemental Logging的更多相关文章

  1. Oracle补全日志(Supplemental logging)

    Oracle补全日志(Supplemental logging)特性因其作用的不同可分为以下几种:最小(Minimal),支持所有字段(all),支持主键(primary key),支持唯一键(uni ...

  2. 多个supplemental logging的说明与删除

    有时候我们做ogg的时候,查看info trandata schema.table 无法查看到对应的supplement log信息, 但是我们查看table script的时候可以看到supplem ...

  3. Oracle Database does not provide any supplemental logging, which means that by default LogMiner is not usable

    写在前面,在研究Oracle logmnr 的时候看到 http://www.askmaclean.com/archives/dbms_logmnr-unsupported-sqlredo.html ...

  4. Oracle Supplemental 补全日志介绍

    转. Oracle补全日志(Supplemental logging)特性因其作用的不同可分为以下几种:最小(Minimal),支持所有字段(all),支持主键(primary key),支持唯一键( ...

  5. Oracle碎碎念~1

    1. 设置SQL*Plus提示符 SQL> set sqlprompt "_user'@'_connect_identifier>" SYS@orcl> 为了对所 ...

  6. 1Z0-050

    QUESTION 13 View the Exhibit.Examine the following command that is executed for the TRANSPORT table ...

  7. oracle rac logminer有限制用法及session_info为unknown情况

    这里只记录下有条件的情况如何使用 BEGIN dbms_logmnr.start_logmnr( dictfilename => '/u01/arch/logminer_dict.ora',   ...

  8. oracle 日志学习(转载)

    一,重做日志概念 重做日志文件(redo log file)对于Oracle数据库至关重要.它们是数据库的事务日志.通常只用于恢复,不过也可以用于以下工作: q 系统崩溃后的实例恢复 q 通过备份恢复 ...

  9. DataGuard体系结构

    一.DataGuard总体结构 总体目标 1.   描述计划和非计划停机的不同因数 2.   DataGuard的主要组件 3.   物理以及逻辑DataGuard的异同 4.   建立DataGua ...

随机推荐

  1. js基础知识:变量

    一.什么是变量? 在JavaScript中,变量用来存放值的,存放任何数据类型的值都可以,它就是值的容器. 二.变量怎么用? (一)用var声明1个变量 在使用变量之前,需要var关键字来声明变量,变 ...

  2. Memcached & Redis使用

    Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载.它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态.数据库驱动网站的速度.Memcached ...

  3. Android—LayoutInflater学习笔记

    LayoutInflater的的主要用处:使用LayoutInflater来载入界面,类似于findViewById()在Activity中加载Widget组件一样.区别在于与LayoutInflat ...

  4. 要做linux运维工程师的朋友,必须要掌握以下几个工具才行 ...

    要做linux运维工程师的朋友,必须要掌握以下几个工具才行 ...  [复制链接]   发表于 2013-12-13 15:59 | 来自  51CTO网页 [只看他] 楼主           本人 ...

  5. 10条建议提高PHP代码性能

    这篇文章中的建议涵盖了大部分PHP代码性能方面的问题.如果你是做一些小网站或者小项目,那么有理由忽略这些建议,但是当你为大量用户提供长期稳定的服务的时候,就必须关注了.开发人员必须从项目一开始就考虑这 ...

  6. Visual Studio Xamarin编译Android项目出错的解决办法

    安装完Xamarin后,编译Android项目时,你会发现好长时间进度都不动,当你取消编译后,会发现其实是出错了,就是因在Android项目在第一次编译时要去google网站上下一个andorid s ...

  7. Android横竖屏切换

    ps:虽然现在的app一般都是固定一个屏幕方向,但是还是有必要了解下屏幕切换的方法和注意. 一 固定横竖屏 androidmainfest.xml中设置activoty属性:android:scree ...

  8. mongoDB研究笔记:写关注

    对于某些应用程序来说,写关注是重要的.它能判断哪些写操作成功写入了,哪些失败了,对于失败的操作,驱动程序能返回错误,由应用程序决定怎么处理.如果没有写关注,应用程序发送一个写操作到socket后,就不 ...

  9. PyCharm 3.0 发布,提供免费开源版本

    PyCharm 发布最新的 3.0 版本,该版本新特性详见: http://www.jetbrains.com/pycharm/whatsnew/index.html 该版本最主要的是提供了免费开源的 ...

  10. [转] 编译安装GCC

    Linux下编写C/C++程序自然缺不了一个优秀的编译器,Linux下比较常见的自然是GCC了. 2015年GCC也出到了5.2.0版本,对于C++11/14也有了更好的支持了. 所以,今天我们就来说 ...