flashback技術之---flashback version query
--flashback version query是查詢給定時間段內資料的不同版本,當commit一次時,一個新的版本被建立:
SQL> select * from t;
ID INS_DATE
---------- -----------------
1 20120718 06:05:51
2 20120718 05:37:18
3 20120718 05:37:31
4 20120718 05:58:11
SQL> SELECT versions_startscn, versions_starttime,
2 versions_endscn, versions_endtime,
3 versions_xid, versions_operation,
4 id,ins_date
5 FROM t
6 VERSIONS BETWEEN TIMESTAMP
7 TO_TIMESTAMP('20120718 06:05:01', 'yyyymmdd hh24:mi:ss')
8 AND TO_TIMESTAMP('20120718 05:58:22', 'YYYY-MM-DD HH24:MI:SS');
FROM t
*
ERROR at line 5:
ORA-30052: invalid lower limit snapshot expression
該提示說明undo_retention設定的過低。
SQL> !
[oracle@rhel bin]$ oerr ora 30052
30052, 00000, "invalid lower limit snapshot expression"
// *Cause: The lower limit snapshot expression was below the UNDO_RETENTION
// limit.
// *Action: Specify a valid lower limit snapshot expression.
[oracle@rhel bin]$ exit
exit
SQL> show parameter undo_retention
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_retention integer 900
SQL> alter system set undo_retention =10000;
System altered.
SQL> truncate table t;
Table truncated.
SQL> insert into t values(1,sysdate);
1 row created.
SQL> commit;
Commit complete.
SQL> select DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
314691
SQL> insert into t values(2,sysdate);
1 row created.
SQL> commit;
Commit complete.
SQL> select DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
314696
SQL> insert into t values(3,sysdate);
1 row created.
SQL> commit;
Commit complete.
SQL> select DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
314700
SQL> SELECT versions_startscn,
2 versions_endscn,
3 versions_operation,
4 versions_xid,
5 id,ins_date
6 FROM t
7 VERSIONS BETWEEN SCN 314690 AND 314691 ;
VERSIONS_STARTSCN VERSIONS_ENDSCN V VERSIONS_XID ID INS_DATE
----------------- --------------- - ---------------- ---------- -----------------
1 20120718 07:25:58
SQL> SELECT versions_startscn,
2 versions_endscn,
3 versions_operation,
4 versions_xid,
5 id,ins_date
6 FROM t
7 VERSIONS BETWEEN SCN 314690 AND 314696 ;
VERSIONS_STARTSCN VERSIONS_ENDSCN V VERSIONS_XID ID INS_DATE
----------------- --------------- - ---------------- ---------- -----------------
314694 I 08001100D4000000 2 20120718 07:26:10
1 20120718 07:25:58
SQL> SELECT versions_startscn,
2 versions_endscn,
3 versions_operation,
4 versions_xid,
5 id,ins_date
6 FROM t
7 VERSIONS BETWEEN SCN 314690 AND 314700 ;
VERSIONS_STARTSCN VERSIONS_ENDSCN V VERSIONS_XID ID INS_DATE
----------------- --------------- - ---------------- ---------- -----------------
314699 I 01002600C2000000 3 20120718 07:26:23
314694 I 08001100D4000000 2 20120718 07:26:10
1 20120718 07:25:58
可以看出,一共有三個版本的資料,每提交一次,將建立一個版本。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10972173/viewspace-738211/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- flashback技術之---flashback query
- flashback技術之---flashback Transaction Query
- Oracle閃回技術--Flashback Version QueryOracle
- flashback總結五之Flashback_Query_Version(上)
- oracle10g之flashback version query 和flashback transaction query 實驗Oracle
- flashback version query和 flashback transaction query簡單應用
- flashback總結五之Flashback_Query_Version(下)_補充
- 閃回之 Flashback Query (dml表、過程、函式、包等)、Flashback version Query函式
- oracle 10g flashback version query 和 flashback transaction query實驗Oracle 10g
- flashback技術之---flashback drop
- flashback技術之---flashback table
- flashback技術之---flashback databaseDatabase
- flashback version query in oracle 10gOracle 10g
- flashback總結四之Flashback_Query
- 閃回版本查詢(Flashback Version Query)
- Oracle10g的Flashback version QueryOracle
- flashback總結六之Flashback_Transaction_Query
- [閃回特性之閃回版本查詢]Flashback Version Query
- 聊聊閃回版本查詢Flashback Version Query
- 【實驗】【Flashback】Flash Version Query功能實踐
- Oracle10g的Flashback之Flashback Transaction QueryOracle
- 【Flashback】Flashback Query功能實踐
- Flashback Query Benefits (368)
- 【實驗】【Flashback】Flashback Transaction Query功能實踐
- Oracle OCP 1Z0-053 Q252(Flashback Version Query)Oracle
- Flashback閃回技術
- ORACLE Flashback Query偽列Oracle
- oracle flashback技術詳解Oracle
- Oracle Flashback 技術 總結Oracle
- Oracle Flashback技術總結Oracle
- flashback query閃回資料
- flashback drop/query/table/database/archiveDatabaseHive
- Flashback Query閃回查詢
- Overview of Oracle Flashback Query I (366)ViewOracle
- Overview of Oracle Flashback Query II (367)ViewOracle
- oracle11g flashback技術Oracle
- Oracle Flashback 技術大解密Oracle解密
- ORACLE 11G Flashback Versions QueryOracle