Oracle 傻瓜式数据归档

前端之家收集整理的这篇文章主要介绍了Oracle 傻瓜式数据归档前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

推荐用方法

============================================================ 
方法一 【分区表需要另写CREATE TABLE方法,推荐用方法二】
-----------------------------------------------
CREATE TABLE PH_PRESCRIPTION_T AS SELECT * FROM PH_PRESCRIPTION WHERE 1=0;
CREATE TABLE PH_PRESCRIPTION_ITEM_T AS SELECT * FROM PH_PRESCRIPTION_ITEM WHERE 1=0;
CREATE TABLE PH_AUDIT_PRESCRIPTION_T AS SELECT * FROM PH_AUDIT_PRESCRIPTION WHERE 1=0;
CREATE TABLE PH_AUDIT_PRESCRIPTION_ITEM_T AS SELECT * FROM PH_AUDIT_PRESCRIPTION_ITEM WHERE 1=0;

RENAME  PH_PRESCRIPTION TO PH_PRESCRIPTION_19;
RENAME  PH_PRESCRIPTION_T TO PH_PRESCRIPTION;

RENAME  PH_PRESCRIPTION_ITEM TO PH_PRESCRIPTION_ITEM_19;
RENAME  PH_PRESCRIPTION_ITEM_T TO PH_PRESCRIPTION_ITEM;

RENAME  PH_AUDIT_PRESCRIPTION TO PH_AUDIT_PRESCRIPTION_19;
RENAME  PH_AUDIT_PRESCRIPTION_T TO PH_AUDIT_PRESCRIPTION;

RENAME  PH_AUDIT_PRESCRIPTION_ITEM TO PH_AUDIT_PRESCRIPTION_ITEM_19;
RENAME  PH_AUDIT_PRESCRIPTION_ITEM_T TO PH_AUDIT_PRESCRIPTION_ITEM;


============================================================ 
方法二 推荐
-----------------------------------------------

CREATE TABLE PHARMACY_ARCHIVE.PH_PRESCRIPTION_19 AS SELECT * FROM PHARMACY.PH_PRESCRIPTION;
CREATE TABLE PHARMACY_ARCHIVE.PH_PRESCRIPTION_ITEM_19 AS SELECT * FROM PHARMACY.PH_PRESCRIPTION_ITEM;
CREATE TABLE PHARMACY_ARCHIVE.PH_AUDIT_PRESCRIPTION_19 AS SELECT * FROM PHARMACY.PH_AUDIT_PRESCRIPTION;
CREATE TABLE PHARMACY_ARCHIVE.PH_AUDIT_PRESCRIPTION_ITEM_19 AS SELECT * FROM PHARMACY.PH_AUDIT_PRESCRIPTION_ITEM;
TRUNCATE TABLE PHARMACY.PH_PRESCRIPTION;
TRUNCATE TABLE PHARMACY.PH_PRESCRIPTION_ITEM;
TRUNCATE TABLE PHARMACY.PH_AUDIT_PRESCRIPTION;
TRUNCATE TABLE PHARMACY.PH_AUDIT_PRESCRIPTION_ITEM;

猜你在找的Oracle相关文章