How to determine the last modified date of tables in Oracle ?

For each row in a table, ORA_ROWSCN returns the SCN of the most recent change in the row.?This pseudo-column can be used to approximate when a row was last updated.?ORA_ROWSCN information in table rows can be queried as follows.

For row-based change tracking, the relevant table must be created by specifying ROWDEPENDENCIES.?Unless specified, tables are created as NOROWDEPENDENCIES.?Each row in tables created as ROWDEPENDENCIES will contain an extra 6 bytes of data.

SQL> create table a(id number,ad varchar(50)) ROWDEPENDENCIES;        

ORA_ROWSCN information of rows like below can be queried.

SQL> select to_char(ORA_ROWSCN),ID  from aduruoz.a;

TO_CHAR(ORA_ROWSCN)			 ID
-------------------------- -------
1301894904749				  1
1301894900367				  2
1301894900627				  3
1301894903961				  4	        

The largest ORA_ROWSCN value will also give the date of the most recent change to a table.

SQL> select max(to_char(ORA_ROWSCN)) from aduruoz.a;

MAX(TO_CHAR(ORA_ROWSCN))
------------------------------------------------------------------------------------------------------------------------
1301894904749        

You can convert the ORA_ROWSCN value to date with the following command.

SQL> select scn_to_timestamp(1301894904749) as timestamp from dual;

TIMESTAMP
---------------------------------------------------------------------------
28-MAY-19 02.36.32.000000000 PM        

要查看或添加评论,请登录

Ahmet Duru?z的更多文章

  • Exadata - Disk scrubbing

    Exadata - Disk scrubbing

    Disk scrubbing exists on Exadata cell nodes to automatically repair bad sectors of the disk when the system is idle…

  • Oracle Data Redaction

    Oracle Data Redaction

    Available with the Oracle Advanced Security license, Oracle Data Redaction allows you to mask (redact) data returned…

  • Active requests on Exadata cell node

    Active requests on Exadata cell node

    An active request represents a client- or application-centric view of I/O requests handled by the cell node. You can…

  • SQL Tuning Health-Check Script (SQLHC)

    SQL Tuning Health-Check Script (SQLHC)

    Also known as SQLHC, this tool is used to check the environment in which a single SQL statement is running, Cost-based…

  • Principle of Least Privilege for Oracle databases

    Principle of Least Privilege for Oracle databases

    An important concept in computer security, the principle of least privilege (POLP) is to limit users' access rights to…

  • Read Only Table Partitions

    Read Only Table Partitions

    As of Oracle version 12.2, partitions or sub-partitions of a table can be marked as read-only.

  • Hybrid Columnar Compression

    Hybrid Columnar Compression

    Hybrid Columnar Compression (HCC) is a feature that comes with Oracle Database 11g Release 2 and can be used with…

  • Usefully My Oracle Support (MOS) documentation on Oracle Exadata Database Machine

    Usefully My Oracle Support (MOS) documentation on Oracle Exadata Database Machine

    There are MOS documents on many topics related to Exadata. You can find the most useful of these documents in the list…

社区洞察

其他会员也浏览了