DB2連接遠程數(shù)據(jù)庫實例的步驟 一: 開始菜單--------運行--------輸入地db2cmd地,進入DB2命令行處理器,如下圖: 二:輸入地db2地,進入命令處理狀態(tài),如下圖: 三:輸入 CATALOG TCPIP NODE nodeone REMOTE 192.9.107.64 SERVER 50000 remote_instance db2admin 注:其中nodeone為自己取的節(jié)點名稱,192.9.107.64為遠程數(shù)據(jù)庫的IP地址,db2admin為遠程數(shù)據(jù)庫的實例.結(jié)果如下: 四:輸入 CATALOG DB RONESERV AS testdb AT NODE nodeone 注:其中RONESERV為遠程數(shù)據(jù)庫的名稱,testdb為該遠程數(shù)據(jù)庫在本地機器上的別名,nodeone為步驟三中我們建立的節(jié)點名稱 五:此時即可像操作本地數(shù)據(jù)庫一樣操作遠程數(shù)據(jù)庫了,輸入: connect to testdb user db2admin using lianxi 注:其中testdb為我們在步驟四中為遠程數(shù)據(jù)庫指定的別名,db2admin為遠程數(shù)據(jù)庫的用戶名,lianxi為遠程數(shù)據(jù)庫的密碼 此時您可看到,DB2的控制中心能像操作本地數(shù)據(jù)庫一樣操作遠程數(shù)據(jù)庫了.
站在用戶的角度思考問題,與客戶深入溝通,找到立山網(wǎng)站設計與立山網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗,讓設計與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個性化、用戶體驗好的作品,建站類型包括:成都網(wǎng)站制作、成都做網(wǎng)站、外貿(mào)營銷網(wǎng)站建設、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣、國際域名空間、雅安服務器托管、企業(yè)郵箱。業(yè)務覆蓋立山地區(qū)。
DB2數(shù)據(jù)庫命令簡介 1.啟動數(shù)據(jù)庫 DB2start 2.停止數(shù)據(jù)庫 DB2stop DB2數(shù)據(jù)庫在linux相關(guān)指令之3.連接數(shù)據(jù)庫 DB2 connect to o_yd user DB2 using pwd 4.讀數(shù)據(jù)庫管理程序配置 DB2 get dbm cfg 5.寫數(shù)據(jù)庫管理程序配置 DB2 update dbm cfg using 參數(shù)名 參數(shù)值 6.讀數(shù)據(jù)庫的配置 DB2 connect to o_yd user DB2 using pwd DB2 get db cfg for o_yd 7.寫數(shù)據(jù)庫的配置 DB2 connect to o_yd user DB2 using pwd DB2 update db cfg for o_yd using 參數(shù)名 參數(shù)值 8.關(guān)閉所有應用連接 DB2 force application all DB2 force application ID1,ID2,,,Idn MODE ASYNC (DB2 list application for db o_yd show detail) 9.備份數(shù)據(jù)庫 DB2 force application all DB2 backup db o_yd to d: (DB2 initialize tape on \.tape0) (DB2 rewind tape on \.tape0) DB2 backup db o_yd to \.tape0 10.恢復數(shù)據(jù)庫 DB2 restore db o_yd from d: to d: DB2 restore db o_yd from \.tape0 to d: DB2數(shù)據(jù)庫在linux相關(guān)指令之11.綁定存儲過程 DB2 connect to o_yd user DB2 using pwd DB2 bind c:dfplus.bnd 拷貝存儲過程到服務器上的C:sqllibfunction目錄中 12.整理表 DB2 connect to o_yd user DB2 using pwd DB2 reorg table ydd DB2 runstats on table ydd with distribution and indexes all 13.導出表數(shù)據(jù) DB2 export to c:dftz.txt of del select * from dftz DB2 export to c:dftz.ixf of ixf select * from dftz 14.導入表數(shù)據(jù) import from c:123.txt of del insert into ylbx.czyxx DB2 import to c:dftz.txt of del commitcount 5000 messages c:dftz.msg insert into dftz DB2 import to c:dftz.ixf of ixf commitcount 5000 messages c:dftz.msg insert into dftz DB2 import to c:dftz.ixf of ixf commitcount 5000 insert into dftz DB2 import to c:dftz.ixf of ixf commitcount 5000 insert_update into dftz DB2 import to c:dftz.ixf of ixf commitcount 5000 replace into dftz DB2 import to c:dftz.ixf of ixf commitcount 5000 create into dftz (僅IXF) DB2 import to c:dftz.ixf of ixf commitcount 5000 replace_create into dftz (僅IXF) 15.執(zhí)行一個批處理文件 DB2 -tf 批處理文件名 (文件中每一條命令用 ;結(jié)束) 16.自動生成批處理文件 建文本文件:temp.sql select 'runstats on table DB2.' || tabname || ' with distribution and detailed indexes all;' from syscat.tables where tabschema='DB2' and type='T'; DB2 -tf temp.sqlrunstats.sql 17.自動生成建表(視圖)語句 在服務器上:C:sqllibmisc目錄中 DB2 connect to o_yd user DB2 using pwd DB2look -d o_yd -u DB2 -e -p -c c:o_yd.txt DB2數(shù)據(jù)庫在linux相關(guān)指令之18.其他命令 grant dbadm on database to user bb 19select * from czyxx fetch first 1 rows only 20DB2look -d ylbx -u DB2admin -w -asd -a -e -o a.txt21. 顯示當前用戶所有表 list tables 22.列出所有的系統(tǒng)表 list tables for system 23.查看表結(jié)構(gòu) DB2 describe select * from user.tables (實習編輯:HJ)
1. 創(chuàng)建一個用戶,比如用戶名是 db2inst1 用戶的home路徑是 /home/db2inst1
2. 再創(chuàng)建一個用戶,比如用戶名是db2fence 用戶的home路徑是 /home/db2fence
3. 用 root 用戶,cd /db2_install_path/instances/ 執(zhí)行 ./db2icrt -u db2fence db2inst1
4. 如果db2icrt 沒有報錯,su - db2inst1 然后 db2start
你用來執(zhí)行建庫命令的用戶是否具有你提到的/boot目錄的相應權(quán)限?
缺省的db2inst1用戶只具有它用戶home目錄下面的權(quán)限。如果不加on參數(shù),庫都是建在這個目錄下的,所以權(quán)限不會出問題。但如果你制定了on參數(shù),那目標路徑必須開權(quán)限。
grant一下吧。
名稱欄目:linux登錄db2命令 linux db2查詢表數(shù)據(jù)命令
網(wǎng)站路徑:http://chinadenli.net/article20/dodisjo.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供域名注冊、網(wǎng)站維護、網(wǎng)站設計、用戶體驗、面包屑導航、商城網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)