Mutual conversion of SCN timestamps and mutual conversion of scn

Source: Internet
Author: User

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


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.