search
HomeDatabaseMysql TutorialOracle 六大闪回技术,flashback

Flashback 技术是以Undo segment中的内容为基础的, 因此受限于UNDO_RETENTON参数。要使用flashback 的特性,必须启用自动撤销管

Flashback 技术是以Undo segment中的内容为基础的, 因此受限于UNDO_RETENTON参数。
要使用flashback 的特性,必须启用自动撤销管理表空间。
在Oracle 11g里又出了一个新特性:Oracle Flashback Data Archive.
FDA通过将变化数据另外存储到创建的闪回归档区(Flashback Archive)中,以和undo区别开来,
这样就可以为闪回归档区单独设置存储策略,使之可以闪回到指定时间之前的旧数据而不影响undo策略。

在Oracle 10g中, Flash back家族分为以下成员:
Flashback Database,
Flashback Drop,
Flashback Query(分Flashback Query,Flashback Version Query,
Flashback Transaction Query 三种)
和Flashback Table。

Oracle 11g中闪回新特性 :闪回归档

 

 

Oracle 11g Flashback Data Archive(闪回数据归档)

Oracle Flashback闪回机制

Oracle Flashback database

Flashback table快速恢复误删除的数据

Oracle 备份恢复:Flashback闪回

1 闪回恢复区(Flashback Recovery Area)
在oracle 9i中引入flashback查询,以便能在需要的时候查到过去某个时刻的一致性数据,
依赖于undo表空间存储的信息来闪回查询以前的版本,当然这个受限于undo表空间的大小,
以及保留策略。如果undo 被覆盖了就不能进行查询。

oracle10g中增强了闪回查询的功能,并且提供了将整个数据库回退到过去某个时刻的能力,
这是通过引入一种新的flashback log实现的。flashback log有点类似redo log,
只不过redo log将数据库往前滚,flashback log则将数据库往后滚。
为了保存管理和备份恢复相关的文件,oracle10g提供了一个叫做闪回恢复区(Flashback recovery area),
这个区域默认创建在oracle_base目录下。 可以将所有恢复相关的文件,
比如flashback log,archive log,backup set等,,放到这个区域集中管理。

1.1 设置闪回恢复区
闪回恢复区主要通过3个初始化参数来设置和管理:
    db_recovery_file_dest:指定闪回恢复区的位置
    db_recovery_file_dest_size:指定闪回恢复区的可用空间大小
    db_flashback_retention_target:指定数据库可以回退的时间,单位为分钟,
    默认1440分钟,也就是一天。当然,实际上可回退的时间还决定于闪回恢复区的大小,
    因为里面保存了回退所需要的flash log。
    所以这个参数要和db_recovery_file_dest_size配合修改。

 
SQL> ALTER SYSTEM SET db_recovery_file_dest_size=3g SCOPE=BOTH;

System altered.

SQL> ALTER SYSTEM SET db_recovery_file_dest=' D:/app/Administrator/flash_recovery_area ' SCOPE=BOTH;

System altered.

SQL> show parameter db_recovery_file_dest

NAME                            TYPE                VALUE
---------------------------    -----------          ------------------------------
db_recovery_file_dest          string              D:/app/Administrator/flash_recovery_area
db_recovery_file_dest_size      big integer          3852M
SQL> show parameter db_flashback

NAME                            TYPE        VALUE
----------------------------    --------    ------------------------------
db_flashback_retention_target  integer      1440

我们看到db_flashback_retention_target 默认是1440分钟,即24 小时,
需要注意的是该参数虽然未直接指定flash recovery area大小,但却受其制约,
举个例子假如数据库每天有10%左右的数据变动的话,如果该初始化参数值设置为1440,
则flash recovery area 的大小至少要是当前数据库实际容量的10%,
如果该初始化参数设置为2880,则flash recovery area 的大小就至少是数据库所占容量的20%。

 

修改该参数:

SQL>alter system set db_flashback_retention_target=2880 scope=both;

 

1.2  取消闪回恢复区
将db_recovery_file_dest参数设置为空,可以停用闪回恢复区。
如果已经启用flashback database,则不能取消闪回恢复区。

SQL> alter system set db_recovery_file_dest='';

 alter system set db_recovery_file_dest=''

*

第 1 行出现错误:
ORA-02097: 无法修改参数, 因为指定的值无效
ORA-38775: 无法禁用恢复区 - 闪回数据库已启用
SQL> shutdown immediate

数据库已经关闭。

已经卸载数据库。

ORACLE 例程已经关闭。

SQL> startup mount;

ORACLE 例程已经启动。
Total System Global Area  849530880 bytes
Fixed Size                  1377896 bytes
Variable Size            637536664 bytes
Database Buffers          205520896 bytes
Redo Buffers                5095424 bytes
数据库装载完毕。

SQL> alter database flashback off;

数据库已更改。

SQL> alter database open;

数据库已更改。

SQL> alter system set db_recovery_file_dest='';

系统已更改。

SQL> show parameter db_recovery_file_dest

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
Adding Users to MySQL: The Complete TutorialAdding Users to MySQL: The Complete TutorialMay 12, 2025 am 12:14 AM

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.

Mastering MySQL String Data Types: VARCHAR vs. TEXT vs. CHARMastering MySQL String Data Types: VARCHAR vs. TEXT vs. CHARMay 12, 2025 am 12:12 AM

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

MySQL: String Data Types and Indexing: Best PracticesMySQL: String Data Types and Indexing: Best PracticesMay 12, 2025 am 12:11 AM

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.

MySQL: How to Add a User RemotelyMySQL: How to Add a User RemotelyMay 12, 2025 am 12:10 AM

ToaddauserremotelytoMySQL,followthesesteps:1)ConnecttoMySQLasroot,2)Createanewuserwithremoteaccess,3)Grantnecessaryprivileges,and4)Flushprivileges.BecautiousofsecurityrisksbylimitingprivilegesandaccesstospecificIPs,ensuringstrongpasswords,andmonitori

The Ultimate Guide to MySQL String Data Types: Efficient Data StorageThe Ultimate Guide to MySQL String Data Types: Efficient Data StorageMay 12, 2025 am 12:05 AM

TostorestringsefficientlyinMySQL,choosetherightdatatypebasedonyourneeds:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseTEXTforlong-formtextcontent.4)UseBLOBforbinarydatalikeimages.Considerstorageov

MySQL BLOB vs. TEXT: Choosing the Right Data Type for Large ObjectsMySQL BLOB vs. TEXT: Choosing the Right Data Type for Large ObjectsMay 11, 2025 am 12:13 AM

When selecting MySQL's BLOB and TEXT data types, BLOB is suitable for storing binary data, and TEXT is suitable for storing text data. 1) BLOB is suitable for binary data such as pictures and audio, 2) TEXT is suitable for text data such as articles and comments. When choosing, data properties and performance optimization must be considered.

MySQL: Should I use root user for my product?MySQL: Should I use root user for my product?May 11, 2025 am 12:11 AM

No,youshouldnotusetherootuserinMySQLforyourproduct.Instead,createspecificuserswithlimitedprivilegestoenhancesecurityandperformance:1)Createanewuserwithastrongpassword,2)Grantonlynecessarypermissionstothisuser,3)Regularlyreviewandupdateuserpermissions

MySQL String Data Types Explained: Choosing the Right Type for Your DataMySQL String Data Types Explained: Choosing the Right Type for Your DataMay 11, 2025 am 12:10 AM

MySQLstringdatatypesshouldbechosenbasedondatacharacteristicsandusecases:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseBINARYorVARBINARYforbinarydatalikecryptographickeys.4)UseBLOBorTEXTforlargeuns

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 Article

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

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.

MinGW - Minimalist GNU for Windows

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.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.