You are on page 1of 2

How to find when a table was last modified

in oracle
29242 views Less than a minute 4

If you want to find, when a table was last modified like insert,update ,delete, then use the
dictionary table dba_tab_modifications.

SCENARIO:

1. Insert into test data:

SQL[SCOTT@TDB01]SQL>>]insert into TEST values (10);

1 row created.

SQL[SCOTT@TDB01]SQL>>]commit;

Commit complete.

2. Check dba_tab_modification:

SQL[SYS@TCRMDB01]SQL>>]select INSERTS,UPDATES,DELETES,TRUNCATED,TIMESTAMP
from dba_tab_modifications where TABLE_NAME='TEST' and TABLE_OWNER='SCOTT';

no rows selected

As you can see, the dba_tab_modification is not showing any rows. Now you need to flush
the info , to update the dba_tab_modification table.

3.Flush the monitoring Info

SQL[SYS@TCB01]SQL>>]exec DBMS_STATS.FLUSH_DATABASE_MONITORING_INFO;

PL/SQL procedure successfully completed.

SQL[SYS@TDB01]SQL>>]select INSERTS,UPDATES,DELETES,TRUNCATED,TIMESTAMP from


dba_tab_modifications where TABLE_NAME='TEST' and TABLE_OWNER='SCOTT';

INSERTS UPDATES DELETES TRU TIMESTAMP


---------- ---------- ---------- --- ---------
1 0 0 NO 27-MAY-16
Now you should be the able to see the last modified information from dba_tab_modification.
If you want to see, when a DDL change happened to the table , then use the below query.

select owner,object_name,object_type,status,last_ddl_time from dba_objects


where object_name='SCOTT' and object_type='TABLE';

DBA_HIGH_WATER_MARK_STATISTICS and DBA_REGISTRY_HISTORY.

DBA_REGISTRY_HISTORY vs DBA_REGISTRY_SQLPATCH.

You might also like