db2linuxsql
1. linux閲嶅惎db2鎶ラ敊錛屽ぇ紲炴眰鏁
1.鍦ㄥ懡浠よ岀晫闈涓鐢ㄥ備笅璇鍙ュ垏鎹㈠埌db2inst1璐︽埛涓錛
su - db2inst1
娉ㄦ剰錛屽懡浠よ佸皬鍐欙紝涓闂寸殑鍑忓彿鏄鍗婅掔殑銆傚叾涓璬b2inst1璐︽埛錛堝悓鏃朵篃鏄瀹炰緥銆佽繘紼嬶級鏄鍦ㄥ畨瑁匘B2榪囩▼涓鍒涘緩鐨勪竴涓榛樿よ處鎴鳳紝鐩稿綋浜嶹indows涓鐨勯偅涓狣B2瀹炰緥錛岃佹兂鎵ц屽悇縐峝b2鐨勫懡浠わ紝闇瑕佸湪榪欎釜璐︽埛涓嬫搷浣滐紱
2.鍦ㄨヨ處鎴蜂笅錛屽彲浠ユ墦寮鎺у埗涓蹇冿紝涔熷彲浠ヨ繘鍏ュ埌鍛戒護琛屽勭悊鍣ㄣ傝繘鍏ュ懡浠よ屽勭悊鍣ㄧ殑鏂規硶寰堢畝鍗曪紝鐩存帴鐢╠b2鍛戒護錛岀劧鍚庡洖杞﹀嵆鍙錛
3.鎵撳紑鎺у埗涓蹇冪◢寰鏈夌偣楹葷儲錛岄渶瑕佸湪妗岄潰涓婂彟澶栨墦寮涓涓鍛戒護琛岀獥鍙o紝鍦ㄥ叾涓杈撳叆錛
xhost local:db2
鐒跺悗鍦╠b2inst1璐︽埛鎵鍦ㄧ殑紿楀彛涓錛岃緭鍏ュ懡浠わ細
db2cc &
灝卞彲浠ユ墦寮鎺у埗涓蹇冦
4.鐜板湪鍙浠ユ煡鐪嬪綋鍓嶅疄渚
db2ilist
濡傛灉闇瑕佸壋寤鴻〃錛屽垯闇瑕佹墦寮鏁版嵁搴撶$悊鏈嶅姟錛岃緭鍏ュ懡浠わ細
su - db2inst1
db2start //鍚鍔╠b2宸ヤ綔瀹炰緥
db2stop //鍋滄db2瀹炰緥
db2set -all //鏌ョ湅db2鎵鏈夋敞鍐岃〃鍙橀噺
鍦ㄥ彉閲忓垪琛ㄤ腑鏈変竴涓猟b2綆$悊鐢ㄦ埛錛欴B2ADMINSERVER=XXXXX
鍙鏈夊垏鎹㈠埌綆$悊鐢ㄦ埛鎵嶅彲浠ュ壋寤鴻〃 su - XXXXX
鐒跺悗錛岃緭鍏ュ懡浠わ細 db2admin start 鍚鍔ㄧ$悊瀹炰緥
璇存槑:
鍦↙inux鐜澧冧笅錛屼竴涓鐢ㄦ埛瀵瑰簲涓涓瀹炰緥錛屽壋寤烘暟鎹搴撳繀欏誨湪瀹炰緥涓嬪壋寤猴紝鍥犳ゅ垏鎹㈠埌鐢ㄦ埛鍗沖彲鍒囨崲鍒板疄渚嬨傚懡浠ゅ備笅錛
su - db2inst1
db2 get instance
2. linuxdb2鍛戒護琛屾墽琛屽煎嚭鏌ヨ㈢粨鏋渓inuxdb2鍛戒護
db2鏃犳硶榪炴帴鏁版嵁搴擄紵
1.鐪嬬湅絝鍙e彿鏈夋病鏈夐厤緗姝g『錛岀湅涓涓嬮厤緗鍙傛暟svcename璺焥ervices鏂囦歡涓閰嶇疆鐨刣b2絝鍙e彿鏄鍚︿竴鑷達紝windows涓鑸鐢50000錛寀nix/linux涓鑸鐢60000
2.榪炴帴鍑洪敊棣栧厛鐪嬬湅鏈嶅姟鍣╥p鍜岀鍙e啓瀵規病鏈
ip濡傛灉娌¢敊灝辮佺湅鐪嬫湇鍔″櫒鐨刣b2鏈嶅姟絝鍙e逛笉瀵廣傚彟澶栧逛簬鏈嶅姟鍣ㄤ笅闈㈣繖浜涗篃瑕佹敞鎰
媯鏌ユ湇鍔″櫒鐨勯厤緗鎯呭喌濡備笅錛
楠岃瘉瀛樺湪鐨凞B2鏁版嵁搴
db2listdbdirectory
db2listdbdirectoryshowdetail
楠岃瘉瀹炰緥浣跨敤鐨勯氳鍗忚錛屾煡鐪婦B2COMM鍙橀噺
db2set-all
鏌ョ湅鏁版嵁搴撶$悊鍣ㄧ殑閰嶇疆錛屾煡鐪婼VCENAME錛堢壒鎸噒cpip鍗忚錛
db2getdbmcfg
鏌ョ湅/etc/services涓錛屾湁鏃犱笌涓婇潰瀵瑰簲SVCENAME鐨勭鍙o紝渚嬪傦細
db2cDB250000/tcp
瑕佺『璁ゆ湇鍔″櫒鏄鍚﹀湪鐩戝惉錛屽彲浠ョ敤netstat-an鏉ユ煡鐪嬬鍙f槸鍚﹀勪簬LISTEN鐘舵併
鎬庝箞鏌ョ湅DB2鐨勫悗鍙拌繘紼嬶紵鎬庝箞鐪嬬郴緇熷垎閰嶇粰鏁版嵁搴撶殑瑁歌懼囷紵
1.unix/linuxls-al|grepdb2
2.濡傛灉浠巐v鐨勫悕瀛椾笂鐪嬩笉鍑烘潵灝辮繛涓婃暟鎹搴擄紝鐒跺悗鐪嬭〃絀洪棿瀹瑰櫒鍚
銆愭ャ戝備綍瀵煎嚭鏈嶅姟鍣ㄤ笂鐨刣b2鏁版嵁搴擄紝鏄瀵煎嚭鏁翠釜鏁版嵁搴擄紝鍖呮嫭琛ㄧ粨鏋勮〃絀洪棿錛屾暟鎹絳夛紵
涓嶇敤錛屽彲浠ヨ繙紼嬭繛鎺ュ埌鏈嶅姟鍣錛寃indows緋葷粺鍙浠ラ氳繃榪滅▼榪炴帴錛宭inux/unix緋葷粺鍙浠ラ氳繃ssh/telnet榪炴帴錛屽湪鏈嶅姟鍣ㄤ笂鐢╠b2connectto鏁版嵁搴撳悕榪炴帴鏁版嵁搴擄紝鐒跺悗閫氳繃db2look-d鏁版嵁搴撳悕-e-a-c-o瀵煎嚭鏂囦歡鍚.sql-i鐢ㄦ埛鍚-w瀵嗙爜瀵煎嚭緇撴瀯錛岄氳繃db2move鏁版嵁搴撳悕export-u鐢ㄦ埛鍚-p瀵嗙爜瀵煎嚭鏁版嵁錛
鍦ㄦ湰鍦板煎叆鍓嶅厛connect鏁版嵁搴擄紝鐒跺悗db2-td;-cf瀵煎嚭鏂囦歡鍚.sql鍦ㄦ湰鍦版牴鎹璇ユ枃浠秙ql寤虹珛鏁版嵁緇撴瀯錛屼箣鍚庣敤db2move鏁版嵁搴撳悕load-u鐢ㄦ埛鍚-p瀵嗙爜瀵煎叆鏁版嵁
濡備綍鏌ョ湅db2涓鍒涘緩鎴愬姛鐨勫瓨鍌ㄨ繃紼嬶紵
瀛樺偍榪囩▼錛歴p_xx.鏌ョ湅瀛樺偍linux錛歞b2"select*fromsyscat.PROCEDURES|grep-isp_xx"window:db2"select*fromsyscat.PROCEDURES|find/i"sp_xx""