ITPub博客

首页 > 数据库 > Oracle > 闪回查找(1)

闪回查找(1)

原创 Oracle 作者:genweihua 时间:2010-04-22 12:41:09 0 删除 编辑

练习中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>

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

下一篇: OCI程序的编译
请登录后发表评论 登录
全部评论
事了拂衣去,深藏功与名!

注册时间:2009-08-28

  • 博文量
    114
  • 访问量
    623800