Oracle Flashback table的使用 Oracle确保recyclebin是打开的 SQLgt; show parameter recyclebin NAME
Oracle Flashback table的使用
Oracle确保recyclebin是打开的
SQL> show parameter recyclebin
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
recyclebin string ON创建一张表
SQL> create table tab01(id int);
Table created.
SQL> insert into tab01 values(1);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from tab01;
ID
----------
1
SQL> create index ind_id on tab01(id);
Index created.删除表TAB01
18:18:26 SQL> select index_name from ind where table_name='TAB01';
INDEX_NAME
------------------------------
IND_ID
18:18:33 SQL> drop table tab01;
Table dropped.
18:18:41 SQL> show recyclebin
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ -------------------
TAB01 BIN$7E8nf4eZQZzgQKjACzgfMg==$0 TABLE 2013-11-29:18:18:41
18:18:43 SQL> select index_name from ind where table_name='TAB01';
no rows selected
18:18:50 SQL> select * from tab01;
select * from tab01
*
ERROR at line 1:
ORA-00942: table or view does not exist
发现TAB01上的index也被rename,flashback TAB01
18:19:41 SQL> flashback table tab01 to before drop;
Flashback complete.
18:19:51 SQL> select * from tab01;
ID
----------
1
18:19:54 SQL> select index_name from ind where table_name='TAB01';
INDEX_NAME
------------------------------
BIN$7E8nf4eYQZzgQKjACzgfMg==$0rename index
18:23:09 SQL> ALTER INDEX "BIN$7E8nf4eYQZzgQKjACzgfMg==$0" RENAME TO IDX_ID;
Index altered.
18:23:45 SQL> select index_name,status from ind where table_name='TAB01';
INDEX_NAME STATUS
------------------------------ --------
IDX_ID VALID
如果多次删除同一张表也可以指定recyclebin的名称flashback
18:25:29 SQL> select * from tab01;
ID
----------
1
18:25:36 SQL> drop table tab01;
Table dropped.
18:25:50 SQL> create table tab01(id int);
Table created.
18:26:17 SQL> insert into tab01 values (2);
1 row created.
18:26:30 SQL> commit;
Commit complete.
18:26:33 SQL> select * from tab01;
ID
----------
2
18:26:37 SQL> drop table tab01;
Table dropped.
18:26:43 SQL> create table tab01(id int);
Table created.
18:26:46 SQL> insert into tab01 values(3);
1 row created.
18:26:55 SQL> commit;
Commit complete.
18:26:56 SQL> select * from tab01;
ID
----------
3
18:26:59 SQL> drop table tab01;
Table dropped.
18:27:02 SQL> select * from tab01;
select * from tab01
*
ERROR at line 1:
ORA-00942: table or view does not exist18:27:10 SQL> show recyclebin
ORIGINAL NAME RECYCLEBIN NAME OBJECT TYPE DROP TIME
---------------- ------------------------------ ------------ -------------------
TAB01 BIN$7E8nf4edQZzgQKjACzgfMg==$0 TABLE 2013-11-29:18:27:02
TAB01 BIN$7E8nf4ecQZzgQKjACzgfMg==$0 TABLE 2013-11-29:18:26:43
TAB01 BIN$7E8nf4ebQZzgQKjACzgfMg==$0 TABLE 2013-11-29:18:25:50flashback tab01中id值为2的
18:27:51 SQL> flashback table "BIN$7E8nf4ecQZzgQKjACzgfMg==$0" to before drop;
Flashback complete.
18:29:17 SQL> select * from tab01;
ID
----------
2
flashback同时rename
18:30:54 SQL> flashback table "BIN$7E8nf4edQZzgQKjACzgfMg==$0" to before drop rename to tab02;
Flashback complete.
18:31:17 SQL> select * from tab02;
ID
----------
3
也可以根据timestamp或者scn进行表级别的基于时间点的恢复,需要开启row movement
18:32:42 SQL> create table tab03(id int);
Table created.
18:32:55 SQL> insert into tab03 values(1);
1 row created.
18:33:08 SQL> insert into tab03 values(2);
1 row created.
18:33:10 SQL> insert into tab03 values(3);
1 row created.
18:33:12 SQL> commit;
Commit complete.
18:33:14 SQL>
18:33:16 SQL> insert into tab03 values(4);
1 row created.
18:33:23 SQL> commit;
Commit complete.
18:33:25 SQL> select * from tab03;

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

MySQloffersechar, Varchar, text, Anddenumforstringdata.usecharforfixed-Lengthstrings, VarcharerForvariable-Length, text forlarger text, AndenumforenforcingdataAntegritywithaetofvalues.

Optimizing MySQLBLOB requests can be done through the following strategies: 1. Reduce the frequency of BLOB query, use independent requests or delay loading; 2. Select the appropriate BLOB type (such as TINYBLOB); 3. Separate the BLOB data into separate tables; 4. Compress the BLOB data at the application layer; 5. Index the BLOB metadata. These methods can effectively improve performance by combining monitoring, caching and data sharding in actual applications.

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

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.
