码迷,mamicode.com
首页 > 数据库 > 详细

数据库Flashback学习

时间:2018-12-19 18:41:17      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:system   rgb   lis   rdbms   parameter   保留   .com   opera   targe   

最近更新时间:2018/12/18


适用场景

数据库升级、快速构建测试环境、DG中重建主库

前置条件

1. ARCHIVELOG 模式

数据库为 mount 状态下开启,最好指定archive log 保存路径。

alter system set log_archive_dest_1=‘location=/u01/arch‘;

ALTER DATABASE ARCHIVELOG;

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/arch
Oldest online log sequence     0
Next log sequence to archive   0
Current log sequence           54

2. 使用时Database要为mount状态,Control File为当前在用的,不是通过备份恢复或者其他方式创建的,因为通过备份恢复或其他方式创建的控制文件不含 flashback log相关信息;

3. 所有在线表空间不存在禁用flashback的情况(ALTER TABLESPACE ... FLASHBACK OFF)


参数说明

1. 设置 Fast Recovery Area,FRA为ORACLE提供集中管理备份恢复文件路径

1.1 DB_RECOVERY_FILE_DEST 设置默认FRA路径

1.2 DB_RECOVERY_FILE_DEST_SIZE 设置配额(BYTES)

2. DB_FLASHBACK_RETENTION_TARGET 设置保留策略,只是期望值,具体与闪回区保留数据有关

3. 通过Flashback闪回数据库后,使用 ALTER DATABASE OPEN RESETLOGS 打开数据库

参考: http://docs.oracle.com/cd/E11882_01/backup.112/e10642/flashdb.htm#BRADV71000


SQL> show parameter db_recovery

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest                string      /u01/fast_recovery_area
db_recovery_file_dest_size           big integer 500M


开启方式

STARTUP MOUNT;

ALTER DATABASE FLASHBACK ON;

SQL> select FLASHBACK_ON from v$database;

FLASHBACK_ON

------------------

YES


常用查询

闪回区空间使用情况

select * from v$flash_recovery_area_usage;


问题

FRA空间不足

Completed: alter database open
Wed Dec 19 17:21:09 2018
Errors in file /u01/app/diag/rdbms/db2/orcl/trace/orcl_m000_6773.trc:
ORA-19815: WARNING: db_recovery_file_dest_size of 524288000 bytes is 100.00% used, and has 0 remaining bytes available.
************************************************************************
You have following choices to free up space from recovery area:
1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,
    then consider changing RMAN ARCHIVELOG DELETION POLICY.
2. Back up files to tertiary device such as tape using RMAN
    BACKUP RECOVERY AREA command.
3. Add disk space and increase db_recovery_file_dest_size parameter to
    reflect the new space.
4. Delete unnecessary files using RMAN DELETE command. If an operating
    system command was used to delete files, then use RMAN CROSSCHECK and
    DELETE EXPIRED commands.
************************************************************************

解决: 增加空间

SQL>  ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE = 4G scope=both;

数据库Flashback学习

标签:system   rgb   lis   rdbms   parameter   保留   .com   opera   targe   

原文地址:https://www.cnblogs.com/bugbeta/p/10145041.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!