关于oracle 9i的闪回的一个错误

引自: http://space.itpub.net/22275400/viewspace-626577

今天学习 oracle 9i的 闪回操作,一开始就不明白怎么操作,开始是瞎鼓捣的,还真的找回了一次删除了的数据,庆幸了一下,不过以后报出: ora-01446 无法读取数据,表定义已经更改。我到网上查了一下,关于这个错误的资料不是很多,有一篇博客上说要等五分钟后才能执行闪回操作,我 测试了好几次,都失败了。最后自己仔细想想,使用 scn和timestamp,不会受到什么时间限制,找回以前的数据,怎么可能要等五分钟呢?况且还是从回滚段查出数据?
最后,我有看了一遍最开始成功的闪回的语句,发现了错去所在,原来忘记执行excute dbms_flashback.disable这一语句。
下边是我学习的语句:
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:Documents and SettingsAdministrator>sqlplus/nolog
SQL*Plus: Release 9.2.0.1.0 - Production on 星期一 2月 1 15:11:53 2010
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> conn sys/sys@orastudyas sysdba;
已连接。
SQL> create user test identified by test;
用户已创建
SQL> grant connect,resource to test;
授权成功。
SQL> grant execute on dbms_flashback to test;
授权成功。
SQL> conn test/test;
已连接。
SQL> create table test as select * from v$datafiles;
create table test as select * from v$datafiles
*
ERROR 位于第 1 行:
ORA-00942: 表或视图不存在

SQL> create table test as select * from sys.dual;
表已创建。
SQL> select * from test;
D
-
X
SQL> select dbms_flashback.get_change_number from dual;
select dbms_flashback.get_change_number from dual
*
ERROR 位于第 1 行:
ORA-00904: "DBMS_FLASHBACK"."GET_CHANGE_NUMBER": 无效的标识符

SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
304810
SQL> delete from test;
已删除 1 行。
SQL> commit;
提交完成。
SQL> select * from test as of scn 304810;
select * from test as of scn 304810
*
ERROR 位于第 1 行:
ORA-01466: 无法读数据 - 表定义已更改

SQL> select * from test as of scn 304810;
select * from test as of scn 304810
*
ERROR 位于第 1 行:
ORA-01466: 无法读数据 - 表定义已更改

SQL> select * from test as of scn 304810;
select * from test as of scn 304810
*
ERROR 位于第 1 行:
ORA-01466: 无法读数据 - 表定义已更改

SQL> select * from test as of scn 304810;
select * from test as of scn 304810
*
ERROR 位于第 1 行:
ORA-01466: 无法读数据 - 表定义已更改

SQL> select * from test as of scn 304810;
select * from test as of scn 304810
*
ERROR 位于第 1 行:
ORA-01466: 无法读数据 - 表定义已更改

SQL> select * from test;
未选定行
SQL> select * from test as of scn 304810;
select * from test as of scn 304810
*
ERROR 位于第 1 行:
ORA-01466: 无法读数据 - 表定义已更改

SQL> set time on
15:33:37 SQL> select * from test;
未选定行
15:34:05 SQL> drop table test;
表已丢弃。
15:35:38 SQL> commit;
提交完成。
15:35:43 SQL> create table test(id int);
表已创建。
15:54:08 SQL> insert table test(1);
insert table test(1)
*
ERROR 位于第 1 行:
ORA-00925: 缺失 INTO 关键字

16:00:49 SQL> insert into test values(1);
已创建 1 行。
16:01:29 SQL> insert into test values(2);
已创建 1 行。
16:01:39 SQL> insert into test values(3);
已创建 1 行。
16:01:46 SQL> execute dbms_flashback.disable;
PL/SQL 过程已成功完成。
16:03:17 SQL> create table rec as select dbms_flashback.get_system_change_number
from dual;
表已创建。
16:05:16 SQL> select * from rec;
GET_SYSTEM_CHANGE_NUMBER
------------------------
314071
16:05:26 SQL> delete from test where id=1;
已删除 1 行。
16:05:46 SQL> commit;
提交完成。
16:05:50 SQL> select * from test as of scn 314071;
ID
----------
1
2
3
16:06:38 SQL> inset into test select * from test as of scn 314071;
SP2-0734: 未知的命令开头 "inset into..." - 忽略了剩余的行。
16:27:33 SQL> insert into test select * from test as of scn 314071;
已创建3行。
16:27:47 SQL> select * from test;
ID
----------
2
3
1
2
3
16:27:59 SQL>
[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/276487/viewspace-1031077/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/276487/viewspace-1031077/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值