How to monitor data transaction on one table
First, we need to see if there is an attribute "MONITORING" of the table.
Just query 'all_tables':
SQL> select owner,MONITORING from all_tables where TABLE_NAME=''EVENT_BILLING_PRODUCT_T";
OWNER MON
------------------------------ ---
PIN YES
###MONITORING VARCHAR2(3) Whether the table has the MONITORING attribute set
###一般情況下,在建表時我們會經常使用ORACLE的預設引數。而MONITORING這個引數9i 中預設是關閉的, 10g預設為開啟。非預設時使用NOMONITORING引數。
If the value for 'MONITORING' is 'No', we should alter the value:
SQL> alter table EVENT_BILLING_PRODUCT_T monitoring;
Table altered.
Then, query the ALL_TAB_MODIFICATIONS, which describes tables accessible to the current user that have been modified since the last time statistics were gathered on the tables.
###其中記錄了該表或表的PARTITION的INSERT/UPDATE/DELETE/DROP_SEGMENTS/TRUNCAE的次數。但要注意的一點就是:INSERT/UPDATE/DELETE只能記錄一個大概次數。而不是十分精確的次數。以上為ORACLE官方文件提供的 DBA_TAB_MODIFICATIONS欄位及其說明。
SQL> select TABLE_NAME,PARTITION_NAME,INSERTS,UPDATES,DELETES,TIMESTAMP from all_TAB_MODIFICATIONS where table_name='EVENT_BILLING_PRODUCT_T';
TABLE_NAME PARTITION_NAME INSERTS UPDATES DELETES TIMESTAMP
------------------------------ -------------------- ---------- ---------- ---------- ---------
EVENT_BILLING_PRODUCT_T 9140 0 0 07-OCT-11
EVENT_BILLING_PRODUCT_T PARTITION_HISTORIC 4042 0 0 07-OCT-11
EVENT_BILLING_PRODUCT_T PARTITION_LAST 5098 0 0 07-OCT-11
SQL> /
TABLE_NAME PARTITION_NAME INSERTS UPDATES DELETES TIMESTAMP
------------------------------ -------------------- ---------- ---------- ---------- ---------
EVENT_BILLING_PRODUCT_T 9140 0 0 07-OCT-11
EVENT_BILLING_PRODUCT_T PARTITION_HISTORIC 4042 0 0 07-OCT-11
EVENT_BILLING_PRODUCT_T PARTITION_LAST 5098 0 0 07-OCT-11
###需要注意的重要一點,出於保護ORACLE資料庫效能方面的考慮,在XXX_TAB_MODIFICATIONS表中顯示的資料並不是實時的資料,如果需要看到最近發生的最新資料,可以使用DBMS_STAT包來統計最新變化。
SQL> exec dbms_stats.flush_database_monitoring_info;
PL/SQL procedure successfully completed
更進一步的探討,可以參考以下的連結:
Just query 'all_tables':
SQL> select owner,MONITORING from all_tables where TABLE_NAME=''EVENT_BILLING_PRODUCT_T";
OWNER MON
------------------------------ ---
PIN YES
###MONITORING VARCHAR2(3) Whether the table has the MONITORING attribute set
###一般情況下,在建表時我們會經常使用ORACLE的預設引數。而MONITORING這個引數9i 中預設是關閉的, 10g預設為開啟。非預設時使用NOMONITORING引數。
If the value for 'MONITORING' is 'No', we should alter the value:
SQL> alter table EVENT_BILLING_PRODUCT_T monitoring;
Table altered.
Then, query the ALL_TAB_MODIFICATIONS, which describes tables accessible to the current user that have been modified since the last time statistics were gathered on the tables.
###其中記錄了該表或表的PARTITION的INSERT/UPDATE/DELETE/DROP_SEGMENTS/TRUNCAE的次數。但要注意的一點就是:INSERT/UPDATE/DELETE只能記錄一個大概次數。而不是十分精確的次數。以上為ORACLE官方文件提供的 DBA_TAB_MODIFICATIONS欄位及其說明。
SQL> select TABLE_NAME,PARTITION_NAME,INSERTS,UPDATES,DELETES,TIMESTAMP from all_TAB_MODIFICATIONS where table_name='EVENT_BILLING_PRODUCT_T';
TABLE_NAME PARTITION_NAME INSERTS UPDATES DELETES TIMESTAMP
------------------------------ -------------------- ---------- ---------- ---------- ---------
EVENT_BILLING_PRODUCT_T 9140 0 0 07-OCT-11
EVENT_BILLING_PRODUCT_T PARTITION_HISTORIC 4042 0 0 07-OCT-11
EVENT_BILLING_PRODUCT_T PARTITION_LAST 5098 0 0 07-OCT-11
SQL> /
TABLE_NAME PARTITION_NAME INSERTS UPDATES DELETES TIMESTAMP
------------------------------ -------------------- ---------- ---------- ---------- ---------
EVENT_BILLING_PRODUCT_T 9140 0 0 07-OCT-11
EVENT_BILLING_PRODUCT_T PARTITION_HISTORIC 4042 0 0 07-OCT-11
EVENT_BILLING_PRODUCT_T PARTITION_LAST 5098 0 0 07-OCT-11
###需要注意的重要一點,出於保護ORACLE資料庫效能方面的考慮,在XXX_TAB_MODIFICATIONS表中顯示的資料並不是實時的資料,如果需要看到最近發生的最新資料,可以使用DBMS_STAT包來統計最新變化。
SQL> exec dbms_stats.flush_database_monitoring_info;
PL/SQL procedure successfully completed
更進一步的探討,可以參考以下的連結:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/628922/viewspace-708750/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- the procedure:delete the data of one tabledelete
- Table Monitor
- How does one rename a database?Database
- How to Monitor the Progress of a Materialized View Refresh (MVIEW)ZedView
- SAP ECC & APO整合 - Master Data & Transaction Data TransferAST
- 10.monitor web data scriptWeb
- How to Monitor UGA, PGA and Cursor Usage Per SessionSession
- How to use the Automatic Database Diagnostic Monitor(一)Database
- ssis multiple table to one file
- How boltdb Write its Data?
- How To Efficiently Drop A Table With Many Extents
- How to partition a non-partitioned table
- [zt] Data guard monitor 和常用查詢
- how to move a MediaWiki wiki from one server to anotherServer
- How to Rename a Server That Is Not a Data Store ServerServer
- drop apply INSTANTIATION for one tableAPP
- [doc]How To Efficiently Drop A Table With Many Extents
- How To Monitor Remote Windows Machine Using Nagios on LinuxREMWindowsMaciOSLinux
- How to Monitor and Log Network Traffic on Linux Using vnStatLinux
- How to move ASM database files from one diskgroup to anotherASMDatabase
- How to migrate data from Oracle to MSSQLSERVEROracleSQLServer
- How Oracle Uses the Data Dictionary (262)Oracle
- Convert Array of Objects to Data TableObject
- How to Monitor and tune Open and Cached Cursors (Doc ID 1430255.1)
- What is a deadlock and how does one fix deadlock errors?Error
- How to get the exact duration of an audio file in js All In OneJS
- mysqldump的single-transaction和master-dataMySqlAST
- How to get ORACLE_HOME from data dictionaryOracle
- 【CURSOR】How to Monitor and tune Open and Cached Cursors (Doc ID 1430255.1)
- <Learning How to Learn>Week One: Focused versus Diffuse ThinkingThinking
- [轉帖]mysqldump --master-data=2 --single-transactionMySqlAST
- New S4 HANA table browser transaction SE16H
- oracle undo segment header 事務表transaction table系列一OracleHeader
- How To Using Flashback Data Archive (Oracle Total Recall)HiveOracle
- How to Quickly Create a Copy of a Table using Transact-SQLUISQL
- How To Know If An Object (Table / Procedure / View /…) Is Currently BeingObjectView
- [ 丹臣]利用innodb_table_monitor來trace innodb內部資訊
- One more way regarding germany niubian how to remain difficult forREMAI