使用ora_rowscn识别误操作数据时间点
SQL> select gro_id,ora_rowscn from bms_group;
GRO_ID ORA_ROWSCN
---------- ----------
284 584845289
322 584845289
302 584845289
1 584845289
3 584845289
8 584845289
5 584845289
6 584845289
7 584845289
282 584845289
362 584845289
GRO_ID ORA_ROWSCN
---------- ----------
262 584845289
342 584845289
284 612073346
322 612073346
302 612073346
1 612073346
3 612073346
8 612073346
5 612073346
6 612073346
7 612073346
GRO_ID ORA_ROWSCN
---------- ----------
282 612073346
362 612073346
262 612073346
342 612073346
后者的SCN转换一下,正好是误操作的时间:
SQL> select scn_to_timestamp(612073346) from dual;
SCN_TO_TIMESTAMP(612073346)
---------------------------------------------------------------------------
07-SEP-09 05.11.11.000000000 PM
而前者的SCN则来自历史时间,可以信赖:
SQL> select scn_to_timestamp(584845289) from dual;
SCN_TO_TIMESTAMP(584845289)
---------------------------------------------------------------------------
03-SEP-09 04.45.13.000000000 PM
-The End-
By eygle on 2009-09-08 08:09 |
Comments (4) |
Backup&Recovery |
Case | 2391 |
4 Comments
我在網上查,好像默認情況下,ora_rowscn是基於BLOCK的,就是說同一個BLOCK中的所有行都是同一個ora_rowscn,這樣上面的操作會不會不準確?
你够圆滑.
参考:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:517105100346104196
create table dept
(deptno, dname, loc, data,
constraint dept_pk primary key(deptno)
)
ROWDEPENDENCIES
...;
除了特定需要,似乎很少有人启用ROWDEPENDENCIES,除了每行需要6个byte的存储空间,不知道对性能还有多大影响。