文章詳情頁
教你如何快速轉(zhuǎn)移Oracle中海量數(shù)據(jù)
瀏覽:159日期:2023-11-25 13:21:33
假如你要把Oracle里的大量數(shù)據(jù)(80MB以上)轉(zhuǎn)移到另外的用戶,另外的表空間里。可以用下面介紹的快速轉(zhuǎn)移數(shù)據(jù)的方法。 一、建新表的方式 create table target_tablename tablespacetarget_tablespace_name nologging pctfree 10 pctused 60 storage(initial 5M next 5M minextents 1maxextents unlimited pctincrease 0) as select * from username.source_tablename where 條件; 注重事項: 新建的表沒有原來表的索引和默認值, 只有非空(not null)的約束素條件可以繼續(xù)過來,其它的約束條件或索引需要重新建立. 二、直接插入的方法 INSERT /*+ APPEND */ INTO target_tablename SELECT * FROM username.source_tablename where 條件; COMMIT; 注重事項: 用INSERT /*+ APPEND */ 的方法會對target_tablename產(chǎn)生級別為6的獨占鎖,假如運行此命令時還有對target_tablename的DML操作會排隊在它后面,對OLTP系統(tǒng)在用的表操作是不合適的。 說明:這兩種方法轉(zhuǎn)移數(shù)據(jù)時沒有用SGA里數(shù)據(jù)緩沖區(qū)和事物處理的回滾段, 也不寫聯(lián)機事物日志,就象數(shù)據(jù)庫裝載工具Solload一樣直接把數(shù)據(jù)寫到物理文件,速度是很快的。在Oracle8i以后的版本都可以使用。
標簽:
Oracle
數(shù)據(jù)庫
排行榜
