oracle 11g database recovery techniques --- 03 supplemental logging

Three supplemental logging ( Supplemental logging )

Supplemental logging is a redo record changes supplemental information vectors, increasing the amount of vector record changes recorded. Oracle Some features require supplemental logging is enabled to function properly or better jobs, such as logminer (Log Miner), Flashback Transaction Query, Flashback affairs.

For insert and delete , conventional redo records documented all fields line is changed, there is nothing to add, but update the exception, not only the old values of all fields is not recorded ( unless update all fields ), sometimes update or lead line migration,

Supplemental logging mainly for the update service, complementing the aim is to restore the true height of the update , in some cases, when an instance and media recovery can not be one hundred percent completion effect, can only obtain more of the remaining logs information

 

1 database-level supplemental logging

In oracle 11g , the default is not enabled

 

TEST@ orcl >select supplemental_log_data_min sl_min,supplemental_log_data_pk sl_pk,supplemental_log_data_ui sl_ui,
supplemental_log_data_fk sl_fk,supplemental_log_data_all sl_all from v$database;  2  

SL_MIN     SL_ SL_ SL_ SL_
-------- --- --- --- ---
NO     NO  NO  NO  NO

 

The minimum supplemental logging is the most basic kind of database-level supplemental logging

LogMiner least dependent complement generated log information to identify the special packet and merging dml redo records generated, the purpose is to allow logminer analysis redo log may be identified by the update line of migration caused row movement.

If the update command causes the line becomes long , in case of insufficient space in the data block row partially migrated (except row header) to another data block, called row migration .

@ Orcl the TEST > the ALTER  Database  the Add Supplemental log the Data; ## minimum supplemental logging enabled
 Database the Altered. 
The TEST @ orcl > the SELECT supplemental_log_data_min SL_MIN from v $ Database ; 
SL_MIN 
- ------ 
YES 
the TEST @ orcl > the ALTER  Database  drop Supplemental log Data; minimal supplemental logging off ##

Enable Minimal supplemental logging is not to generate significant additional costs generated redo record, but also make the log file support logminer and Flashback Transaction Query function, improve resistance to block consideration of the ability of human error, should enable this feature.

Note : Those who enable or disable database-level supplemental logging will result in all shared pool sql command cursor illegal, hard parse rise significantly in the short term .

TEST@ orcl >select count(*) from scott.emp;
  COUNT(*)
----------
    14
TEST@ orcl >select invalidations from v$sql where sql_text='select count(*) from scott.emp';
INVALIDATIONS
-------------
        0
select sql_text,invalidations from v$sql where sql_text like 'select count(*) %';

Key fields complement the log has 4 kinds of key key, unique indexes, and foreign key supplemental logging all fields.

--alter database add supplemental log data (primary key) columns;

Turn on the main premise of key supplemental logging must be turned on the latest addition to the log, shut down as well.

Supplemental logging primary key role in the update adding the old value is modified row redo records the primary key field in the command.

The only index to add logs only when the unique index field is update time will be recorded in this field.

Foreign key supplement is only as the foreign key field is update when changes to its old value before the modification will be recorded.

Supplemental logging all fields , and it supplements the primary key is not the same as for the condition, regardless of which field is Update , all fields (except LOB \ LONG type) of the old values will be recorded.

--alter database add supplemental log data (all) columns;

2 table-level supplemental logging

A log supplement for certain table, you've got to open the database log a minimum supplement.

Table supplementary sub-stage primary key, unique indexes, foreign keys, and full custom fields . 5 types, the former 4 as the kinds of database level corresponding to the type of characteristics.

--alter table scott.emp add supplemental log data (primary key) columns;

--alter table scott.emp add supplemental log group emp_info(first_name,last_name,email);

If only from DML departure angle command performance, no one will enable supplemental logging, it is recommended enable at least minimal supplemental logging, or at least will lose logminer and Flashback Transaction Query function.

 

Guess you like

Origin www.cnblogs.com/yhq1314/p/10938939.html