DB2中export命令詳解<<轉載>>
<>----原作者太多了,反正不是我寫的
1、匯出使用者必須有SYSADM或DBADM授權,或者在表格上擁有CONTROL或SELECT許可權;
2、不支援帶結構列的表格資料匯出;
3、可以匯出帶identity列的表格為ixf格式,匯入時用REPLACE_CREATE、CREATE重建identity列,如果該列定義是GENERATED
ALWAYS,匯入時則必須指定identityignore選項。
4、指定匯出格式為ixf,ixf檔案中含有表格和索引定義,用import可以重建表格和索引,但是下面情況ixf檔案會丟失相關資訊:
*
index column names contain hexadecimal values of 0×2B or 0×2D
* table
contains XML columns
* table contains LOB(超過1G的定義) columns
* table is
multidimensional clustered
* table contains a table partitioning key
*
index name that is longer than 128 bytes due to codepage conversion
* table
is a protected table
* contains action strings other than SELECT * FROM
*
method N is specified
5、如果匯出檔案太大,可以使用where條件限制匯出的資料量,分批匯出;
6、匯出檔案格式:
*
DEL (delimited ASCII format)
* WSF (work sheet format)
* IXF (integrated
exchange format, PC
version)
7、執行匯出命令前,確認完成了commit或rollback;
8、匯出格式為DEL時,如果字元列長度超過254時會有警告提示;
9、匯出包是與DATETIME
ISO格式繫結的,所以在sql語句中需要使用iso格式:
查詢資料庫(返回3行資料)
db2 select col2 from tab1 where
char(col2)=’05/10/2005’;
3 record(s) selected.
匯出時使用locale格式不能選擇到記錄
db2
export to test.del of del select col2 from test where
char(col2)=’05/10/2005’;
Number of rows exported:
0
由locale格式改為iso格式
db2 export to test.del of del select col2 from test
where char(col2)=’2005-05-10’;
Number of rows exported:
3
10、匯出執行的三種方式
* CLP命令:export
* ADMIN_CMD儲存過程的export過程
*
db2export的API介面,使用c語言實現
11、del檔案格式指定引數舉例:db2 “export to myfile.del of del
modified by chardel’’ coldel; decpt, select * from staff”
chardelx:
指定字串的分隔符,預設是雙引號,可以指定為單引號modified by
chardel'’
coldelx:指定列分隔符,預設是逗號,可以改為分號modified by
coldel;
decplusblank:指定對正數是否用+符號,預設帶+,可以指定不加正數符號
striplzeros:指定移走資料前導的0,如:+00001.8–>+1.8
測試如下
db2
“export to tb1-1.del of del select * from tb1″
+00000002.10,”abc”
db2
“export to tb1-2.del of del modified by chardel'’ coldel; decplusblank
striplzeros select * from
tb1″
2.10;’abc’
timestampformat=″x″時間戳格式設定,如:”YYYY/MM/DD
HH:MM:SS.UUUUUU”、”yyyy.mm.dd hh:mm tt”
YYYY - Year (four digits ranging from
0000 - 9999)
M - Month (one or two digits ranging from 1 - 12)
MM - Month
(two digits ranging from 01 - 12)
D - Day (one or two digits ranging from 1 -
31)
DD - Day (two digits ranging from 1 - 31)
H - Hour (one or two digits
ranging from 0 - 12 for a 12 hour system, and 0 - 24 for a 24 hour system)
HH
- Hour (two digits ranging from 0 - 12 for a 12 hour system, and 0 - 24 for a 24
hour system)
M - Minute (one or two digits ranging from 0 - 59)
MM -
Minute (two digits ranging from 0 - 59)
S - Second (one or two digits ranging
from 0 - 59)
SS - Second (two digits ranging from 0 - 59)
UUUUUU -
Microsecond (6 digits ranging from 000000 - 999999)
UUUUU - Microsecond (5
digits ranging from 00000 - 99999)
UUUU - Microsecond (4 digits ranging from
0000 - 9999)
UUU - Microsecond (3 digits ranging from 000 - 999)
UU -
Microsecond (2 digits ranging from 00 - 99)
U - Microsecond (1 digit ranging
from 0 - 9)
TT - Meridian indicator (AM or PM)
如果指定了TT,HH就會在0-12之間顯示
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/177006/viewspace-719606/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DB2 export詳解DB2Export
- 詳解es6的export和import命令ExportImport
- SVN命令詳解【轉】
- vi命令詳解(轉)
- JavaScript中的export、export default、exports和module.exports(export、export default、exports使用詳細)JavaScriptExport
- 【轉】linux-命令top詳解Linux
- MySQL鎖詳解!(轉載)MySql
- Linux之export命令LinuxExport
- Linux中awk命令詳解Linux
- Linux中DD命令詳解Linux
- RMAN備份詳解(轉載)
- 【轉載】Rocksdb壓縮詳解
- c#中命令模式詳解C#模式
- [轉載]TCP keepalive的詳解(解惑)TCP
- Linux中tail命令的使用詳解!LinuxAI
- 轉載:System:System.arraycopy方法詳解
- 轉載-詳解功率MOS管引數
- 常用的DB2命令DB2
- FFmpeg命令影片音訊轉碼引數詳解音訊
- source 和export 命令的區別Export
- JavaScript ES6中,export與export defaultJavaScriptExport
- Maven中optional標籤詳解(轉)Maven
- Dockerfile 命令詳解Docker
- NPM命令詳解NPM
- echo命令詳解
- Linuxtcpdump命令詳解LinuxTCP
- w命令詳解
- getsebool命令詳解
- tcpdump命令詳解TCP
- GCC命令詳解GC
- `find` 命令詳解
- Linux at命令詳解Linux
- netstat命令詳解
- DB2常用命令DB2
- JavaScript 中的 exportJavaScriptExport
- powermt 命令簡介(轉載)
- 【Android】狀態列通知Notification、NotificationManager詳解(轉載)Android
- 轉:SVN中trunk,branches,tags用法詳解
- Redis命令詳解:HashsRedis