Home Database Mysql Tutorial Oracle 六大闪回技术,flashback

Oracle 六大闪回技术,flashback

Jun 07, 2016 pm 04:45 PM

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 of this Website
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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How do you alter a table in MySQL using the ALTER TABLE statement? How do you alter a table in MySQL using the ALTER TABLE statement? Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections? How do I configure SSL/TLS encryption for MySQL connections? Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

How do you handle large datasets in MySQL? How do you handle large datasets in MySQL? Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)? Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you drop a table in MySQL using the DROP TABLE statement? How do you drop a table in MySQL using the DROP TABLE statement? Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you create indexes on JSON columns? How do you create indexes on JSON columns? Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

How do you represent relationships using foreign keys? How do you represent relationships using foreign keys? Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)? How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)? Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

See all articles