閃回查詢(1)

genweihua發表於2010-04-22

練習中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 ;
已連線。
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部落格 ” ,連結:http://blog.itpub.net/22275400/viewspace-660432/,如需轉載,請註明出處,否則將追究法律責任。

相關文章