Oracle Supple Logging
Oracle Supple Logging
Oracle Supple Logging
Logging
Julian Dyke
Independent Consultant
Web Version
1
Supplemental
Logging
Supplemental Logging
Example
ALTER DATABASE
ADD SUPPLEMENTAL LOG DATA
(PRIMARY KEY) COLUMNS;
CREATE TABLE t1
(
c1 NUMBER,
c2 NUMBER,
c3 NUMBER
);
ALTER TABLE t1
ADD CONSTRAINT t1_pk
PRIMARY KEY (c1,c2);
INSERT INTO t1 VALUES (100,20,1);
UPDATE t1 SET c3 = 2
WHERE c1 = 100
AND c2 = 20;
Redo Header
Change Header
KTU
KDO
c3 = 1
Supplementary Header
c1 = 100
c2 = 20
Change Header
KTU
KDO
c3 = 2
Supplemental Logging
Minimal
Supplemental Logging
Required for LogMiner
Supplemental Logging
Minimal
Supplemental Logging
To check whether minimal supplemental logging is enabled:
SELECT supplemental_log_data_min
FROM v$database;
Supplemental Logging
Database
Supplemental Logging
Can be enabled
All columns
All columns are included with the exception of:
LONG
LOB
LONG RAW
Abstract Data Types
Collections
Supplemental Logging
Database
Supplemental Logging
To enable supplemental logging at database level:
ALTER DATABASE
ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
ALTER DATABASE
ADD SUPPLEMENTAL LOG DATA (UNIQUE) COLUMNS;
ALTER DATABASE
ADD SUPPLEMENTAL LOG DATA (FOREIGN KEY) COLUMNS;
ALTER DATABASE
ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
Supplemental Logging
Database
Supplemental Logging
To disable supplemental logging at database level:
ALTER DATABASE
DROP SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
ALTER DATABASE
DROP SUPPLEMENTAL LOG DATA (UNIQUE) COLUMNS;
ALTER DATABASE
DROP SUPPLEMENTAL LOG DATA (FOREIGN KEY) COLUMNS;
ALTER DATABASE
DROP SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
Supplemental Logging
Database
Supplemental Logging
To monitor database level supplemental logging:
SELECT
supplemental_log_data_min,
supplemental_log_data_pk,
supplemental_log_data_ui,
supplemental_log_data_fk,
supplemental_log_data_all
FROM v$database;
Supplemental Logging
Log
Groups
Implemented as constraints
Supplemental Logging
Unconditional
Supplemental Log Groups
To specify an unconditional supplemental log group for
primary key column(s):
ALTER TABLE t1
ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
Supplemental Logging
Conditional
Supplemental Log Groups
To specify a conditional supplemental log group for unique
key column(s) and/or bitmap index column(s):
ALTER TABLE t1
ADD SUPPLEMENTAL LOG DATA (UNIQUE) COLUMNS;
Supplemental Logging
Dropping
Supplemental Log Groups
To drop a supplemental log group:
ALTER TABLE t1
DROP SUPPLEMENTAL LOG GROUP t1_g1;
Supplemental Logging
DBA_LOG_GROUPS
view
Describes currently configured supplemental log groups:
OWNER
VARCHAR2(30)
LOG_GROUP_NAME
VARCHAR2(30)
TABLE_NAME
VARCHAR2(30)
LOG_GROUP_TYPE
VARCHAR2(19)
ALWAYS
VARCHAR2(11)
GENERATED
VARCHAR2(14)
Supplemental Logging
DBA_LOG_GROUP_COLUMNS
view
Describes columns in currently configured supplemental log
groups:
OWNER
VARCHAR2(30)
LOG_GROUP_NAME
VARCHAR2(30)
TABLE_NAME
VARCHAR2(30)
COLUMN_NAME
VARCHAR2(4000)
POSITION
NUMBER
LOGGING_PROPERTY
VARCHAR2(6)