How to map SCN with Timestamp before 10g? [ID 365536.1]
|
|
|
Modified 16-MAY-2006Type HOWTOStatus PUBLISHED
|
|
In this Document
Goal
Solution
Applies to:
Oracle Server - Enterprise Edition - Version: 9.2.0.6.0
Information in this document applies to any platform.
In this note, we will help Database Administrators with answers to two common questions:
How can I know the time of last transaction (time of last SCN)?
How can I map SCN with Timestamp prior to 10g?
SCN <-> TIMESTAMP conversion features are available only from Oracle 10g. In 10g, there are two built-in functions to give the timestamp and SCN mapping details--Timestamp_to_scn() and Scn_to_timestamp().
For example: In 10g, you will issue code like,
SQL> select current_scn from v$database;
CURRENT_SCN
---------------------------
1086382
SQL> Select scn_to_timestamp(1086382) from dual;
SCN_TO_TIMESTAMP(1086382)
---------------------------------------------------------------------------
15-DEC-05 09.39.49.000000000 PM
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
However, in earlier releases, while there is a system object - SYS.SMON_SCN_TIME that will provide the SCN to TIME mapping information. There is no conversion facility provided.
SYS.SMON_SCN_TIME will have a maximum of 1440 rows and each record will be for a 5 minute period. Oracle maintains this information for maximum of 5 days after which the records will be recycled.
This means that data is stored 12 times per hour * 24 hours * 5 days=1440 rows.
SCN value is stored internally as :
i. SCN_wrap
ii. SCN_base
Whenever the SCN is incremented, the BASE component is incremented first unil it reaches it maximum. Once the BASE reaches the maximum value allowed, it is initialized to zero again after incrementing the WRAP by 1.
Using this logic, we can calculate the timestamp of the SCN as follows:
(SCN_WRP * 4294967296) + SCN_BAS should give us the SCN in the number format
To get the time/date for an SCN value in 9i, use the following example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- (a) Get the current SCN base.
SQL>select max(scn_bas) SCN_BASE from smon_scn_time;
1603342197
--(b) Get the complete SCN and the timestamp.
SQL> alter session set NLS_DATE_FORMAT='DD-MON-YY HH:MI:SS';
SQL> select time_dp TIMESTAMP, scn_wrp*4294967296+SCN_bas SCN from smon_scn_time where
scn_bas='1603342197';
TIMESTAMP SCN
------------------ ----------
28-JUL-06 05:31:08 8252235517813
------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
网上资源: http://tianlesoftware.download.csdn.net
相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx
DBA1 群:62697716(满); DBA2 群:62697977(满)
DBA3 群:62697850 DBA 超级群:63306533;
聊天 群:40132017
--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请
分享到:
相关推荐
Edifier.Speaker.Tools.v1.01.scn
PCB设计 SCN-2-19 AD封装PCB设计 SCN-2-19 AD封装PCB设计 SCN-2-19 AD封装PCB设计 SCN-2-19 AD封装PCB设计 SCN-2-19 AD封装PCB设计 SCN-2-19 AD封装PCB设计 SCN-2-19 AD封装PCB设计 SCN-2-19 AD封装PCB设计 SCN-2-19...
这个文档描述了在 12c 下使用跨平台增量备份的步骤,关于 11g 下的步骤,请您参考 Note:1389592.1。 跨平台增量备份特性并不能减少 XTTS 的其它步骤花费的时间,比如元数据导出/导入。因此,如果数据库内有很多元数据...
Commit SCN ..................................................................................................................... 45 Commit Cleanout .......................................................
ASIO4ALL_2_10_SCN.exe asio声卡驱动,低延时
本文将详细介绍oracle SCN跟TIMESTAMP之间转换,需要的朋友可以参考下
随机配置网络SCN实现的matlab代码——亲测可用
Edifier.EasyVol.ver1.0.scn 自定义热键控制声音
Edifier.Speaker.Tools.v1.01.scn.zip 煲机软件
在 2019年 6月 23日 ,已经按照Oracle的建议进行打补丁的系统会自动生成新的SCN 生成量,但还是没有从根上解决SCN 耗尽的问题,今天我们通过Oracle 官方的包 dbms_scn.GetCurrentSCNParams 进行SCN 的监控,主要是...
漫步者煲机软件Edifier.Speaker.Tools.v1.01.scn
本文档涉及以下知识 1、10G to 11G ogg搭建 2、基于scn的数据泵导出 3、基于SCN号的ogg 进程应用 从而达到将表从10g无缝迁移到11g的目的
Oracle 数据库在2019年 6月23日自动生效了新的SCN 生成的量由以前的16K 涨导 32K,但还是没有根本上解决问题,历史遗留问题还有可能发生,所以我们需要继续监控数据库 SCN 问题
针对Oracle 在 2019年 6月23日后,新SCN 策略生效后,我们开始对数据库 Oracle scn 监控
c语言应用实例,字符屏幕函数 ,文本窗口颜色的设置,和窗口中文本的输入。
对使用dblink的数据库,执行his_scn.sql脚本,检查SCN变动的历史记录; ——由于本人平时也会下载一些资源,所以非常抱歉对该资源收取C币,还望理解。
Oracle SCN 的类别,以及在恢复过程中各自的作用。
BLOG_Oracle_lhr_Oracle SCN的一点研究.pdfBLOG_Oracle_lhr_Oracle SCN的一点研究.pdf
右侧大图,左侧小图幻灯片,切换滚动菜单,图片新闻
ASIO4ALL_2_10_SCN