System Change Number (SCN) This is a sequential counter, identifying precisely a moment in the database.
This is the most accurate way to identify a moment in time.
SQL> SELECT CURRENT_SCN FROM V$DATABASE; -- to get the current change number.
CURRENT_SCN
-----------
300121782
OR
SQL> SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;
GET_SYSTEM_CHANGE_NUMBER
------------------------
300121802
SQL> SELECT ora_rowscn, ename, sal FROM scott.emp
SQL> SELECT ora_rowscn, ename, sal,SCN_TO_TIMESTAMP(ora_rowscn)
SQL> select TIMESTAMP_TO_SCN(to_date('12/5/2010 1:19:43 PM','mm/dd/yyyy HH:MI:SSPM')) SCN from dual; -- timestamp to SCN, It may have a precision of +/- 3 seconds
This is the most accurate way to identify a moment in time.
SQL> SELECT CURRENT_SCN FROM V$DATABASE; -- to get the current change number.
CURRENT_SCN
-----------
300121782
OR
SQL> SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;
GET_SYSTEM_CHANGE_NUMBER
------------------------
300121802
No comments:
Post a Comment