Solved

How to find the last update time of each table in Oracle?

Posted on 2008-10-08
9
15,473 Views
Last Modified: 2013-12-19
I have a program that link to a database, however, when I use the program, I want to know which table does it updated? However, this program does not write any timing information nor the tables do not have a column that store the last update time. Therefore, I would like to know does Oracle records the last alteration / update time of each table? If not, are there any other methods that let me find out the last update time? Thanks!
0
Comment
Question by:mawingho
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 9

Assisted Solution

by:jamesgu
jamesgu earned 50 total points
ID: 22675197
SELECT SCN_TO_TIMESTAMP(ORA_ROWSCN) from table_name where ...
0
 

Author Comment

by:mawingho
ID: 22675219
it doesn't work........
0
 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 200 total points
ID: 22675234
How do you define "last update time"?




the ora_rowscn suggested above shows when the commit happened,  not necessarily when the updates occured.

also note,  if the last alteration to a table was a delete, then you don't have a row for the ora_rowscn.

without logs in your application, row level auditing will give you what you want,  after that best you could do would be to go through log miner for scn estimate times.


0
Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 200 total points
ID: 22675237
note, turning auditing on doesn't help with historical timestamps, only as a go-forward solution.
0
 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 200 total points
ID: 22675249
oh and scn_to_timestamp doesn't exist in 9i.  it was introduced in 10g.
0
 
LVL 17

Assisted Solution

by:NicksonKoh
NicksonKoh earned 50 total points
ID: 22675557
If you use TOAD, you can easily see the last DDL date on the table.
Just go to Schema Browser and click on the Tablename. You can see the table creation and last DDL information just above the tabs.
0
 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 200 total points
ID: 22675806
last_ddl_time is when the table was last changed "structurally"  like truncate, create, alter table, etc.

It doesn't account for DML changes:  insert, update, delete
0
 
LVL 10

Assisted Solution

by:dbmullen
dbmullen earned 50 total points
ID: 22678254
it appears you're trying to "reverse engineer" some process

turn on tracing
run the program
turn off tracking
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96533/sqltrace.htm#1018

look at the dump file.
that will show everything that program does.

if tracing isn't an option, you'll have to create an after insert or update or delete trigger on every table..

forget about trying to find what happened already.  just do it again.

0
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 150 total points
ID: 22678311
Otherwise,
If you have "monitoring" option set, just check:

{ALL|DBA|USER}_TAB_MODIFICATIONS

SQL> desc ALL_TAB_MODIFICATIONS
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 TABLE_OWNER                                        VARCHAR2(30)
 TABLE_NAME                                         VARCHAR2(30)
 PARTITION_NAME                                     VARCHAR2(30)
 SUBPARTITION_NAME                                  VARCHAR2(30)
 INSERTS                                            NUMBER
 UPDATES                                            NUMBER
 DELETES                                            NUMBER
 TIMESTAMP                                          DATE
 TRUNCATED                                          VARCHAR2(3)
 DROP_SEGMENTS                                      NUMBER

Open in new window

0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read about achieving the basic levels of HRIS security in the workplace.
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question