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

How to query the scn of update operation records in the oracle table

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to query the scn of the update operation record in the oracle table". In the daily operation, I believe that many people have doubts on how to query the scn record of the update operation record in the oracle table. The editor consulted all kinds of data and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the question of "how to query the scn of the update operation record in the oracle table". Next, please follow the editor to study!

Oracle queries the last duDML time on the bai data row (row) in the table

The first method of zhi (block-level tracking):

Select ora_rowscn

Dbms_rowid.ROWID_BLOCK_NUMBER (rowid) blockid,scn_to_timestamp (ora_rowscn)

From hs_futures.fuentrust t

Order by scn_to_timestamp (ora_rowscn)

Dbms_rowid.ROWID_BLOCK_NUMBER (rowid): to obtain the IDscn_to_timestamp (ora_rowscn) of the block in which the data dao is located: get the time when the data was most modified and the data was found to have changed. You can check the time when the data was last modified through the above SQL statement. Note that as it is on the same block, as long as there is a DML operation on this block, then the scn of all data is updated. Therefore, the values of ora_rowscn and scn_to_timestamp (ora_rowscn) obtained from the data obtained on the same block as this record have changed accordingly.

The second way (row-level tracking):

Create table hs_futures.fuentrust_test1 rowdependencies asselect * from hs_futures.fuentrust

Use the above statement to create a table based on ROWDEPENDENCIES schema, and then use SQL in the first method to query the two values of ora_rowscn,scn_to_timestamp (ora_rowscn) in the table data, modify one of the records, and then query that value. It is found that only the two values of the modified record have changed. The two values of other records that have not been modified in the same block will not change.

-20200805 I tested it, but found that the ora_rowscn still changed when I modified one of the records.

Create table ttt rowdependencies as select 'thomas_' | | rownum as seq_name from dual connect by rownum

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