---
title: "oracle临时恢复备份"
author: "foolraty"
date: "2010-06-14T19:17:49Z"
tags: []
categories: ["数据库"]
slug: "oracle"
draft: false
lastmod: "2010-06-14T19:17:49Z"
id: 692011
url: "https://foolraty.iteye.com/blog/692011"
---

备份
create table bilhdr_20100614 as
select * from bilhdr where biltyp='SX' and to_char(crtdat,'yyyy-mm-dd hh24:mi:ss')>='2010-06-14 18:23'
and to_char(crtdat,'yyyy-mm-dd hh24:mi:ss')<='2010-06-14 18:25'
and bilid like 'JX%'

create table bilDTL_20100614 as
select * from bildtl where biltyp='SX' and (dat,bilid) in (
select dat,bilid from bilhdr where biltyp='SX' and to_char(crtdat,'yyyy-mm-dd hh24:mi:ss')>='2010-06-14 18:23'
and to_char(crtdat,'yyyy-mm-dd hh24:mi:ss')<='2010-06-14 18:25'
and bilid like 'JX%')
删除
delete from bilhdr where biltyp='SX' and to_char(crtdat,'yyyy-mm-dd hh24:mi:ss')>='2010-06-14 18:23'
and to_char(crtdat,'yyyy-mm-dd hh24:mi:ss')<='2010-06-14 18:25'
and bilid like 'JX%'

delete from bildtl where biltyp='SX' and (dat,bilid) in (
select dat,bilid from bilhdr where biltyp='SX' and to_char(crtdat,'yyyy-mm-dd hh24:mi:ss')>='2010-06-14 18:23'
and to_char(crtdat,'yyyy-mm-dd hh24:mi:ss')<='2010-06-14 18:25'
and bilid like 'JX%')

恢复回去
insert into bilhdr select * from bilhdr_20100614