ITPub博客

首页 > 数据库 > Oracle > 关于oracle 9i的闪回的一个错误

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

原创 Oracle 作者:willing66 时间:2010-02-02 19:00:18 0 删除 编辑

引自: 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> connsys/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博客 ” ,链接:https://blog.itpub.net/276487/viewspace-1031077/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2008-10-22

  • 博文量
    100
  • 访问量
    183663