database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
ㆍOracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Oracle Q&A 38646 게시물 읽기
No. 38646
Flashback Table Feature in Oracle Database 10g
작성자
jin_hee(jin_hee)
작성일
2011-06-30 15:59
조회수
4,099

Flashback Table Feature in Oracle Database 10g

 
hi,everyone 
Flashback Query concept was introduced in Oracle9i. But it can't flash back DDLoperations such as dropping a table. Flashback Table feature in Oracle 10g makesthe revival of a dropped table as easy as the execution of few statements.
 
Lets see how Flashback Table Works.....
 
 
SQL> Create table TESTFLASH (id number);
 
SQL> Insert into TESTFLASH values (1);
SQL> Insert into TESTFLASH values (2);
SQL> Insert into TESTFLASH values (3);
SQL> Insert into TESTFLASH values (4);
SQL> Insert into TESTFLASH values (5);
SQL> Commit;
 
SQL> select * from TESTFLASH;
 
        ID
----------
         1
         2
         3
         4
         5
        
 
5 rows selected.
 
 
Let's see the table in the present schema.
==========================================
 
SQL> select * from tab;
 
TNAME                    TABTYPE CLUSTERID
------------------------ ------- ----------
TESTFLASH                TABLE
 
 
Now, we accidentally drop the table:
====================================
 
SQL> drop table TESTFLASH;
 
Table dropped.
 
 
Let's check the status of the table now.
========================================
 
SQL> select * from tab;
 
TNAME                          TABTYPE CLUSTERID
------------------------------ ------- ----------
BIN$04LhcpndanfgMAAAAAANPw==$0 TABLE
 
 
The table TESTFLASH is gone but note the presence of the new table
BIN$04LhcpndanfgMAAAAAANPw==$0. The dropped table TESTFLASH, instead of
completely disappearing, was renamed to a system-defined name. It stays in the
same tablespace, with the same structure as that of the original table. If there
are indexes or triggers defined on the table, they are renamed too, using the
same naming convention used by the table. Any dependent sources such as
procedures are invalidated; the triggers and indexes of the original table are
instead placed on the renamed table BIN$04LhcpndanfgMAAAAAANPw==$0, preserving
the complete object structure of the dropped table.
 
The table and its associated objects are placed in a logical container known as
the "RECYCLE BIN," which is similar to the one in your PC. However, the objects
are not moved from the tablespace they were in earlier; they still occupy the
space there. The RECYCLE BIN is merely a logical structure that catalogs the
dropped objects. Use the following command from the SQL*Plus prompt to see its
content (you'll need SQL*Plus 10.1 to do this):
 
SQL> show recyclebin
 
ORIGINAL NAME    RECYCLEBIN NAME                OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ ------------------
TESTFLASH        BIN$04LhcpndanfgMAAAAAANPw==$0 TABLE        2004-02-16:21:13:31
 
 
This shows the original name of the table, TESTFLASH, as well as the new name in
the recycle bin (BIN$04LhcpndanfgMAAAAAANPw==$0). Use the FLASHBACK TABLE
command to reinstate the table.
 
 
SQL> FLASHBACK TABLE TESTFLASH TO BEFORE DROP;
 
FLASHBACK COMPLETE.
 
Now query the TESTFLASH table:
 
SQL> select * from TESTFLASH;
 
        ID
----------
         1
         2
         3
         4
         5
        
 
5 rows selected.
 
 
Let's see the table in the present schema.
==========================================
 
SQL> SELECT * FROM TAB;
 
TNAME                          TABTYPE CLUSTERID
------------------------------ ------- ----------
TESTFLASH                      TABLE
 
 
The table is reinstated effortlessly. If you check the recycle bin now, it will be empty.
 
SQL> Show Recyclebin
SQL>
 
 
[Top]
No.
제목
작성자
작성일
조회
38649날짜 입력 오류 [1]
레이첼
2011-07-01
5938
38648레코드 복구에 관하여 [1]
초보
2011-07-01
3855
38647디비링크 오류? ORA-002062 [3]
질문
2011-06-30
9161
38646Flashback Table Feature in Oracle Database 10g
jin_hee
2011-06-30
4099
38645데이타 가져오는 쿼리 도움 부탁드립니다. [1]
종이연필
2011-06-30
4664
38644with NAME as (~~~ 어떻게 사용하나요? [2]
냥이
2011-06-29
4022
38642ORA - 06052 에러 [2]
장마철
2011-06-28
4554
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.022초, 이곳 서비스는
	PostgreSQL v16.4로 자료를 관리합니다