search
HomeDatabaseMysql TutorialOracle下flashback drop table技术

flashback相当于是不完全恢复,drop table:被删除的表之似乎被改了表名,并没有真的被drop(windows的回收站)--gt;flash dr

flashback相当于是不完全恢复,drop table:被删除的表之似乎被改了表名,,并没有真的被drop(windows的回收站)-->flash dropped table 技术
SQL> show recyclebin
ORIGINAL NAME    RECYCLEBIN NAME                OBJECT TYPE  DROP TIME
---------------- ------------------------------ ------------ -------------------
EDU234           BIN$kW6q/O9z4TDgQKjAFAEkeg==$0 TABLE        2010-09-30:07:53:27

SQL> purge recyclebin;

Recyclebin purged.
SQL> show recyclebin
则没有了,所以我们删除表,如果没有加上purge,是可以利用闪回技术把表恢复回来的
SQL> create table tsql01 (a number);

Table created.

SQL> insert into tsql01 values (1); //创建一张表,插入值,并且提交

1 row created.

SQL> commit;

Commit complete.

SQL> show recyclebin //先看下回收站里有没有被回收的事物,有则purge recyclebin
SQL> drop table tsql01; //并没有purge table tsql01 purge

Table dropped.

SQL> show recyclebin //会出现在recyclebin里面,刚才被删除的表,只不过名字被换成乱七八糟了
ORIGINAL NAME    RECYCLEBIN NAME                OBJECT TYPE  DROP TIME
---------------- ------------------------------ ------------ -------------------
TSQL01           BIN$lIkhIeT93AfgQKjAWgAetg==$0 TABLE        2010-11-08:18:31:39
SQL> select * from "BIN$lIkhIeT93AfgQKjAWgAetg==$0"; //我们可以查找出这个值是多少

A
----------
1

SQL> select * from tsql01; //通过原先的表名是查不到的,因为已经被删除了
select * from tsql01
*
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> flashback table tsql01 to before drop; //闪回删除表恢复,不需要开启闪回的功能

Flashback complete.
SQL> conn /as sysdba
Connected.
SQL> select flashback_on from v$database; //闪回功能是关闭的

FLASHBACK_ON
------------------
NO

SQL>

SQL> select * from tsql01; //表已经恢复了

A
----------
1
所以如果我们确定那张表不要了,又为了不让别人看得见,那就加上purge吧
SQL> create table tsql02 (a number);

Table created.

SQL> insert into tsql02 values(2);

1 row created.

SQL> commit;

Commit complete.

SQL> drop table tsql02 purge;//删除的时候加上了purge

Table dropped.

SQL> show recyclebin //则不会进入recyclebin,recycle默认是开着的
SQL>
#########################

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How does MySQL handle concurrency compared to other RDBMS?How does MySQL handle concurrency compared to other RDBMS?Apr 29, 2025 am 12:44 AM

MySQLhandlesconcurrencyusingamixofrow-levelandtable-levellocking,primarilythroughInnoDB'srow-levellocking.ComparedtootherRDBMS,MySQL'sapproachisefficientformanyusecasesbutmayfacechallengeswithdeadlocksandlacksadvancedfeatureslikePostgreSQL'sSerializa

How does MySQL handle transactions compared to other relational databases?How does MySQL handle transactions compared to other relational databases?Apr 29, 2025 am 12:37 AM

MySQLhandlestransactionseffectivelyusingtheInnoDBengine,supportingACIDpropertiessimilartoPostgreSQLandOracle.1)MySQLusesREPEATABLEREADasthedefaultisolationlevel,whichcanbeadjustedtoREADCOMMITTEDforhigh-trafficscenarios.2)Itoptimizesperformancewithabu

How does MySQL differ from PostgreSQL?How does MySQL differ from PostgreSQL?Apr 29, 2025 am 12:23 AM

MySQLisbetterforspeedandsimplicity,suitableforwebapplications;PostgreSQLexcelsincomplexdatascenarioswithrobustfeatures.MySQLisidealforquickprojectsandread-heavytasks,whilePostgreSQLispreferredforapplicationsrequiringstrictdataintegrityandadvancedSQLf

How does MySQL handle data replication?How does MySQL handle data replication?Apr 28, 2025 am 12:25 AM

MySQL processes data replication through three modes: asynchronous, semi-synchronous and group replication. 1) Asynchronous replication performance is high but data may be lost. 2) Semi-synchronous replication improves data security but increases latency. 3) Group replication supports multi-master replication and failover, suitable for high availability requirements.

How can you use the EXPLAIN statement to analyze query performance?How can you use the EXPLAIN statement to analyze query performance?Apr 28, 2025 am 12:24 AM

The EXPLAIN statement can be used to analyze and improve SQL query performance. 1. Execute the EXPLAIN statement to view the query plan. 2. Analyze the output results, pay attention to access type, index usage and JOIN order. 3. Create or adjust indexes based on the analysis results, optimize JOIN operations, and avoid full table scanning to improve query efficiency.

How do you back up and restore a MySQL database?How do you back up and restore a MySQL database?Apr 28, 2025 am 12:23 AM

Using mysqldump for logical backup and MySQLEnterpriseBackup for hot backup are effective ways to back up MySQL databases. 1. Use mysqldump to back up the database: mysqldump-uroot-pmydatabase>mydatabase_backup.sql. 2. Use MySQLEnterpriseBackup for hot backup: mysqlbackup--user=root-password=password--backup-dir=/path/to/backupbackup. When recovering, use the corresponding life

What are some common causes of slow queries in MySQL?What are some common causes of slow queries in MySQL?Apr 28, 2025 am 12:18 AM

The main reasons for slow MySQL query include missing or improper use of indexes, query complexity, excessive data volume and insufficient hardware resources. Optimization suggestions include: 1. Create appropriate indexes; 2. Optimize query statements; 3. Use table partitioning technology; 4. Appropriately upgrade hardware.

What are views in MySQL?What are views in MySQL?Apr 28, 2025 am 12:04 AM

MySQL view is a virtual table based on SQL query results and does not store data. 1) Views simplify complex queries, 2) Enhance data security, and 3) Maintain data consistency. Views are stored queries in databases that can be used like tables, but data is generated dynamically.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.