954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

last modified date of a table

Hello DBAs,

Can any one guide me how can i get the last modified date(insert/update/delete) of a table?

Regards,
B. Mantri

bmantri
Newbie Poster
9 posts since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

Hello DBAs,

Can any one guide me how can i get the last modified date(insert/update/delete) of a table?

Regards, B. Mantri


try all_tab_modifications or user_tab_modifcations

pilpip
Newbie Poster
1 post since Sep 2007
Reputation Points: 10
Solved Threads: 0
 

Hello pilpil,
Thanks for reply.
but I am not getting any records when selecting from all_tab_modifications or user_tab_modifications.
I tried connecting to both sys and system user. In system user I have created one table TEST and inserted some rows.


SQL> select * from all_tab_modifications where table_name = 'TEST';

no rows selected
Please respond soon!

Thanks,
BMantri

bmantri
Newbie Poster
9 posts since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

If the table has been modified recently and is 10g, you can try

select scn_to_timestamp(max(ora_rowscn))
from test;

Think I've seen things say it's only up to 5 days you can use this.

If you need to and can modify the database, you could always create your own version of the user_tab_modifications by putting an INSERT/UPDATE/DELETE trigger on the tables you want to track and create a small table which holds the same sort of data as the user_tab_modifications does.

Nige

Nige Ridd
Junior Poster in Training
52 posts since Nov 2007
Reputation Points: 13
Solved Threads: 9
 

Hello Nige,

Thanks a lot for your valuable suggestion. It is working with some of my tables but for others it is giving the following error.
SQL> select scn_to_timestamp(max(ora_rowscn)) from SLB_FILE_ATTACHMENTS
2 ;
select scn_to_timestamp(max(ora_rowscn)) from SLB_FILE_ATTACHMENTS
*
ERROR at line 1:
ORA-08181: specified number is not a valid system change number
ORA-06512: at "SYS.SCN_TO_TIMESTAMP", line 1
Do you have any idea about this error and how can I find the last modified date for this kind of tables?
Please help me to fix this issue.


Many many Thanks,
BMantri

bmantri
Newbie Poster
9 posts since Dec 2007
Reputation Points: 10
Solved Threads: 0
 

The easiest way to find is

select * from all_tab_modifications
Mukeshkoshym
Newbie Poster
1 post since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

try:

select to_char(scn_to_timestamp(max(ora_rowscn))) from table_name

arturozz
Newbie Poster
1 post since Feb 2010
Reputation Points: 10
Solved Threads: 0
 

Hello Nige,

ERROR at line 1: ORA-08181: specified number is not a valid system change number ORA-06512: at "SYS.SCN_TO_TIMESTAMP", line 1 Do you have any idea about this error and how can I find the last modified date for this kind of tables? Please help me to fix this issue.

This only works as long as the snapshot is still around. After that, it appears to go into a frozen state. All off my records older than a certain point have the same SCN.

amadensor
Newbie Poster
5 posts since Dec 2009
Reputation Points: 10
Solved Threads: 0
 

This query works:

select dba_objects where object_name='table_name';

Khadhar
Newbie Poster
1 post since Jun 2011
Reputation Points: 7
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You