Oracle 10G 启用flashback 闪回功能
[oracle@localhost ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Mon May 15 15:17:17 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> connect /as sysdba
Connected.
SQL> show parameter db_recovery_file_dest;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string
db_recovery_file_dest_size big integer 0
SQL>
SQL> show parameter db_flashback_retention_target
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_flashback_retention_target integer 1440
SQL> show parameter db_recovery_file_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string
db_recovery_file_dest_size big integer 0
SQL> alter system set db_recovery_file_dest_size=10000000;
System altered.
SQL> alter system set db_recovery_file_dest='/opt/oracle/product/flash_recovery_area';
System altered.
SQL> show parameter db_flashback_retention_target
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_flashback_retention_target integer 1440
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 130023424 bytes
Fixed Size 1218052 bytes
Variable Size 117443068 bytes
Database Buffers 8388608 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> alter database flashback on;
Database altered.
SQL> alter database open;
Database altered.
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
YES
SQL>
OK!============
后来发现问题:
ORA-01552: 非系统表空间'USERS'无法使用系统回退段
解决办法:
PLSQL中:
select segment_name,status from dba_rollback_segs;
segment_name,status
--------------------------------
1 SYSTEM ONLINE
12 RBS_SMALL OFFLINE
alter rollback segment "RBS_SMALL" online;
问题解决:
参考:
这个是因为当前只有system这个回滚段可用,
可以查看当前系统回滚段信息:
select segment_name,status from dba_rollback_segs;
如:
SEGMENT_NAME STATUS
------------------------------ ----------------
SYSTEM ONLINE
RBS0 OFFLINE
如果有offline的,使用alter rollback segment "RBS0" online;
如果只有system这一行,那就最好创建新的回滚段了:
create rollback segment rbs_small storage(initial 64k next 64k minextents 2 maxextents 4) tablespace tools;
各个参数的含义你可以到google上搜到。