最近几个月一直忙着云迁移的产品选择、技术、流程化工作,负责整个江苏省云迁移业务推广与咨询,业务基本上理的很顺,现在闲下来充充电,回顾oracle相关技术,并做相关记录。
1.数据库的flashback技术
与快速恢复区有关的两个初始化参数是:
DB_RECOVERY_FILE_DEST_SIZE
DB_RECOVERY_FILE_DEST
- 回收站-闪回
flashback:alter system set recclebin=on scope=spfile;
show parameter recyclebin;
select oraiginal_name,object_name,type from user_recyclebin;
flashback table dept to before drop;
flashback table dept to before drop rename to dept_1;或者flashback talbe dept to beforce drop rename to dept_2;
purge recyclebin或者 purge table t1
drop table dept purge
- 表-闪回 查询
select * from dept as of timestamp to_timestamp(‘2015-12-01 12:0:0’,’YYYY-MM-DD HH24:MI:SS’);
select * from dept as of scn 170000;
- 表-闪回某时间点:读取undo表空间中的数据
flashback table emp to timestamp to_timestamp(‘2015-12-01 12:00:00’,’YYYY-MM-DD HH24:MI:SS’)
alter system set undo_retention=1800 30分钟
alter tablespace undotbs1 retention guarantee;
- 数据库-闪回
三个条件:数据库的日志模式必须是归档模式、必须配置了快速恢复区、开启了flashback日志
alter database archivelog;
alter database flashback on
alter system set db_flashback_retention_target=4320;
select oldest_flashback_scn,to_char(oldest_flashback_time,’YYYY-MM-DD HH24:MI:SS’) from v$flashback_database_log;
shutdown immediate
startup mount
flashback database to timestamp to_timestamp(‘2015-11-30 16:00:00’,’YYYY-MM-DD HH24:MI:SS’)
alter database open read only;
alter database open resetlogs;