Thursday, 20 October 2011

When is last time DML issues on table

Today I have seen interesting scenerio, after the database migration one user complain of missing records. how can db migration result in missing records logically it cannot be possible. Then started looking for information when was the last dml happened on my table. I got the result and that was even before migration so might be they were not updated.

->In our scenerio auditing was disabled so that is why I used ora_rowscn

Here is how we can query.

Table A resides in schema A.

SQL> select max(ora_rowscn), scn_to_timestamp(max(ora_rowscn)) from a.a;

SQL> insert into a.a values(3);

1 row created.

SQL> select max(ora_rowscn), scn_to_timestamp(max(ora_rowscn)) Modified from a.a
;

MAX(ORA_ROWSCN) MODIFIED
--------------- ------------------------------
709093 20-OCT-11 14.13.01.000000000

SQL> commit;

Commit complete.

SQL> select max(ora_rowscn), scn_to_timestamp(max(ora_rowscn)) Modified from a.a
;

MAX(ORA_ROWSCN) MODIFIED
--------------- ------------------------------
709229 20-OCT-11 14.19.17.000000000

Here you can see the timestamp of last DML.

No comments:

Post a Comment