永发信息网

oracle怎么给用户授权flashback

答案:2  悬赏:30  手机版
解决时间 2021-03-19 06:28
oracle怎么给用户授权flashback
最佳答案
by jdstkxx on 2012 年 4 月 17 日

– A.flashback database相关

–1.检查是否启动了flash recovery area
show parameter db_recovery_file
–2.检查是否启用了归档
archive log list;
–3.flashback database 默认是关闭的,查看方法
select flashback_on from v$database;
–4.查询当前的scn
SELECt CURRENT_SCN FROM V$DATABASE;
–5.查询当前的时间
select to_char(sysdate,’yy-mm-dd hh24:mi:ss’) time from dual;
–6.查看SCN 和 timestamp 之间的对应关系:
select scn,to_char(time_dp,’yyyy-mm-dd hh24:mi:ss’)from sys.smon_scn_time;
–7.恢复到时间点,或者恢复到SCN
flashback database to timestamp to_timestamp(’09-10-14 14:37:05′,’yy-mm-dd hh24:mi:ss’);
flashback database to scn 947921;
– B. flashback table 恢复误drop表
drop table sphsy.login_table;
select * from flash_table;
–purge table sphsy.login_table;清空回收站
flashback table sphsy.login_table to before drop;
select * from sphsy.login_table;
– C. flashback query 实现行级恢复

– 1.查原始记录 ,区间内有62 行
select *
from sphsy.login_table a
where a.id > 201204171078
and a.id < 201204171141
order by a.id ;
– 2.晚于区间的有 3016
select program,count(*)
from sphsy.login_table a
where a.id >= 201204171141
group by program ;
–3. 删除
delete from sphsy.login_table a
where a.id > 201204171078
and a.id < 201204171141
–4.利用闪回特性查到区间内,有62行
select * from sphsy.login_table
as of timestamp to_timestamp(’2012-04-17 17:20:30′,’YYYY-MM-DD HH24:MI:SS’)
where id > 201204171078
and id < 201204171141
– 5.不利用闪回特性,直接查询发现没有
select * from sphsy.login_table
where id > 201204171078
and id < 201204171141
– 6.进行数据恢复
– 禁止表上的触发器
alter trigger sphsy.T_INS_LOGIN_TABLE disable ;
– 恢复数据
insert into sphsy.login_table
select * from sphsy.login_table
as of timestamp to_timestamp(’2012-04-17 17:20:30′,’YYYY-MM-DD HH24:MI:SS’)
where id > 201204171078
and id < 201204171141
– 恢复触发器
alter trigger sphsy.T_INS_LOGIN_TABLE enable ;
– 7.晚于区间的数据回来了3130 = 3016 +62 + 后来的数据。实现了区间恢复误删除。
select program,count(*)
from sphsy.login_table a
where a.id >= 201204171078
group by program ;
– D. flashback table 恢复表到先前状态

– 1.查原始记录 ,区间内有62 行
select *
from sphsy.login_table a
where a.id > 201204171078
and a.id < 201204171141
order by a.id ;
– 2.晚于区间的有 3074
select count(*)
from sphsy.login_table a
where a.id >= 201204171141;
–3. 删除 ,先记下时间点,2012-04-17 17:43:46
select to_char(sysdate,’YYYY-MM-DD HH24:MI:SS’) from dual ;
delete from sphsy.login_table a
where a.id > 201204171078
and a.id < 201204171141
– 4.删除之后表 sphysy.login_table继续有修改 ,行3082
select count(*)
from sphsy.login_table a
where a.id >= 201204171141;
–5.激活行移动特征
alter table sphsy.login_table enable row movement
–6.利用闪回特性,直接恢复到删除时间点前
flashback table sphsy.login_table to timestamp to_timestamp(’2012-04-17 17:43:46′,’YYYY-MM-DD HH24:MI:SS’);
– 7.晚于区间的数据 回到了3080 ,说明时间点之后的修改丢失。
select count(*)
from sphsy.login_table a
where a.id >= 201204171141
– 8.往前推1分,恢复到删除之前,删除的62条也回来了。
flashback table sphsy.login_table to timestamp to_timestamp(’2012-04-17 17:40:46′,’YYYY-MM-DD HH24:MI:SS’);
– 62 行
select count(*)
from sphsy.login_table a
where a.id > 201204171078
and a.id < 201204171141
– 删除之后的数据为3074,代表还有修改丢失。
select count(*)
from sphsy.login_table a
where a.id >= 201204171141
全部回答
这个要看你设置可恢复的时间长度
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
恒字的近义词是什么
猜谜语:会吃没有嘴,过河没有水,会走没有腿,败
天津财经大学到河北区中山路坐几路车
米香酒家在哪里啊,我有事要去这个地方
运营电动汽车使用的充电桩APP,有没有好的推
息心即是息灾
燕家岭隧道在哪里啊,我有事要去这个地方
哈工程到哈尔滨开发区同江路8号
超市四百多的旅行箱质量好吗?
为什么只有我的QQ号不能上DNF
请问用什么方法烧咸瘦肉,使它又酥又烂又好吃
安妮西餐地址在哪,我要去那里办事
从北京丰台区下车打车去二老庄多少钱
2016澳大利亚打工度假签证大专生可以吗
海西州粮食局在哪里啊,我有事要去这个地方
推荐资讯
我没有怀孕老公想吃母乳能下奶吗
面对传国玉玺,孙策的做法是什么
红米手机HM2A灰复原厂设置的密码是什么
剑灵怎么挣金币
梦想玩国地址在什么地方,想过去办事
刚认识男朋友的时候,他说他家没钱,还欠债,
支付宝能和银行卡一起付费吗?
有关英语中一些能够被动表主动的词汇问题
甲数是12乙数是10 1 乙数比甲数多几分之几 2
小干溪地址在哪,我要去那里办事
刀剑类产品发什么快递或货运,运费按什么收费
怎么坐车到大连安达大厦
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?