12c in-database archive
測試表,全表掃描54592一致性讀,返回786432行
SQL> select * from p;
786432 rows selected.
786432 rows selected.
Statistics
----------------------------------------------------------
32 recursive calls
2 db block gets
54592 consistent gets
0 physical reads
528 redo size
21312856 bytes sent via SQL*Net to client
577259 bytes received via SQL*Net from client
52430 SQL*Net roundtrips to/from client
3 sorts (memory)
0 sorts (disk)
786432 rows processed
在表上啟用in-database archive
alter table p row archival;
啟用後,表上會多出一個ORA_ARCHIVE_STATE隱藏列
SQL> select substr(column_name,1,22) name, substr(data_type,1,20) data_type, column_id as col_id,
2 segment_column_id as seg_col_id, internal_column_id as int_col_id, hidden_column, char_length
3 from user_tab_cols where table_name='P';
NAME DATA_TYPE COL_ID SEG_COL_ID INT_COL_ID HID CHAR_LENGTH
-------------------- ------------- ------- ---------- ---------- --- -----------
ID NUMBER 1 1 1 NO 0
NAME VARCHAR2 2 2 2 NO 150
SYS_NC00003$ RAW 3 3 YES 0
ORA_ARCHIVE_STATE VARCHAR2 4 4 YES 4000
預設值都是0
SQL> select ORA_ARCHIVE_STATE from p where rownum < 10;
ORA_ARCHIVE_STATE
-----------------------
0
0
0
0
0
0
0
0
0
9 rows selected.
歸檔方式就是更新ORA_ARCHIVE_STATE的值
SQL> update p set ORA_ARCHIVE_STATE = 20 where id >=100;
393216 rows updated.
SQL> commit;
Commit complete.
更新後,被歸檔的行就不可見了,相關資料塊不需要被掃描。
SQL> select * from p;
393216 rows selected.
Statistics
----------------------------------------------------------
209 recursive calls
0 db block gets
29413 consistent gets
2907 physical reads
0 redo size
10460172 bytes sent via SQL*Net to client
288905 bytes received via SQL*Net from client
26216 SQL*Net roundtrips to/from client
22 sorts (memory)
0 sorts (disk)
393216 rows processed
對於需要歷史資料的統計類SQL,可以在session級別設定歸檔資料可見
SQL> alter session set row archival visibility = all;
Session altered.
SQL> select * from p;
786432 rows selected.
Statistics
----------------------------------------------------------
5 recursive calls
0 db block gets
55322 consistent gets
0 physical reads
0 redo size
21312856 bytes sent via SQL*Net to client
577259 bytes received via SQL*Net from client
52430 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
786432 rows processed
啟用後,表上會多出一個ORA_ARCHIVE_STATE隱藏列
SQL> select substr(column_name,1,22) name, substr(data_type,1,20) data_type, column_id as col_id,
2 segment_column_id as seg_col_id, internal_column_id as int_col_id, hidden_column, char_length
3 from user_tab_cols where table_name='P';
NAME DATA_TYPE COL_ID SEG_COL_ID INT_COL_ID HID CHAR_LENGTH
-------------------- ------------- ------- ---------- ---------- --- -----------
ID NUMBER 1 1 1 NO 0
NAME VARCHAR2 2 2 2 NO 150
SYS_NC00003$ RAW 3 3 YES 0
ORA_ARCHIVE_STATE VARCHAR2 4 4 YES 4000
預設值都是0
SQL> select ORA_ARCHIVE_STATE from p where rownum < 10;
ORA_ARCHIVE_STATE
-----------------------
0
0
0
0
0
0
0
0
0
9 rows selected.
歸檔方式就是更新ORA_ARCHIVE_STATE的值
SQL> update p set ORA_ARCHIVE_STATE = 20 where id >=100;
393216 rows updated.
SQL> commit;
Commit complete.
更新後,被歸檔的行就不可見了,相關資料塊不需要被掃描。
SQL> select * from p;
393216 rows selected.
Statistics
----------------------------------------------------------
209 recursive calls
0 db block gets
29413 consistent gets
2907 physical reads
0 redo size
10460172 bytes sent via SQL*Net to client
288905 bytes received via SQL*Net from client
26216 SQL*Net roundtrips to/from client
22 sorts (memory)
0 sorts (disk)
393216 rows processed
對於需要歷史資料的統計類SQL,可以在session級別設定歸檔資料可見
SQL> alter session set row archival visibility = all;
Session altered.
SQL> select * from p;
786432 rows selected.
Statistics
----------------------------------------------------------
5 recursive calls
0 db block gets
55322 consistent gets
0 physical reads
0 redo size
21312856 bytes sent via SQL*Net to client
577259 bytes received via SQL*Net from client
52430 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
786432 rows processed
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26239116/viewspace-1476293/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 12c Rac Set Archive ModeOracleHive
- Oracle 12c 新特性之 資料庫內歸檔(In-Database Archiving)Oracle資料庫Database
- Oracle Database 12c新特性 In-Database Archiving資料庫內歸檔OracleDatabase資料庫
- oracle 12c 資料歸檔 即Using In-Database Archiving featureOracleDatabase
- [20130817]Oracle 12c new feature In-Database Archiving.txtOracleDatabase
- G009-ORACLE-ASK Using In-Database ArchivingOracleDatabase
- Swift iOS : ArchiveSwiftiOSHive
- 更改Archive ModeHive
- 12c 資料泵匯入時禁止生成日誌的引數disable_archive_loggingHive
- standby_archive_dest和log_archive_dest_n區別Hive
- log_archive_dest與log_archive_dest_n區別Hive
- Oracle Flashback Data ArchiveOracleHive
- Flashback Data Archive RequirementsHiveUIREM
- 【12C】資料泵新特性(DISABLE_ARCHIVE_LOGGING+VIEWS_AS_TABLES匯出檢視+LOGTIME)HiveView
- Ten examples of git-archiveGitHive
- MySQL Archive儲存引擎MySqlHive儲存引擎
- git archive命令詳解GitHive
- oracle archive歸檔初步OracleHive
- 【轉】詳解log_archive_dest與log_archive_dest_n區別Hive
- 關於 log_archive_dest與log_archive_dest_n a的區別Hive
- Flashback Data Archive原理詳解Hive
- archive啟用歸檔模式Hive模式
- flashback drop/query/table/database/archiveDatabaseHive
- Windows 下備份 archive logWindowsHive
- Flashback Data Archive (Oracle Total Recall)HiveOracle
- oracle 817 archive err,oracle hangOracleHive
- archive log 歸檔日誌Hive
- jar-The Java Archive Tool (轉)JARJavaHive
- alter system archive log current noswitch!!Hive
- ORA-16019: cannot use LOG_ARCHIVE_DEST_1 with LOG_ARCHIVE_DESTHive
- 【Hudi】原始碼解讀——Archive 流程原始碼Hive
- 【FLASHBACK】Oracle flashback data archive 介紹OracleHive
- LOG_ARCHIVE_DEST_n詳解Hive
- Why Archive, FRA Diskgroup Gets Mounted / DismountedHive
- 11G新特性:FLASHBACK ARCHIVEHive
- oracle archive log 歸檔日誌OracleHive
- 為什麼要在Standby DB上設定log_archive_dest_1 和 standby_archive_destHive
- java Build Path Problems:Archive for required libraryJavaUIHive