How to scn map a timestamp using sys.smon_scn_time in Oracle?

In Oracle DB, you can find out when your table was last updated using

SELECT SCN_TO_TIMESTAMP(MAX(ora_rowscn)) from myTable; 

(see here)

The values ​​in the ora_rowscn column are stored in the system change number (SCN) format .

Oracle knows which timestamp corresponds to a particular scn using the sys.smon_scn_time table: enter image description here

As you can see, there are scn, time_dp and some other columns in this table. Entries are added to sys.smon_scn_time every 5 minutes (approximately). Thus, there is no one-to-one relationship between scn and date. But Oracle knows the timestamp for each scn.

So how does the sys.smon_scn_time table work?

And how does Oracle match scn to a timestamp, and what is the accuracy of this mapping?

+4
1

tim_scn_map SCN-. - RAW (1200). 12 . 100 , 3 , SMON 300 . . scn_to_timestamp funtion.

tim_scn_map:

  • 4 time_mp
  • 4 scn_bas
  • 2 scn_wrp
  • 2 " "
+1

Source: https://habr.com/ru/post/1683234/


All Articles