掌握DB2數(shù)據(jù)移動的簡捷方法描述
我們今天主要向大家講述的是輕松掌握DB2數(shù)據(jù)移動的方法,如果你對輕松掌握DB2數(shù)據(jù)移動的方法有興趣的話,你就可以對以下的文章點擊觀看了。相信如果你掌握了這項技術(shù),會在以后的學(xué)習(xí)或是工作中帶來很大的幫助。
我們大家都知道如果要在不同的數(shù)據(jù)庫管理系統(tǒng)之間對一些數(shù)據(jù)進行轉(zhuǎn)移的話,數(shù)據(jù)移動是最實用的一種方法,因為任何一種數(shù)據(jù)庫管理系統(tǒng)都支持常用的幾種文件格式。
通過這個通用的接口,就很容易實現(xiàn)不同系統(tǒng)間數(shù)據(jù)的轉(zhuǎn)移。
DB2中所謂的數(shù)據(jù)移動,包括:
1. 數(shù)據(jù)的導(dǎo)入(import)
2. 數(shù)據(jù)的導(dǎo)出(export)
3. 數(shù)據(jù)的裝入(load)
導(dǎo)入和裝入都是利用db2的相關(guān)命令把某種格式的文件中的數(shù)據(jù)保存到數(shù)據(jù)庫中的表中。
導(dǎo)出是指把db2數(shù)據(jù)庫的表中的數(shù)據(jù)保存到某種格式的文件當中去。
DB2數(shù)據(jù)移動的作用:
如果要在不同的數(shù)據(jù)庫管理系統(tǒng)之間轉(zhuǎn)移數(shù)據(jù),數(shù)據(jù)移動通常是最實用的一種方法,因為任何一種數(shù)據(jù)庫管理系統(tǒng)都支持常用的幾種文件格式,通過這個通用的接口,就很容易實現(xiàn)不同系統(tǒng)間數(shù)據(jù)的轉(zhuǎn)移。
這三個命令中,export最簡單,因為從表中向文件轉(zhuǎn)移數(shù)據(jù),通常不會出現(xiàn)錯誤,也不會有非法的數(shù)據(jù)。
在講解命令之前,首先介紹一下文件的格式。
1. asc——非定界ascii文件,是一個ascii字符流。數(shù)據(jù)流中的行由行定界符分隔,而行中的每一列則通過起始和結(jié)束位置來定義。例如:
- 10 head Office 160 corporate new york
- 15 new england 50 eastern boston
- 20 mid atlantic 10 eastern washington
- 38 south atlantic 30 eastern atlanta
- 42 great lakes 100 midwest chicago
- 51 plains 140 midwest dallas
- 66 pacific 270 western san francisco
- 84 mountain 290 western denver
2. del——定界ascii文件,也是一個ascii字符流。數(shù)據(jù)流中的行由行定界符分隔,行中的列值由列定界符分隔。文件類型修飾符可用于修改這些定界符的默認值。例如:
- 10,"head office",160,"corporate","new york"
- 15,"new england",50,"eastern","boston"
- 20,"mid atlantic",10,"eastern","washington"
- 38,"south atlantic",30,"eastern","atlanta"
- 42,"great lakes",100,"midwest","chicago"
- 51,"plains",140,"midwest","dallas"
- 66,"pacific",270,"western","san francisco"
- 84,"mountain",290,"western","denver"
以上的相關(guān)內(nèi)容就是對教你輕松掌握DB2數(shù)據(jù)移動的介紹,望你能有所收獲。
【編輯推薦】