有時在測試時,我們須先備份某些特定的 Table,這時可使用下列指令來達成: CREATE TABLE backup_table_name AS SELECT * FROM source_table_name 例如:當 AD_SNAPSHOT_FILES 與 AD_SNAPSHOT_BUGFIXES 表有差異時,我們需事先備份此兩個 Table。> select distinct(snapshot_id) from ad_snapshot_files; SNAPSHOT_ID 1 44 2 47 3 46 4 1069 5 2068 6 68 7 1068 8 45 9 -1069 10 67 > select distinct(snapshot_id) from ad_snapshot_bugfixes; SNAPSHOT_ID 1 43 2 44 3 47 4 46 5 68 6 1069 7 2068 8 1068 9 45 10 67
備份 AD_SNAPSHOT_FILES 與 AD_SNAPSHOT_BUGFIXES 表如下:SQL> select count(*) from applsys.ad_snapshot_files; COUNT(*) ---------- 2658158 SQL> create table ad_snapshot_files_elvismeng as select * from applsys.ad_snapshot_files; Table created. SQL> select count(*) from ad_snapshot_files_elvismeng; COUNT(*) ---------- 2658158 SQL> select count(*) from applsys.ad_snapshot_bugfixes; COUNT(*) ---------- 1375068 SQL> create table ad_snapshot_bugfixes_elvismeng as select * from applsys.ad_snapshot_bugfixes; Table created. SQL> select count(*) from ad_snapshot_bugfixes_elvismeng; COUNT(*) ---------- 1375068 SQL>
“Those who are in love with practice without knowledge are like the sailor who gets into a ship without rudder or compass and who never can be certain [where] he is going. Practice must always be founded on sound theory.” by Leonardo da Vinci
2015年4月27日 星期一
【Oracle ERP Note 】備份特定的 Table
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言