数据库数据字段误修改恢复
准备执行:
update workflow_billfield set fielddbtype = 'number(38,4)' where id = 72701
执行成了:
update workflow_billfield set fielddbtype = 'number(38,4)'
所有字段类型均统一成了’number(38,4)’
检查5分钟前的数据
select * from workflow_billfield of timestamp to_timestamp('2022-10-20 14:40:00', 'yyyy-mm-dd hh24:mi:ss')
该字段值是正确的。
使用以下代码将指定时间的数据恢复到当前的数据。
MERGE INTO workflow_billfield a
USING (SELECT *
FROM workflow_billfield AS OF TIMESTAMP to_timestamp('2022-10-20 14:40:00', 'yyyy-mm-dd hh24:mi:ss')
) b
ON (a.id = b.id)
WHEN MATCHED THEN
UPDATE
SET a.fielddbtype = b.fielddbtype;
检查当前数据已经恢复正常。