SCN_TO_TIMESTAMP 如何工作?
SCN 本身编码时间戳还是从某个表中查找。
他在 AskTom 帖子中解释说,+/-3 秒的时间戳存储在 smon_scn_time 的原始字段中。 这是函数获取值的地方吗?
如果是这样,那么该表什么时候被清除(如果有的话)? 如果是这样,是什么触发了清除?
如果是,是否就无法将旧 SCN 转换为时间戳?
如果这是不可能的,那么它将消除该字段的任何长期使用(阅读:审计)。
如果我将该函数放入查询中,加入该表会更快吗?
如果是这样,有人知道如何隐藏原始列吗?
Does the SCN itself encode a timestamp or is it a lookup from some table.
From an AskTom post he explains that the timestamp to +/-3seconds is stored in raw field in smon_scn_time. IS that where the function is going to get the value?
If so, when is that table purged if ever? If so, what triggers that purge?
If it is, does that make it impossible to translate old SCN's to Timestamps?
If it's impossible, then it eliminates any uses of that field that are long term things (read: auditing).
If I put that function in a query, would joining to that table be faster?
If so, anyone know how to covert that Raw column?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SCN 不编码时间值。 我相信这是一个自动递增的数字。
我猜测 SMON 每次增加 SCN 时都会向 SMON_SCN_TIME (或它下面的任何表)插入一行,包括当前时间戳。
我查询了几个数据库中记录的最小时间戳,它们都可以回溯到大约 5 天,并且表中的行数略低于 1500 行。 所以它小于实例的生命周期。
我想数据保存时间的下限可能由 DB_FLASHBACK_RETENTION_TARGET 参数确定,默认为 1 天。
我建议使用该功能,他们可能已经提供了该功能,以便他们可以随意更改内部结构。
不知道 RAW 列 TIM_SCN_MAP 包含什么,但 TIME_DP 和 SCN 列似乎可以为您提供映射。
The SCN does not encode a time value. I believe it is an autoincrementing number.
I would guess that SMON is inserting a row into SMON_SCN_TIME (or whatever table underlies it) every time it increments the SCN, including the current timestamp.
I queried for the minimum recorded timestamp in several databases and they all go back about 5 days and have a little under 1500 rows in the table. So it is less than the instance lifetime.
I imagine the lower bound on how long the data is kept might be determined by the DB_FLASHBACK_RETENTION_TARGET parameter, which defaults to 1 day.
I would recommend using the function, they've probably provided it so they can change the internals at will.
No idea what the RAW column TIM_SCN_MAP contains, but the TIME_DP and SCN column would appear to give you the mapping.