因為需要将伺服器上的資料備份到自己的計算機上,操作:
1.從伺服器中導出資料
a.導出資料庫的表結構
在系統指令行中執行
db2look -d 庫名 -e -u 使用者名 -z 使用者名 -l -o exoa.sql -i 使用者名 -w 密碼
b.導出資料
在系統指令行中執行
db2move dbname export -u 使用者名 -p 密碼
2.導入到db2資料庫中
a.導入資料庫表結構:
在"db2指令行"中執行
db2 connect to dbname db2 -tvf D:\DATA\test1.sql
db2 terminate
b.導入資料
在系統指令行中執行
db2move dbname import
DB2常用指令大全
一、常用指令
1. 建立資料庫DB2_GCB
CREATE DATABASE DB2_GCB ON G: ALIAS DB2_GCB
USING CODESET GBK TERRITORY CN COLLATE USING SYSTEM DFT_EXTENT_SZ 32
2. 連接配接資料庫
connect to sample1 user db2admin using 8301206
3. 建立别名
create alias db2admin.tables for sysstat.tables;
CREATE ALIAS DB2ADMIN.VIEWS FOR SYS