闪回查找(1)

练习www.oracle_base.com中10g关于闪回的例子:

Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>sqlplus/nolog

SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 4月 22 12:17:00 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn system/system@orcl;
已连接。
SQL> create user test identified by test;

用户已创建。

SQL> grant dba to test;

授权成功。

SQL> create table flash_table( id,number(10));
create table flash_table( id,number(10))
                             *
第 1 行出现错误:
ORA-00904: : 标识符无效


SQL> create table flash_table( id number(10));

表已创建。

SQL> select current_scn,to_char(systimestamp,'yyyy-mm-dd hh24:mi:ss') from v$dat
abase;

CURRENT_SCN TO_CHAR(SYSTIMESTAM
----------- -------------------
     826961 2010-04-22 12:31:16

SQL> insert into flash_table(id) values(1);

已创建 1 行。

SQL> select count(*) from flash_table;

  COUNT(*)
----------
         1

SQL> select count(*) from flash_table as of timestamp to_timestamp('2010-04-21 1
3:31:16','yyy-mm-dd hh24:mi:ss');
select count(*) from flash_table as of timestamp to_timestamp('2010-04-21 13:31:
16','yyy-mm-dd hh24:mi:ss')
                                                              *
第 1 行出现错误:
ORA-01862: 数字值与格式项的长度不匹配


SQL> select count(*) from flash_table as of timestamp to_timestamp('2010-04-21 1
3:31:16','yyyy-mm-dd hh24:mi:ss');
select count(*) from flash_table as of timestamp to_timestamp('2010-04-21 13:31:
16','yyyy-mm-dd hh24:mi:ss')
                     *
第 1 行出现错误:
ORA-01466: 无法读取数据 - 表定义已更改


SQL> select count(*) from flash_table as of timestamp to_timestamp('2010-04-21 1
3:31:16','yyyy-mm-dd hh24:mi:ss');
select count(*) from flash_table as of timestamp to_timestamp('2010-04-21 13:31:
16','yyyy-mm-dd hh24:mi:ss')
                     *
第 1 行出现错误:
ORA-01466: 无法读取数据 - 表定义已更改


SQL> select count(*) from flash_table as of 826961;
select count(*) from flash_table as of 826961
                                       *
第 1 行出现错误:
ORA-00905: 缺失关键字


SQL> select count(*) from flash_table as of scn 826961;

  COUNT(*)
----------
         0

SQL> select count(*) from flash_table as of timestamp to_timestamp('2010-04-22 1
3:31:16','yyyy-mm-dd hh24:mi:ss');
select count(*) from flash_table as of timestamp to_timestamp('2010-04-22 13:31:
16','yyyy-mm-dd hh24:mi:ss')
                     *
第 1 行出现错误:
ORA-08186: 指定的时间戳无效


SQL> select count(*) from flash_table as of timestamp to_timestamp('2010-04-22 1
2:31:16','yyyy-mm-dd hh24:mi:ss');

  COUNT(*)
----------
         0

SQL>

请使用浏览器的分享功能分享到微信等