Oracle flashback flash Query

Source: Internet
Author: User

Select * From ct_cha_readammeterentry as of Timestamp
To_timestamp ('2017-02-27 15:17:00 ', 'yyyy-MM-DD hh24: MI: ss ')
Where to_char (cfbizdate, 'yyyymmdd') = '2013'

And cfaddressno> = '000000' and cfaddressno <= '000000 ';

View version

SQL> select * from V $ version;


Banner

----------------------------------------------------------------

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0-Prod

PL/SQL release 10.2.0.1.0-Production

Core 10.2.0.1.0 Production

TNS for Linux: Version 10.2.0.1.0-Production

Nlsrtl version 10.2.0.1.0-Production


Create a table named test1

SQL> Create Table test1

2 (ID number,

3 name varchar2 (20)

4 );


Create a table named Test2

SQL> Create Table Test2

2 (ID number,

3 name varchar2 (20)

4 );

 

Insert a record in the test1 table

SQL> insert into test1

2 values (1, 'jack ');


1 row created.


SQL> commit;


Commit complete.


View table information

SQL> select * From tab;


Tname tabtype clusterid

-----------------------------------------------

Test1 table

Test2 table


Check the status of the flashback table. No records are recorded.

SQL> select * From user_recyclebin;


No rows selected


Delete table test1

SQL> drop table test1;


Table dropped.


View the table information. The test1 table is no longer available.

SQL> select * From tab;


Tname tabtype clusterid

-----------------------------------------------

Test2 table


View the flashback area. The test1 table exists.

SQL> select object_name, original_name, droptime, createtime from recyclebin;


Object_name original_name droptime createtime

-------------------------------------------------------------------------------------

Bin $ bwec0b3j2elgqkjaztgf0g = $0 test1 2009-07-19: 12: 32: 36 2009-07-19: 12: 20: 05


Restore table test1

SQL>Flashback table test1 to before drop; 


Flashback complete.


Check the status of the flashback table. No records are recorded.

SQL> select object_name, original_name, droptime, createtime from recyclebin;


No rows selected


Check the table information. The test1 table has been restored.

SQL> select * From tab where tname like upper ('test % ');


Tname tabtype clusterid

-----------------------------------------------

Test1 table

Test2 table


The records in the table are also

SQL> select * From test1;


ID name

------------------------------

1 Jack



Permanently delete table test1 in the flash back area

SQL> drop table test1;


Table dropped.


SQL> select * From tab where tname like upper ('test % ');


Tname tabtype clusterid

-----------------------------------------------

Test2 table


SQL> select object_name, original_name, droptime, createtime from recyclebin;


Object_name original_name droptime createtime

----------------------------------------------------------------------------------------------------

Bin $ bwec0b3k2elgqkjaztgf0g = $0 test1 2009-07-19: 12: 42: 25 2009-07-19: 12: 20: 05


Delete a table in the flashback Area

SQL>PurgeTable test1;


Table purged.


SQL> select object_name, original_name, droptime, createtime from recyclebin;


No rows selected


Delete table Test2 directly without entering the flashback area.

SQL> drop table Test2Purge;


Table dropped.


Check that the table does not exist.

SQL> select * From tab;


No rows selected


There are no records in the flash back area.

SQL> select object_name, original_name, droptime, createtime from recyclebin;


No rows selected

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.