Home » SQL & PL/SQL » SQL & PL/SQL » How to find which Table is Last update? (Oracle 11g,Linux)
How to find which Table is Last update? [message #550626] Wed, 11 April 2012 02:31 Go to next message
7premkumar
Messages: 11
Registered: March 2012
Location: CHENNAI
Junior Member
Hi,

I want to know that How to find which table got last updated and how to find last DDL and DML operation obtained in which table? here I know the table name

SQL> SELECT LAST_DDL_TIME FROM DBA_OBJECTS WHERE OBJECT_NAME='PREM';

LAST_DDL_
---------
20-MAR-12

SQL> TRUNCATE TABLE PREM;

Table truncated.

SQL> SELECT LAST_DDL_TIME FROM DBA_OBJECTS WHERE OBJECT_NAME='PREM';

LAST_DDL_
---------
10-APR-12

Note: With out enable the auditing I want to know that .


Regards
Premkumar R S
Re: How to find which Table is Last update? [message #550634 is a reply to message #550626] Wed, 11 April 2012 03:06 Go to previous messageGo to next message
John Watson
Messages: 3106
Registered: January 2010
Location: Global Village
Senior Member
Welcome to the forum. Please read our OraFAQ Forum Guide and How to use [code] tags and make your code easier to read

If I understand your question correctly, you have already answered the first part: how to find the time of the last DDL. But you also want to find the last DML. AUDIT would be the best way to do that, why do you not want to use it? An alternative woukld be to write a DML trigger, but that would have performance implications.
Re: How to find which Table is Last update? [message #550636 is a reply to message #550626] Wed, 11 April 2012 03:10 Go to previous messageGo to next message
Michel Cadot
Messages: 54167
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Without auditing you have 3 ways:
1/ Use Log Miner
2/ If operation was not so far ago, you can use FLASHBACK_TRANSACTION_QUERY
3/ In 11.2 you can set and use table archiving

Regards
Michel
Re: How to find which Table is Last update? [message #550646 is a reply to message #550634] Wed, 11 April 2012 05:01 Go to previous messageGo to next message
7premkumar
Messages: 11
Registered: March 2012
Location: CHENNAI
Junior Member
Thank you John Watson fro your valuable reply

yes you are right ., But here I know the table name so I can easily got it ., I want to know that what are all the tables are updated past 30 min or 1 Hour and also want to know DML changes DDL time .

Regards
Premkumar R S
Re: How to find which Table is Last update? [message #550654 is a reply to message #550646] Wed, 11 April 2012 05:51 Go to previous messageGo to next message
Michel Cadot
Messages: 54167
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Michel Cadot wrote on Wed, 11 April 2012 10:10
Without auditing you have 3 ways:
1/ Use Log Miner
2/ If operation was not so far ago, you can use FLASHBACK_TRANSACTION_QUERY
3/ In 11.2 you can set and use table archiving

Regards
Michel

Re: How to find which Table is Last update? [message #550668 is a reply to message #550646] Wed, 11 April 2012 07:07 Go to previous messageGo to next message
Barbara Boehmer
Messages: 7668
Registered: November 2002
Location: California, USA
Senior Member
7premkumar wrote on Wed, 11 April 2012 03:01


I want to know that what are all the tables are updated past 30 min or 1 Hour and also want to know DML changes DDL time .


The following will get you DDL within the last hour. For DML, you will need to use other methods.

aSCOTT@orcl_11gR2> create table prem
  2    (some_column  number)
  3  /

Table created.

SCOTT@orcl_11gR2> column object_name format a30
SCOTT@orcl_11gR2> select object_name, last_ddl_time
  2  from   dba_objects
  3  where  last_ddl_time >=
  4  	    (select max (last_ddl_time) - (1/24)
  5  	     from   dba_objects)
  6  order  by last_ddl_time
  7  /

OBJECT_NAME                    LAST_DDL_TIME
------------------------------ -----------------
RLM$EVTCLEANUP                 11-apr-2012 04:30
RLM$SCHDNEGACTION              11-apr-2012 04:45
ORACLE_APEX_WS_NOTIFICATIONS   11-apr-2012 05:00
ORACLE_APEX_PURGE_SESSIONS     11-apr-2012 05:00
ORACLE_APEX_MAIL_QUEUE         11-apr-2012 05:05
PREM                           11-apr-2012 05:05

6 rows selected.

[Updated on: Wed, 11 April 2012 07:07]

Report message to a moderator

Re: How to find which Table is Last update? [message #550795 is a reply to message #550668] Thu, 12 April 2012 07:20 Go to previous message
7premkumar
Messages: 11
Registered: March 2012
Location: CHENNAI
Junior Member
Thanks
Previous Topic: Is it correct way
Next Topic: Case statement with multiple parameters
Goto Forum:
  


Current Time: Tue May 21 21:26:26 CDT 2013

Total time taken to generate the page: 0.13390 seconds