sky 的个人资料DBA日记照片日志列表更多 工具 帮助
2008/8/1

oracle10g的flashback database

需要启动flash recovery area,才能使用flashback database
在mount状态执行alter database flashback on;打开flashback database功能。
在mount状态执行flashback database to scn/timestamp语句闪回数据库。然后用resetlogs模式打开数据库。

SQL> create spfile from pfile;

File created.

SQL> startup
ORACLE instance started.

Total System Global Area  801112064 bytes
Fixed Size                  1221972 bytes
Variable Size             432016044 bytes
Database Buffers          360710144 bytes
Redo Buffers                7163904 bytes
Database mounted.
Database opened.
SQL> alter system set DB_RECOVERY_FILE_DEST_SIZE=20G scope=spfile;

System altered.

SQL>  alter system set DB_RECOVERY_FILE_DEST_SIZE=20G scope=both;

System altered.

SQL> alter system set db_recovery_file_dest=/u01/app/oracle/flash_recovery_area scope=both;
alter system set db_recovery_file_dest=/u01/app/oracle/flash_recovery_area scope=both
                                        *
ERROR at line 1:
ORA-02065: illegal option for ALTER SYSTEM

SQL> alter system set db_recovery_file_dest='/u01/app/oracle/flash_recovery_area' scope=both;

System altered.

SQL> alter database flashback on;
alter database flashback on
*
ERROR at line 1:
ORA-38759: Database must be mounted by only one instance and not open.

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

Total System Global Area  801112064 bytes
Fixed Size                  1221972 bytes
Variable Size             432016044 bytes
Database Buffers          360710144 bytes
Redo Buffers                7163904 bytes
Database mounted.
SQL> alter database flashback on;

Database altered.

SQL>

10g的recyclebin

1.启用&关闭回收站
   10gR1:_recyclebin=true/false (隐含参数)
   10gR2:   recyclebin=on/on  (常规动态参数)

2.视图  recyclebin,dba_recyclebin,user_recyclebin;

3.flashback table功能
   flashback table t1 to before drop rename to t2;

4.限制条件
    undo_management=auto
    删除user时,user下的表不会放到recyclebin中
    删除cluster时,cluster的成员表不会放到recyclebin中
    删除type时,相关的对象不会放到recyclebin中。

5.清除recyclebin中的对象。
   purge table BIN$jsleilx392mk2=293$0;
   purge table table_name;
   purge tablespace tbs1;
   purge recyclebin;( as sysdba)