ORACLE设置快照回滚点

ORACLE设置快照回滚点

一、设置闪回区

sql 复制代码
sqlplus / as sysdba

#查看闪回区当前配置
show parameter db_recovery;

#设置闪回区路径,和归档一致
alter system set db_recovery_file_dest='+ARCHDG' scope = both;

#设置闪回区空间大小
alter system set db_recovery_file_dest_size=500G scope = both;

#控制闪回(Flashback)操作的保留期限(默认以秒为单位)
alter system set db_flashback_retention_target=518400 scope = both;

#用于指定归档日志文件的存储位置和传输方式
alter system set log_archive_dest_1='+ARCHDG' scope = both;   #如果报错用下面sql
alter system set log_archive_dest_1='location=+ARCHDG' scope = both;

二、开启归档

sql 复制代码
shutdown immediate;

startup mount;
alter database archivelog;
alter database flashback on;    #启用闪回日志
alter database open;

archive log list;
show parameter db_recovery;
select open_mode,flashback_on from v$database;

三、创建和检查闪回点

sql 复制代码
CREATE RESTORE POINT P202310091714 GUARANTEE FLASHBACK DATABASE;

set line 150
col name for a30
select scn,name,GUARANTEE_FLASHBACK_DATABASE,time from v$restore_point;

四、回滚

sql 复制代码
shutdown immediate;
startup mount;

flashback database to restore point P202310091714;
alter database open resetlogs;

五、删除闪回点

sql 复制代码
shutdown immediate;
startup mount;

drop RESTORE POINT P202310091714;    #不用关机直接删也可以删除,这块是演示关闭归档
alter database flashback off;
alter database noarchivelog;
alter database open;
相关推荐
DemonAvenger5 小时前
NoSQL与MySQL混合架构设计:从入门到实战的最佳实践
数据库·mysql·性能优化
AAA修煤气灶刘哥16 小时前
后端人速藏!数据库PD建模避坑指南
数据库·后端·mysql
RestCloud20 小时前
揭秘 CDC 技术:让数据库同步快人一步
数据库·api
得物技术1 天前
MySQL单表为何别超2000万行?揭秘B+树与16KB页的生死博弈|得物技术
数据库·后端·mysql
可涵不会debug1 天前
【IoTDB】时序数据库选型指南:工业大数据场景下的技术突围
数据库·时序数据库
ByteBlossom1 天前
MySQL 面试场景题之如何处理 BLOB 和CLOB 数据类型?
数据库·mysql·面试
麦兜*1 天前
MongoDB Atlas 云数据库实战:从零搭建全球多节点集群
java·数据库·spring boot·mongodb·spring·spring cloud
Slaughter信仰1 天前
深入理解Java虚拟机:JVM高级特性与最佳实践(第3版)第十章知识点问答(10题)
java·jvm·数据库
麦兜*1 天前
MongoDB 在物联网(IoT)中的应用:海量时序数据处理方案
java·数据库·spring boot·物联网·mongodb·spring