文章詳情頁(yè)
教你如何快速轉(zhuǎn)移Oracle中海量數(shù)據(jù)
瀏覽:148日期: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 條件; 注重事項(xiàng): 新建的表沒有原來(lái)表的索引和默認(rèn)值, 只有非空(not null)的約束素條件可以繼續(xù)過來(lái),其它的約束條件或索引需要重新建立. 二、直接插入的方法 INSERT /*+ APPEND */ INTO target_tablename SELECT * FROM username.source_tablename where 條件; COMMIT; 注重事項(xiàng): 用INSERT /*+ APPEND */ 的方法會(huì)對(duì)target_tablename產(chǎn)生級(jí)別為6的獨(dú)占鎖,假如運(yùn)行此命令時(shí)還有對(duì)target_tablename的DML操作會(huì)排隊(duì)在它后面,對(duì)OLTP系統(tǒng)在用的表操作是不合適的。 說(shuō)明:這兩種方法轉(zhuǎn)移數(shù)據(jù)時(shí)沒有用SGA里數(shù)據(jù)緩沖區(qū)和事物處理的回滾段, 也不寫聯(lián)機(jī)事物日志,就象數(shù)據(jù)庫(kù)裝載工具Solload一樣直接把數(shù)據(jù)寫到物理文件,速度是很快的。在Oracle8i以后的版本都可以使用。
標(biāo)簽:
Oracle
數(shù)據(jù)庫(kù)
排行榜
