How to find out the table was last modified in Oracle?

In my previous article i have given idea about the how to find out backup of table? and questions like that. In this article i would like to give answer of one of the interview question asked to DBA – How to find out the table was last modified in Oracle? There are so many times the developers or DBA need to check who has updated or modified the table.Modification meaning here is nothing but insert,update and delete.We require to use the dictionary table in oracle named dba_tab_modifications.

How to find out the table was last modified in oracle? – Real life Scenario

Step 1 : Insert the data in customer table.

Insert into Customer

values(1,’Amit);

Commit;

Step 2 : We require to check the information in dba_tab_modifications

The following query will give you information about the

select INSERTS,UPDATES,DELETES,TRUNCATED,TIMESTAMP from dba_tab_modifications where TABLE_NAME=’Customer’ and TABLE_OWNER=’Amit’;

Output :

no rows found

If you can see the output the rows are not found. The next step is you require to flush the information and update that information in dba_tab_modification table.

Step 3 : Flush the information and Monitor it

3.Flush the monitoring Information

In this step we require to execute the flush statement of oracle.

exec DBMS_STATS.FLUSH_DATABASE_MONITORING_INFO; 

PL/SQL procedure successfully

select INSERTS,UPDATES,DELETES,TRUNCATED,TIMESTAMP from dba_tab_modifications where TABLE_NAME=’Customer’ and TABLE_OWNER=’Amit’;

Output :

INSERTS    UPDATES    DELETES TRU TIMESTAMP

———- ———- ———- — ————————————

1           0           0 NO  15-AUG-20 

You can see that there is one insert done on customer table. You can also see the timings by which time the insert or update has happened or not.

  select owner,object_name,object_type,status,last_ddl_time from dba_objects where object_name=’Amit’ and object_type=’TABLE’;

Hope you can use these queries to get information about update,insert or delete time or modification time for that table.

Amit S

Oracle Consultant with vast experience in Oracle BI and PL/SQL Development. Amiet is the admin head of this website who contributes by preparing tutorials and articles related to database technologies. He is responsible to manage the content and front-end of the website.

Recent Posts

The Essential Guide to Cryptocurrency Exchange Platform Development for Beginners and Beyond

Introduction Cryptocurrencies took the world by storm, setting up a new financial system and breaking…

5 months ago

Top 20 System Administrator Interview Questions and answers

In my previous article I have given Top 20 technical support interview questions with its…

8 months ago

Desktop Support Scenario Based Interview Questions

In my previous articles I have given 15 most asked desktop support interview questions with…

8 months ago

How Do Business Analysts Use SQL for Their Needs?

A business analyst is someone who is versed in processes of data analysis used for…

8 months ago

Top 15 Control-M Interview Questions with Answers

In my previous article I have already given top questions and answers for Desktop support…

8 months ago

Top 20 SQL Interview Questions for Production Support

In my previous article I have given unix production support interview questions and answers. In…

8 months ago