SHRUNK后的表能用FLASH BACK吗?

[复制链接]
查看11 | 回复7 | 2007-9-26 18:42:10 | 显示全部楼层 |阅读模式
RT
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
UP
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
你觉得他们两个操作有关系吗?
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
应该可以,无论逻辑还是物理的flash back
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
看书上说不行,觉得很奇怪。。。。。。
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
测试了一把:
SQL> select count(*) from test;
COUNT(*)
----------
652080
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2007-07-16 19:14:32
SQL> delete from test where rownum commit;
Commit complete.
SQL> select count(*) from test;
COUNT(*)
----------
552081
SQL> alter table test shrink space;
Table altered.
SQL> FLASHBACK TABLE test TO TIMESTAMP to_date('2007-07-16 19:14:32','YYYY-MM-DD HH24:MI:SS');
Flashback complete.
SQL> select count(*) from test;
COUNT(*)
----------
541427
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2007-07-16 19:21:06
SQL> delete from test where rownum commit;
Commit complete.
SQL> select count(*) from test;
COUNT(*)
----------
441428
SQL> FLASHBACK TABLE test TO TIMESTAMP to_date('2007-07-16 19:21:06','YYYY-MM-DD HH24:MI:SS');
Flashback complete.
SQL> select count(*) from test;
COUNT(*)
----------
541427
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2007-07-16 19:24:05
SQL> delete from test where rownum commit;
Commit complete.
SQL> alter table test shrink space;
Table altered.
SQL> select count(*) from test;
COUNT(*)
----------
441428
SQL> FLASHBACK TABLE test TO TIMESTAMP to_date('2007-07-16 19:24:05','YYYY-MM-DD HH24:MI:SS');
Flashback complete.
SQL> select count(*) from test;
COUNT(*)
----------
359267
每次做完shrink后再flashback,结果错了.
The following DDL operations change the structure of a table, so that you cannot subsequently use the TO SCN or TO TIMESTAMP clause to flash the table back to a time preceding the operation: upgrading, moving, or truncating a table; adding a constraint to a table, adding a table to a cluster; modifying or dropping a column; adding, dropping, merging, splitting, coalescing, or truncating a partition or subpartition (with the exception of adding a range partition).
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
非常好,shrink后改变了rowid,flashback就无法正常使用了,的确是有联系的,有钻研精神,我学10g的时候还没有注意这一点,而且居然没有提示,只是会造成错误结果,不爽,应该直接提示报错的,oracle设计的不好
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
最初由 小人物 发布
[B]测试了一把:
SQL> select count(*) from test;
COUNT(*)
----------
652080
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2007-07-16 19:14:32
SQL> delete from test where rownum commit;
Commit complete.
SQL> select count(*) from test;
COUNT(*)
----------
552081
SQL> alter table test shrink space;
Table altered.
SQL> FLASHBACK TABLE test TO TIMESTAMP to_date('2007-07-16 19:14:32','YYYY-MM-DD HH24:MI:SS');
Flashback complete.
SQL> select count(*) from test;
COUNT(*)
----------
541427
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2007-07-16 19:21:06
SQL> delete from test where rownum commit;
Commit complete.
SQL> select count(*) from test;
COUNT(*)
----------
441428
SQL> FLASHBACK TABLE test TO TIMESTAMP to_date('2007-07-16 19:21:06','YYYY-MM-DD HH24:MI:SS');
Flashback complete.
SQL> select count(*) from test;
COUNT(*)
----------
541427
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2007-07-16 19:24:05
SQL> delete from test where rownum commit;
Commit complete.
SQL> alter table test shrink space;
Table altered.
SQL> select count(*) from test;
COUNT(*)
----------
441428
SQL> FLASHBACK TABLE test TO TIMESTAMP to_date('2007-07-16 19:24:05','YYYY-MM-DD HH24:MI:SS');
Flashback complete.
SQL> select count(*) from test;
COUNT(*)
----------
359267
每次做完shrink后再flashback,结果错了.
The following DDL operations change the structure of a table, so that you cannot subsequently use the TO SCN or TO TIMESTAMP clause to flash the table back to a time preceding the operation: upgrading, moving, or truncating a table; adding a constraint to a table, adding a table to a cluster; modifying or dropping a column; adding, dropping, merging, splitting, coalescing, or truncating a partition or subpartition (with the exception of adding a range partition). [/B]

谢谢兄弟
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行