Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Query the time of the last dml of a table in the last 5 days

2025-04-08 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Select ORA_ROWSCN from tablename order by 1 desc-- ratio is XX

-- ORA_ROWSCN is block-level by default, that is, all records in a data block are an ORA_ROWSCN, any record in the data block is modified, and the ORA_ROWSCN of all records in the database block will change at the same time.

Select scn,to_char (time_dp,'yyyy-mm-dd hh34:mi:ss') from sys.smon_scn_time where scn > XX order by 1

-- sys.smon_scn_time only records the last 5 days, so the last time the table was modified was longer than 5 days ago, so the exact time could not be found.

The above two sql can also be replaced by the following. Of course, if the SCN exceeds the SCN of the last 5 days, you cannot use the SCN_TO_TIMESTAMP function, otherwise an error will be reported-- ORA-08181: the specified number is not a valid system change number.

Select max (ora_rowscn), to_char (scn_to_timestamp (max (ora_rowscn)), 'yyyy-mm-dd hh34:mi:ss') from tablename

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report