Oracle 六大闪回技术,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

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics











The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is suitable for small and large enterprises. 1) Small businesses can use MySQL for basic data management, such as storing customer information. 2) Large enterprises can use MySQL to process massive data and complex business logic to optimize query performance and transaction processing.

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.
