Mutual conversion of SCN timestamps and mutual conversion of scn
SQL> select * from v $ version where rownum = 1;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-Production
SQL>! Cat/etc/issue
Enterprise Linux Server release 5.5 (Carthage)
Kernel \ r on an \ m
Oracle 10g provides two new functions for converting scn and timestamp. These two functions are scn_to_timestamp and timestamp_to_scn. The conversion between the two functions brings great convenience to managers.
Before 10 Gb, oracle could not obtain the correspondence between time and scn through the function (generally obtained through logmnr analysis logs, but this conversion relies on internal data records of the database, for long-standing scn, conversion is not allowed.
Obtain the current database scn:
SQL> select CURRENT_SCN from v $ database;
CURRENT_SCN
-----------
9501880
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
9502397
SQL> select distinct imestamp from dual;
SYSTIMESTAMP
---------------------------------------------------------------------------
-15 01.30.16.101027 PM +
SQL & gt; select scn_to_timestamp (9501954) from dual;
SCN_TO_TIMESTAMP (9501954)
---------------------------------------------------------------------------
09-6-15 01.30.15.000000000 pm
SQL> select timestamp_to_scn (scn_to_timestamp (9501954) from dual;
TIMESTAMP_TO_SCN (SCN_TO_TIMESTAMP (9501954 ))
-------------------------------------------
9501952