时间:2021-07-01 10:21:17 帮助过:26人阅读
打开数据库flashback1. 确认一个数据库是否打开了flashback,有两个简单的方法:(1)直接查数据库SQLgt; select name,log_mode
打开数据库flashback
1. 确认一个数据库是否打开了flashback,有两个简单的方法:
(1)直接查数据库
SQL> select name,log_mode,flashback_on from v$database;
NAME LOG_MODE FLASHBACK_ON
--------- ------------ ------------------
ORA11G ARCHIVELOG NO --> flashback未打开
2. 如果数据库没有打开flashback,那么将flashback打开:
(1)确定flashback的存储路径
SQL> show parameter recovery
System altered.
SQL> show parameter recovery
NAME TYPE VALUE
------------------------------- ----------- ------------------------------
db_recovery_file_dest string
db_recovery_file_dest_size big integer 20G
recovery_parallelism integer 0
SQL> alter system set db_recovery_file_dest = '/home/oracle/flashback' scope = both;
System altered.
SQL> show parameter recovery
NAME TYPE VALUE
------------------------------- ----------- ------------------------------
db_recovery_file_dest string /home/oracle/flashback
db_recovery_file_dest_size big integer 20G
recovery_parallelism integer 0
(2)打开flashback
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.
上面的错误,是因为在打开数据库的flashback必须要mount状态下方可以,于是:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 5344731136 bytes
Fixed Size 2169104 bytes
Variable Size 2130708208 bytes
Database Buffers 3204448256 bytes
Redo Buffers 7405568 bytes
Database mounted.
SQL> alter database flashback on;
Database altered.
SQL> alter database open;
Database altered.
SQL> select name,log_mode,flashback_on from v$database;
NAME LOG_MODE FLASHBACK_ON
--------- ------------------ ------------
ORA11G ARCHIVELOG YES