Saturday, October 2, 2010

oracle scn

SCN can refer to:

System Change Number - A number, internal to Oracle that is incremented over time as change vectors
are generated, applied, and written to the Redo log.

System Commit Number - A number, internal to Oracle that is incremented with each database COMMIT.


Note: System Commit Numbers and System Change Numbers share the same internal sequence generator.

The system change number (SCN) is an ever-increasing value that uniquely identifies
a committed version of the database. Every time a user commits a transaction,
Oracle records a new SCN. You can obtain SCNs in a number of ways,
from the alert log. You can then use the SCN as an identifier for purposes of
recovery. Oracle uses SCNs in control files, datafile headers, and redo records. Every redo log
file has both a log sequence number and low and high SCN. The low SCN records
the lowest SCN recorded in the log file, while the high SCN records the highest SCN
in the log file.

It is an unique incremental number in the database (as your clock time).

The SCN number is incremented every 3 seconds. This number is very useful while recovering the database or instance.
All the datafile headers will have the same scn number when the instance is shutdown normally.
You can get the current scn number from dbms_flashback.get_system_change_number or if you are using 10g your can query v$database

No comments:

Post a Comment