Supplemental Logging

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.EMPLOYEESADD 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.EMPLOYEESADD 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.EMPLOYEESADD 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.

   

转载于:https://www.cnblogs.com/xieweikai/p/6838229.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/283633.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

TypeScript 与 JavaScript 的区别

TypeScript 是 JavaScript 的一个超集,支持 ECMAScript 6 标准(ES6 教程)。TypeScript 由微软开发的自由和开源的编程语言。TypeScript 设计目标是开发大型应用,它可以编译成纯 JavaScript,编译出来的 JavaScript 可以…

【caffe】create_cifar10.sh在windows下解决方案

tags caffe python windows下配置caffe后,create_cifar10.sh无法执行,因为是shell脚本。那就看懂脚本意思,用python重写一个: # create_cifar10.py # by ChrisZZimport os import shutilEXAMPLE"examples\\cifar10" DAT…

IO 和NIO的区别

1.IO和NIO的区别 NIO就是New IO在JDK1.4中引入。 IO和NIO有相同的作用和目的,但实现方式不同,NIO主要用到的是块,所以NIO的效率要比IO快不少。 在Java API中提供了两套NIO,一套针对标准输入输出NIO,另一套就是网络编程…

PerfView专题 (第四篇):如何寻找 C# 中程序集泄漏

一:背景 前两篇我们都聊到了非托管内存泄漏,一个是 HeapAlloc ,一个是 VirtualAlloc,除了这两种泄漏之外还存在其他渠道的内存泄漏,比如程序集泄漏,这一篇我们就来聊一聊。二:程序集也会泄漏&am…

站立会议第九天

1.站立会议内容 昨天我们成功的将图片插进去了,在这里,图片是使用的png格式,长知识了。我们今天要继续把界面再优化一下。 照片: 2.任务展板 3.燃尽图 转载于:https://www.cnblogs.com/bk1246788/p/6852935.html

Android TimeAnimator

TimeAnimator:提供了一个简单的回调机制,通过 TimeAnimator.TimeListener,在动画的每一帧处通知你。这个动画器没有时间,插值或是对象值设定。回调监听器为每一帧动画接受信息,包括总运行时间和从前一帧到现在的运行时间. 相关方法…

学习nginx 下面只是简单的配置文件

2019独角兽企业重金招聘Python工程师标准>>> #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } …

实现城市治理一网统管,必须这 4 个关键技术

导读:要实现城市治理一网统管,必须具备以下四个关键技术:城市状态一网感知、城市数据一网共享、信息流转三屏联动、虚实映射数字孪生。 作者:郑宇 来源:大数据DT(ID:hzdashuju) 01…

基于.NetCore开发博客项目 StarBlog - (17) 自动下载文章里的外部图片

系列文章基于.NetCore开发博客项目 StarBlog - (1) 为什么需要自己写一个博客?基于.NetCore开发博客项目 StarBlog - (2) 环境准备和创建项目基于.NetCore开发博客项目 StarBlog - (3) 模型设计基于.NetCore开发博客项目 StarBlog - (4) markdown博客批量导入基于.N…

windbg工具安装配置及dump抓取

安装与配置windbg 安装与配置windbg的symbol(符号) 第一步 下载WinDBG, 第二步 双击下载的文件安装windbg.安装时注意记住安装到那里了. 第三步 windbg访问符号需要两个文件(SYMSRV.DLL 和 SYMSTORE.EXE)所以在环境变量path中将windbg安装目录添加进去,这…

三种Oracle RMAN备份加密策略(下)

说明:本篇参考eygle老师的作品《Oracle DBA手记4:数据安全警示录》,特此表示感谢。 3 、Oracle Wallet加密策略Oracle Wallet是一种加密安全策略,过去我们在TDE(Oracle透明加密)部分研究过这个组件。简单的…

实现生成订单30分钟未支付,则自动取消

目录 了解需求 方案 1:数据库轮询 思路 实现 优点 缺点 方案 2:JDK 的延迟队列 思路 实现 优点 缺点 方案 3:时间轮算法 思路 实现 优点 缺点 方案 4:redis 缓存 思路一 实现一 解决方案 思路二 实现二 优…

Oracle树形结构查询之prior的理解

--1 建表 create table 宇宙( 行星等级 number ,行星名称 varchar2(50) ,上级行星等级 number); --2 数据准备 insert into 宇宙 (行星等级, 行星名称, 上级行星等级)values (1, 地球, 2); insert into 宇宙 (行星等级, 行星名称, 上级行星等级)values (2, 太阳, 3); insert in…

CA周记-.NET MAUI in GCR 月报(2022年8月)

.NET MAUI 正式版本发布已经三个月了,有小伙伴希望我们有一些关于 .NET MAUI 相关的本地化内容以及开源项目介绍,接下来从8月开始,我希望用月报的形式和大家分享 .NET MAUI 在中国的活动,学习资源,优秀的开源项目&…

Vue的内容分发slot的使用

什么是内容分发&#xff1f;? 概括&#xff1a;将父组件的内容放到子组件指定的位置 场景&#xff1a;在使用组件时&#xff0c;我们常常需要像这样组合使用 < app>< app-header>< /app-header>< app-footer>< /app-footer> < /app> 复制…

一文读懂研发效能洞察的五大流动指标

作者 | 张乐 目录 1 数字化时代&#xff0c;软件研发本身也要数字化 2 流框架及五大流动指标 1. 流动速率 2. 流动时间 3. 流动负载 4. 流动效率 5. 流动分布 3 研发过程中的常见瓶颈及解决思路 1. 稀缺的专家或资源&#xff0c;导致流动受阻 2. 缺乏自动化或工程能…

RabbitMQ队列

RabbitMQ是什么&#xff1f; RabbitMQ是一个在AMQP基础上完整的&#xff0c;可复用的企业消息系统。他遵循Mozilla Public License开源协议。 MQ全称为Message Queue, 消息队列&#xff08;MQ&#xff09;是一种应用程序对应用程序的通信方法。应用程序通过读写出入队列的消息&…

《ASP.NET Core 6框架揭秘实例》演示[14]:日志的进阶用法

为了对各种日志框架进行整合&#xff0c;微软创建了一个用来提供统一的日志编程模式的日志框架。《ASP.NET Core 6框架揭秘》实例演示[13]&#xff1a;日志的基本编程模式》以实例演示的方式介绍了日志的基本编程模式&#xff0c;现在我们来补充几种“进阶”用法。[本文节选《A…

Linux内核驱动GPIO的使用

一 概述Linux内核中gpio是最简单&#xff0c;最常用的资源(和 interrupt ,dma,timer一样)驱动程序&#xff0c;应用程序都能够通过相应的接口使用gpio&#xff0c;gpio使用0&#xff5e;MAX_INT之间的整数标识&#xff0c;不能使用负数,gpio与硬件体系密切相关的,不过linux有一…

什么是云原生,云原生技术为什么这么火?

文章目录 一、开篇浅谈二、云计算是什么三、云原生是什么四、云计算的四个层次 4.1 IaaS&#xff08;基础架构即服务&#xff09;4.2 PaaS&#xff08;平台即服务&#xff09;4.3 SaaS&#xff08;软件即服务&#xff09;4.4 DaaS&#xff08;数据即服务&#xff09;五、云原生…