This knowledge point applies only to versions of Oracle 9i or more.
To view data changes in a table, use the SQL statement: SELECT * from User_tab_modifications;
The fields of the User_tab_modifications table are as follows, and from this table it is easy to find the changes made in the table, delete, increase the record of the situation
Note and how to use:
1, but this table is not updated in real time, the default is 15 minutes update, so you update a table, may not be immediately reflected in the user_tab_modifications.
2. There is a way to do this in real time, which is to perform EXEC dbms_stats before executing select * from User_tab_modifications. Flush_database_monitoring_info; The purpose of this stored procedure is to immediately refresh the dynamic information
3, when executing the above stored procedure error, the error is as follows:
ERROR at line 1:
Ora-20000:insufficient Privileges
Ora-06512:at "SYS. Dbms_stats ", Line 2148
Ora-06512:at "SYS. Dbms_stats ", Line 14135
Ora-06512:at Line 1
Haha error is obvious, no authority, then the right to raise!
4, for the user right, first with the Administrator account login, grant an account execution dbms_stats. The permissions of the Flush_database_monitoring_info.
Grant Analyze any to EPPLM (here is your user name)
5, OK to mention the right to succeed, then return to the original account (EPPLM), and then execute the exec dbms_stats. Flush_database_monitoring_info,ok, no problem.
6. When you execute SELECT * from User_tab_modifications, the record appears.
7. After the flush_database_monitoring_info stored procedure, all previous operations will be submitted!
8, for Oracle10i and the above version, DML operation, can be found in the table, because this feature is turned on by default, if not open, can be opened by this method: ALTER TABLE t monitoring;
Stored procedures:
create or replace procedure Pro_Analyze_And_TableModify is |
3 |
dbms_output.put_line( ‘开始执行,过程很长,请等待‘ ); |
4 |
DBMS_STATS.FLUSH_DATABASE_MONITORING_INFO; --立刻刷新 |
5 |
insert into TableModifications select * from user_tab_modifications; --两个表结构一样 |
6 |
Pro_AnalyzeTables; --执行分析表(调用上一篇的存储过程) |
7 |
dbms_output.put_line( ‘执行成功‘ ); |
8 |
end Pro_Analyze_And_TableModify; |
Data changes on Oracle checklist