`
cocoeye
  • 浏览: 15132 次
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

Oracle Flashback

 
阅读更多
In order to utilize Flashback you'll need to put your database in ARCHIVELOG mode. Then you can set the DB_FLASHBACK_RETENTION_TARGET parameter that defines the period of time which we want to retain flashback logs, and finally turn Flashback on with an ALTER DATABASE statement. Lets look at the setup.


SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  184549376 bytes
Fixed Size                  1300928 bytes
Variable Size             157820480 bytes
Database Buffers           25165824 bytes
Redo Buffers                 262144 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.

SQL> alter system set DB_FLASHBACK_RETENTION_TARGET=4320;
System altered.

SQL> alter system set DB_RECOVERY_FILE_DEST_SIZE=536870912;
System altered.

SQL> alter system set DB_RECOVERY_FILE_DEST='/u02/fra';
System altered.

SQL> alter database flashback on;
Database altered.

SQL> alter database open;
Database altered.

Okey, Flashback is now enabled for this database. We've defined a flasback retension of 4320 minutes (or 72 hours), a recovery file size of 512MB and defined the location for the file recovery area (FRA) as /u02/fra.

Lets see Flashback in action now. You can look at the contents of the recyle bin by querying select DBA_RECYCLEBIN the table.


oracle@nexus6 ~$ sqlplus ben/passwd
SQL*Plus: Release 10.1.0.2.0 - Production on Thu Nov 4 00:41:36 2004
Copyright (c) 1982, 2004, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> create table test_table(
  2  id number(2),
  3  name varchar2(30)
  4  );

Table created.

SQL> insert into test_table values (1, 'Ben Rockwood');
1 row created.

SQL> insert into test_table values (2, 'Tamarah Rockwood');
1 row created.

SQL> insert into test_table values (3, 'Nova Rockwood');
1 row created.

SQL>  insert into test_table values (4, 'Hunter Rockwood');
1 row created.

SQL> select * from test_table;
        ID NAME
---------- ------------------------------
         1 Ben Rockwood
         2 Tamarah Rockwood
         3 Nova Rockwood
         4 Hunter Rockwood

SQL> drop table test_table;
Table dropped.

SQL>  select * from test_table;
select * from test_table
               *
ERROR at line 1:
ORA-00942: table or view does not exist

SQL> flashback table "test_table" to before drop;
flashback table "test_table" to before drop
*
ERROR at line 1:
ORA-38305: object not in RECYCLE BIN

SQL> flashback table "TEST_TABLE" to before drop;

Flashback complete.

SQL> select * from test_table;

        ID NAME
---------- ------------------------------
         1 Ben Rockwood
         2 Tamarah Rockwood
         3 Nova Rockwood
         4 Hunter Rockwood

SQL>

In this example we logged in as a user (ben) that by default writes to the users tablespace. Alternately, we could have specified the tablespace explicitly and used the sys user for testing (ie: users.table_test instead of table_test). I've created a simple table and populated it with some data. Then we drop the table and verify that it's really gone. To restore the table we simply use the flashback "to before drop" statement. Another query verifies that is was properly restored.

分享到:
评论

相关推荐

    oracle flashback技术总结

    ### Oracle Flashback 技术详解 #### 一、概述 Oracle Flashback 技术是一种能够帮助用户恢复数据库至某一特定时间点的技术。该技术利用了Undo Segment中的数据,因此受到`UNDO_RETENTION`参数的影响。为了启用...

    ORACLE flashback database测试

    ORACLE flashback database测试,主要进行ORACLE flashbackup 闪回整个数据库的实现。

    Oracle Flashback技术

    Oracle Flashback技术是Oracle数据库提供的一种强大的数据恢复和时间旅行功能,它允许用户查看和恢复到数据库的某个历史状态,而无需依赖传统的备份和恢复过程。这一特性在处理误删除、错误更新或需要查看历史数据时...

    ORACLE FLASHBACK综述.pdf

    ORACLE FLASHBACK 综述 Oracle Flashback 是 Oracle 数据库中的一种功能,允许用户快速地恢复数据库到以前的状态,从而避免了由于操作失误或用户错误带来的问题。下面是 Oracle Flashback 的知识点。 1. Oracle ...

    oracle flashback特性(闪回语句,闪回表,闪回数据库).doc

    Oracle Flashback 特性 Oracle Flashback 是 Oracle 数据库中的一种功能强大的特性,可以让用户快速地恢复到过去的某个时间点,查看过去的数据状态,或者是回滚到某个特定的事务状态。Flashback 特性可以分为三个...

    Oracle Flashback 技术总结

    Oracle Flashback技术是Oracle数据库提供的一种强大的数据恢复和历史数据查询功能,它允许用户恢复到数据库的某个历史状态,或者查询过去的某个时刻的数据。这项技术的核心是基于Undo Segment中的信息,Undo Segment...

    oracle flashback闪回技术

    Oracle Flashback技术是数据库管理系统中的一种高级特性,它允许用户恢复到数据库的某个历史状态,无需进行复杂的备份和恢复操作。这项技术主要基于事务日志和快照来实现,为数据库管理员提供了极大的便利,尤其在...

    Oracle Flashback在医院数据恢复中的应用.pdf

    Oracle Flashback技术是Oracle数据库提供的一种高级数据恢复机制,它允许用户恢复到数据库的某个历史状态,无需回滚日志或还原备份。在医院数据恢复中,这一特性尤为重要,因为医院业务的连续性和数据完整性至关重要...

    Oracle Flashback技术总结

    ### Oracle Flashback技术详解 #### 一、概述 Oracle Flashback技术是一种强大的数据恢复机制,它可以帮助用户在遇到数据丢失或损坏的情况下恢复到之前的某个时间点。这项技术基于Undo Segment中的内容,允许用户...

    Oracle_Flashback_技术_总结.pdf

    在Oracle 10g中,Flashback技术包含了多个组件,如Flashback Database、Flashback Drop、Flashback Query(包括Flashback Query、Flashback Version Query和Flashback Transaction Query)以及Flashback Table。...

    Oracle_Flashback家族

    这一技术在Oracle 10g版本中得到了极大的增强和发展,形成了一个完整的“Flashback家族”,其中包括Flashback Database、Flashback Drop、Flashback Query(进一步细分为Flashback Query、Flashback Version Query、...

    oracle中FLASHBACK

    FLASHBACK DATABASE flashback data1base闪回到过去的某一时刻 闪回点之后的所有工作都将丢失 必须使用resetlogs创建新的场景并打开数据库(一旦resetlogs之后,将不能再闪回至resetlogs之前的时间点) .......

    flashback——oracle

    "Oracle-Flashback-技术-总结.txt"和"oracle_10g_flashback(数据恢复).txt"以及"oracle_10g_flashback.txt"这三份文档可能提供了一个全面的概述,包括Flashback日志、闪回数据库(Flashback Database)、闪回事务...

    oracle 10g flashback(数据恢复)

    ### Oracle 10g Flashback 数据恢复功能详解 Oracle 10g 引入了强大的 Flashback 技术,这是一系列旨在帮助管理员和开发者在出现数据丢失或损坏时能够快速恢复数据的功能集合。该技术从 Oracle 9i 开始引入,并在 ...

    第16章Oracle闪回(Flashback)技术.pptx

    "Oracle 闪回(Flashback)技术" Oracle 闪回(Flashback)技术是 Oracle 数据库提供的一系列人为错误更正技术,用于快速恢复逻辑误操作。闪回技术从 Oracle 9i 版本开始,逐步发展到 Oracle 11g 版本,成为数据库...

    oracle11g flashback archive 资料整理

    Oracle 11g Flashback Archive 资料整理 Oracle Flashback Archive 是 Oracle 11g 中的一项新特性,旨在提供有针对性数据表的可控时间闪回功能。Flashback Archive 可以实现对特定数据表的闪回,保留不同时间的数据...

    Oracle中有后悔药卖吗?Oracle中的回闪查询: Oracle 10g 回闪实验文档

    Oracle 10g引入了一系列回闪(Flashback)技术,旨在提供一种快速恢复数据库至特定时间点的能力,而无需传统的备份和恢复过程。这些技术允许数据库管理员轻松地撤消数据更改或恢复到特定的时间点,为误操作提供了...

    Oracle 闪回特性 FLASHBACK & RECYCLEBIN

    Oracle 闪回特性 FLASHBACK & RECYCLEBIN Flashback 系列是 Oracle 数据库中的一组功能强大且实用的闪回机制,旨在帮助数据库管理员和开发者快速恢复数据库中的各种对象,包括表、数据、事务等。Flashback 系列的...

Global site tag (gtag.js) - Google Analytics