Oracle資料庫減少redo日誌產生方式
說明:紅字的redo size 即為產生日誌的大小
測試環境:rhel6 oracle 11.2.0.4
本次測試在非歸檔和歸檔環境下,利用append和nologging方式插入資料 來減少redo size的大小
(注:本次測試僅在測試環境上測試資料的效能問題,生產環境切勿測試)
一、 非歸檔模式
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /u01/app/oracle/product/12.2.0.1/db_1/dbs/arch
Oldest online log sequence 3
Current log sequence 5
1、object_wangx的資料正常插入一張表object_wangx_normal中
SQL> create table object_wangx_normal as select * from object_wangx where 1=2;
Table created.
SQL> set autotrace traceonly statistics;
SQL> insert into object_wangx_normal select * from object_wangx;
435806 rows created.
Statistics
----------------------------------------------------------
115 recursive calls
47865 db block gets
25491 consistent gets
0 physical reads
69165128 redo size
863 bytes sent via SQL*Net toclient
979 bytes received via SQL*Netfrom client
3 SQL*Net roundtrips to/fromclient
1 sorts (memory)
0 sorts (disk)
435806 rows processed
SQL> commit;
SQL> SET AUTOTRACE OFF;
2、object_wangx的資料append插入一張表object_wangx_append中
SQL> create table object_wangx_append as select * from object_wangx where 1=2;
Table created.
SQL> set autotrace traceonly statistics;
SQL> insert /*+append*/ into object_wangx_append select * from object_wangx;
435806 rows created.
Statistics
----------------------------------------------------------
199 recursive calls
9538 db block gets
8698 consistent gets
0 physical reads
111196 redo size
850 bytes sent via SQL*Net toclient
991 bytes received via SQL*Netfrom client
3 SQL*Net roundtrips to/fromclient
1 sorts (memory)
0 sorts (disk)
435806 rows processed
SQL> commit;
Commit complete.
SQL> SET AUTOTRACE OFF;
3、object_wangx的資料append插入一張nologgng表object_wangx_append_nologging中
SQL>create table object_wangx_append_nologging as select * from object_wangx where1=2;
Tablecreated.
SQL>alter table object_wangx_append_nologging nologging;
Tablealtered.
SQL>set autotrace traceonly statistics;
SQL>insert /*+append*/ into object_wangx_append_nologging select * from object_wangx;
435806rows created.
Statistics
----------------------------------------------------------
206 recursive calls
9536 db block gets
8705 consistent gets
2 physical reads
111020 redo size
850 bytes sent via SQL*Net to client
1001 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
3 sorts (memory)
0 sorts (disk)
435806 rows processed
SQL>commit;
Commitcomplete.
SQL>SET AUTOTRACE OFF;
4、object_wangx的資料append插入一張nologgng表object_wangx_append_nologging_table中,並在表名後加上 nologging關鍵字
SQL>create table object_wangx_append_nologging_table as select * from object_wangx where 1=2;
Tablecreated.
SQL> alter table OBJECT_WANGX_APPEND_NOLOGGING_TABLE nologging;
Tablealtered.
SQL>set autotrace traceonly statistics;
SQL> insert /*+append*/ into object_wangx_append_nologging_table nologging select * from object_wangx;
435806rows created.
Statistics
----------------------------------------------------------
169 recursive calls
9442 db block gets
8645 consistent gets
0 physical reads
104244 redo size
850 bytes sent via SQL*Net to client
1017 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
3 sorts (memory)
0 sorts (disk)
435806 rows processed
SQL>commit;
Commitcomplete.
SQL> SET AUTOTRACE OFF;
二、歸檔模式
SQL>archive log list;
Database log mode Archive Mode
Automaticarchival Enabled
Archivedestination USE_DB_RECOVERY_FILE_DEST
Oldestonline log sequence 3
Next logsequence to archive 5
Currentlog sequence 5
SQL>select count(1) from object_wangx;
COUNT(1)
----------
782880
1、object_wangx的資料正常插入一張表object_wangx__arh_normal中
SQL> create table object_wangx_arh_normal as select * from object_wangx where 1=2;
Table created.
SQL> set autotrace traceonly statistics;
SQL> insert into object_wangx_arh_normal select * from object_wangx;
782880 rows created.
Statistics
----------------------------------------------------------
101 recursive calls
57438 db block gets
30722 consistent gets
0 physical reads
83877640 redo size
838 bytes sent via SQL*Net toclient
820 bytes received via SQL*Netfrom client
3 SQL*Net roundtrips to/fromclient
1 sorts (memory)
0 sorts (disk)
782880 rows processed
SQL> commit;
Commit complete.
SQL> SET AUTOTRACE OFF;
2、object_wangx的資料append插入一張表object_wangx_arh_append中
SQL> create table object_wangx_arh_append as select * from object_wangx where 1=2;
Table created.
SQL> set autotrace traceonly statistics;
SQL> insert /*+append*/ into object_wangx_arh_append select * from object_wangx;
782880 rows created.
Statistics
----------------------------------------------------------
180 recursive calls
11181 db block gets
10374 consistent gets
0 physical reads
84206664 redo size
825 bytes sent via SQL*Net toclient
835 bytes received via SQL*Netfrom client
3 SQL*Net roundtrips to/fromclient
1 sorts (memory)
0 sorts (disk)
782880 rows processed
SQL> commit;
Commit complete.
SQL> SET AUTOTRACE OFF;
3、object_wangx的資料append插入一張nologgng表object_wangx_arg_append_nologging中
SQL>create table object_wangx_arh_append_n as select * from object_wangx where 1=2;
Tablecreated.
SQL>alter table object_wangx_arh_append_n nologging;
Tablealtered.
SQL> set autotrace traceonly statistics;
SQL>insert /*+append*/ into object_wangx_arh_append_n select * from object_wangx;
782880rows created.
Statistics
----------------------------------------------------------
202 recursive calls
11181 db block gets
10392 consistent gets
0 physical reads
109612 redo size
825 bytes sent via SQL*Net to client
836 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
5 sorts (memory)
0 sorts (disk)
782880 rows processed
SQL>commit;
Commitcomplete.
SQL>SET AUTOTRACE OFF;
4、object_wangx的資料append插入一張nologgng表object_wangx_arh_append_nologging_table中,並在表名後加上 nologging關鍵字
SQL>create table object_wangx_arh_append_n_t as select * from object_wangx where1=2;
Tablecreated.
SQL>alter table object_wangx_arh_append_n_t nologging;
Tablealtered.
SQL>set autotrace traceonly statistics;
SQL> insert /*+append*/ into object_wangx_arh_append_n_t nologging select * from object_wangx;
782880rows created.
Statistics
----------------------------------------------------------
226 recursive calls
11181 db block gets
10392 consistent gets
0 physical reads
109568 redo size
825 bytes sent via SQL*Net to client
848 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
5 sorts (memory)
0 sorts (disk)
782880 rows processed
SQL> commit;
Commitcomplete.
SQL>SET AUTOTRACE OFF;
結論:
1、在非歸檔時,insert單獨設定append 即可減少redo log日誌,無需設定表為nologging模式
2、在歸檔時,insert單獨設定append不會減少redo log日誌,在設定append的基礎上 還需要配合設定表為nologging模式才可大量減少redolog日誌
相關文章
- 減少日誌產生量小結
- oracle資料庫mmnl日誌很大Oracle資料庫
- Oracle redo日誌內容探索(一)Oracle Redo
- 達夢8資料庫REDO日誌日常管理方法資料庫
- 資料庫篇:mysql日誌型別之 redo、undo、binlog資料庫MySql型別
- [20180829]減少日誌生成量.txt
- Oracle redo日誌內容探索之二Oracle Redo
- SQLServer資料庫日誌太大處理方式SQLServer資料庫
- 【REDO】Oracle 日誌挖掘,分析歸檔日誌線上日誌主要步驟Oracle
- 達夢資料庫:誤刪除 undo/redo 日誌怎麼辦資料庫
- 分析Oracle資料庫日誌檔案(三)EPOracle資料庫
- 分析Oracle資料庫日誌檔案(二)DOOracle資料庫
- 分析Oracle資料庫日誌檔案(一)HBOracle資料庫
- oracle資料庫歸檔日誌量陡增分析Oracle資料庫
- 檢視Oracle的redo日誌切換頻率Oracle
- oracle丟失的是所有的redo日誌組Oracle
- Oracle實驗6--掌握Oracle資料庫的日誌操作Oracle資料庫
- 【TUNE_ORACLE】Oracle檢查點(四)檢查點對redo日誌的影響和redo日誌大小設定建議Oracle
- 獲得資料庫操作日誌的三種方式資料庫
- 從 Oracle 日誌解析學習資料庫核心原理Oracle資料庫
- 檢視oracle的redo日誌組切換頻率Oracle
- 【LOG】Oracle資料庫清理日誌、跟蹤檔案利器Oracle資料庫
- MySQL更新資料時,日誌(redo log、binlog)執行流程MySql
- MySQL重做日誌(redo log)MySql
- Oracle11g redo log 建立、新增、刪除(重做日誌組,重做日誌檔案)Oracle
- Oracle recover current redo ORA-00600:[4193] (oracle 故障恢復current redo日誌ORA-00600:[4193]報錯)Oracle
- oracle rac+adg調整redo日誌組導致adg備庫ogg抽取程式abendOracle
- oracle 9i臨時表產生過多redoOracle
- MySQL redo與undo日誌解析MySql
- MySQL之事務和redo日誌MySql
- 成為MySQL DBA後,再看ORACLE資料庫(七、日誌體系)MySqlOracle資料庫
- MySQL 日誌系統 redo log、binlogMySql
- oracle 資料庫lsnrctl監聽的日誌路徑和trace檔案Oracle資料庫
- Oracle 例項和RAC叢集下資料庫日誌目錄合集Oracle資料庫
- openGauss資料庫日誌管理指導資料庫
- 瀚高資料庫日誌挖掘方法資料庫
- Java 14的資料記錄將如何改變編碼方式:減少或消除對Lombok依賴 - oracleJavaLombokOracle
- 資料庫新動向 Oracle與微軟割據局面產生資料庫Oracle微軟
- oracle10g DataGuard的日誌傳輸方式Oracle