利用oracle闪回,将修改的字段还原
·
问题
公司的表被清空了,重新恢复的时候导致中文的字段乱码了。
想要把乱码的字段修改回来,想到了回闪,出问题的时间之前的数据。然后通过回闪的数据去更新现在乱码的字段
具体实现
数据表:person
| id | name | create_time |
|---|---|---|
| 1 | 灏忛緳濂? | 2018-01-13 09:00:00 |
| 2 | ?1y | 2018-01-03 09:00:00 |
1.回闪
select id,name,create_time from person
as of timestamp
to_timestamp('2021-03-12 08:59:00','yyyy-mm-dd hh24:mi:ss')
2.更新
update person
set name=(select name from
(select id,name,create_time from person
as of timestamp
to_timestamp('2021-03-12 08:59:00','yyyy-mm-dd hh24:mi:ss')) e where e.id=person.id
and e.create_time = person.create_time
)
where person.create_time>=to_date('2018/01/01','yyyy/mm/dd')
and person.create_time<to_date('2018/02/01','yyyy/mm/dd')
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)