[bbk4485]第二章Flashback Database 02

Configuring Flashback Database

如何查看数据库是否处于归档模式?

mount database之后,执行如下命令

SQL> select log_mode from v$database;

LOG_MODE
------------
ARCHIVELOG

conn as sysdba后,执行如下命令:

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     202
Next log sequence to archive   204
Current log sequence           204

归档的实质,就是归日志历史的档. (如何实现手工日志切换alter system switch logfile;)

SQL> show parameter recover

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /RealData/flash_recovery_area
db_recovery_file_dest_size           big integer 10G
recovery_parallelism                 integer     0

启用数据库归档步骤

1、关闭数据库

shutdown

2、mount 数据库(mount起来之后,是可以修改数据库的控制文件的;)

startup mount

3、修改归档模式

alter database archivelog;

4、打开数据库

alter database open;

配置flashback database的条件

1、数据库必须启用归档模式

2、数据库必须启用闪回模式

3、闪回写进程后台进程(fvwr)必须启动

配置数据库归档的步骤

条件

1、配置后台归档进程

log_archive_staret=true

log_archive_dest_1=

log_archive_format=

2、启用数据库归档

如何查看数据库的闪回模式

v$database试图的数据内容,是源自于oracle database 的控制文件中获取的.因此查询数据库的闪回模式,可以通过查询v$databse中获取.

FLASHBACK_ON=ON不表示数据库

SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
NO

启用数据库闪回步骤

1、关闭数据库

shutdown

2、mount数据库

startup mount;

3、启用模式

alter database flashback on;

4、打开数据库

alter database open;

[oracle@arcerzhang DATACENTER]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed May 15 16:29:10 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.

Total System Global Area 3256942592 bytes
Fixed Size                  2217752 bytes
Variable Size            1845496040 bytes
Database Buffers         1392508928 bytes
Redo Buffers               16719872 bytes
Database mounted.
SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
NO

SQL> alter database flashback on;

Database altered.

SQL> alter database open;

Database altered.

SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
YES

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

Total System Global Area 3256942592 bytes
Fixed Size                  2217752 bytes
Variable Size            1845496040 bytes
Database Buffers         1392508928 bytes
Redo Buffers               16719872 bytes
Database mounted.
SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
YES

配置闪回写进程后台进程(fvwr)的步骤

1、配置闪回日志目录

2、配置闪回日志保存时间

DB_FLASHBACK_RETENTION_TARGET

posted @ 2013-05-15 15:50  ArcerZhang  阅读(2782)  评论(1编辑  收藏  举报