2012年1月30日 星期一

(DB2錯誤訊息) EXP0022W

EXP0022W  Index has no statistics.  The index "SYSIBM  "."SQL120118172349760" has not had runstats run on it.  This can lead to poor cardinality and predicate filtering estimates.


http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.explain.doc%2Fdoc%2Fr0021347.html
runstats 指令 (可以從 CLP 提示輸入) 可以提供不同的統計值層次,如下列語法中所示:
基本統計值

表格:
RUNSTATS ON TABLE 表格名稱
索引:
RUNSTATS ON TABLE 表格名稱 FOR INDEXES ALL
表格及索引:
RUNSTATS ON TABLE 表格名稱 AND INDEXES ALL
加強統計值

表格:
RUNSTATS ON TABLE 表格名稱 WITH DISTRIBUTION
索引:
RUNSTATS ON TABLE 表格名稱 FOR DETAILED INDEXES ALL
表格及索引:
RUNSTATS ON TABLE 表格名稱 WITH DISTRIBUTION AND DETAILED INDEXES ALL
註: 在上述每一個指令中,表格名稱必須與綱目名稱一樣完整。

(DB2,列出該Table所有的index) describe indexes FOR table

db2 => describe indexes FOR table MyTableName

索引                           索引               唯一         號碼      索引                       索引
綱目                           名稱               規則         直欄      類型              分割
------------------------------- ------------------- -------------- -------------- --------------------------- --------------
MyDBsCHEMA                        IDX_NO                   D                           1 RELATIONAL DATA                                                                 -
SYSIBM                          SQL120118172349760  P                           4 RELATIONAL DATA                                                                 -

    已選取 2 個記錄。
[root@localhost bin]# db2expln -d SAMPLEDB -g -c db2inst1 -p P0203450 -s 0 -t

DB2 Universal Database Version 9.7, 5622-044 (c) Copyright IBM Corp. 1991, 2009
Licensed Material - Program Property of IBM
IBM DB2 Universal Database SQL and XQUERY Explain Tool

DB2 Universal Database Version 9.7, 5622-044 (c) Copyright IBM Corp. 1991, 2009
Licensed Material - Program Property of IBM
IBM DB2 Universal Database SQL and XQUERY Explain Tool

No packages found for package pattern "DB2INST1"."P0203450" with version "".
[root@localhost bin]#




 

可以查看是否有該packages
select pkgschema, pkgname from syscat.packages where pkgname = 'P0203450'

ref:
http://book.51cto.com/art/200906/129110.htm

SQL0035N 無法開啟檔案 "db2expln.msg"

[db2inst1@localhost bin]$ db2expln -d SAMPLEDB -g -c db2inst1 -p P0203450 -s 0 -t

DB2 Universal Database Version 9.7, 5622-044 (c) Copyright IBM Corp. 1991, 2009
Licensed Material - Program Property of IBM
IBM DB2 Universal Database SQL and XQUERY Explain Tool

Error during Bind.

Message Text =
SQL0035N  無法開啟檔案 "db2expln.msg"。


sqlcaid   = SQLCA
sqlcabc   = 136
sqlcode   = -35
sqlstate  =
sqlerrml  = 12
sqlerrmc  = "db2expln.msg"
sqlerrp   = sqlabndx
sqlerrd0 = 0x00000000 = 0
sqlerrd1 = 0x00000000 = 0
sqlerrd2 = 0x00000000 = 0
sqlerrd3 = 0x00000000 = 0
sqlerrd4 = 0x00000000 = 0
sqlerrd5 = 0x00000000 = 0
sqlwarn   = ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '

Error during bind.
Bind messages can be found in db2expln.msg
[db2inst1@localhost bin]$

寫檔權限不足

2012年1月20日 星期五

(DB2) reorgchk current statistics on table all

db2 => reorgchk current statistics on table all
 基本上是REORG欄位有星號的Table要做reorg

表格統計:

F1: 100 * OVERFLOW / CARD < 5
F2: 100 *(資料頁的有效空間使用率)> 70
F3: 100 *(必要的頁數 / 總頁數)> 80

SCHEMA.NAME                     CARD     OV     NP     FP ACTBLK    TSIZE  F1  F2  F3 REORG
----------------------------------------------------------------------------------------
表格: DB2INST1.EXPLAIN_ARGUMENT
                                   -      -      -      -      -        -   -   -   - ---
表格: DB2INST1.EXPLAIN_DIAGNOSTIC
                                   -      -      -      -      -        -   -   -   - ---
表格: DB2INST1.EXPLAIN_DIAGNOSTIC_DATA
                                   -      -      -      -      -        -   -   -   - ---

查看DB2CODEPAGE

db2 => SELECT CODEPAGE FROM SYSCAT.DATATYPES WHERE TYPENAME = 'VARCHAR'

CODEPAGE
--------
     950


see also:
db2set DB2CODEPAGE=1208
GET DATABASE CONFIGURATION

ref:
http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.jdbc_pg.doc/jdbc187.htm

http://publib.boulder.ibm.com/infocenter/db2luw/v8//index.jsp?topic=/com.ibm.db2.udb.doc/admin/r0004565.htm

http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.nls.doc%2Fdoc%2Fr0004565.html


Choosing the code page, territory, and collation for your database
http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.nls.doc%2Fdoc%2Ft0004617.html

2012年1月19日 星期四

DB2 資料庫配置參數 中英對照

DFT_QUERYOPT - 預設查詢最佳化類別
DBHEAP - 資料庫資料堆
CATALOGCACHE_SZ - 型錄快取大小
LOGBUFSZ - 日誌緩衝區大小
UTIL_HEAP_SZ - 公用程式資料堆大小
BUFFPAGE - 緩衝池大小
LOCKLIST - 鎖定清單的儲存體上限
APP_CTL_HEAP_SZ - 應用程式控制資料堆大小上限
SORTHEAP - 排序清單資料堆
STMTHEAP - SQL 陳述式資料堆
APPLHEAPSZ - 預設應用程式資料堆
STAT_HEAP_SZ - 統計資料資料堆大小
MAXLOCKS - 每個應用程式的鎖定清單百分比
LOCKTIMEOUT - 鎖定逾時
NUM_IOCLEANERS - 非同步頁面清除器的數量
NUM_IOSERVERS - 伺服器的數目
MAXAPPLS - 作用中應用程式數上限
AVG_APPLS - 平均的作用中應用程式數目
MAXFILOP - 每一應用程式可開啟的 DB 檔案數上限
NEWLOGPATH - 用來建立日誌檔的新路徑
LOGFILSIZ - 日誌檔大小
LOGPRIMARY - 主要日誌檔的數目
LOGSECOND - 次要日誌檔數量

ref:
http://publib.boulder.ibm.com/infocenter/pim/v6r0m0/index.jsp?topic=%2Fcom.ibm.wpc.ins.doc%2Fwpc_ref_ibm_db2_db_config_params.html

調整DB2 trasaction log大小

db2 => update db cfg using logfilsiz 40960
DB20000I  UPDATE DATABASE CONFIGURATION 指令已順利完成。
SQL1363W  一個以上的因立即修改所提交的參數並未動態地變更
。對這些配置參數而言,
所有的應用程式都必須在變更生效前切斷與此資料庫的連接。

db2 => get snapshot for database on DBNAME
資料庫可用的日誌空間(位元組數)           = 68766259
資料庫已使用的日誌空間(位元組數)         = 2188749
已使用的輔助日誌空間上限(位元組)         = 15981617
已使用的總日誌空間上限(位元組)           = 70241329
Log space available to the database (Bytes)= 204000000
Log space used by the database (Bytes)     = 0
Maximum secondary log space used (Bytes)   = 0
Maximum total log space used (Bytes)       = 5021692
*如果Maximum secondary log space used大於0,表示transaction的空間大小太小,要放大*

解法二(增加transaction log數量):
db2 =>update db cfg for DBNAME  using LOGSECOND 40

解法三(調程式):
調整程式的transaction,不要拉太長

ref:SQLCODE: -964, SQLSTATE: 57011

2012年1月13日 星期五

Properties Editor

It is released from the troublesomeness of the Unicode conversion by native2ascii.
http://propedit.sourceforge.jp/index_en.html

JD-Eclipse | Java Decompiler

http://java.decompiler.free.fr/?q=jdeclipse

2012年1月12日 星期四

DB2清空Table的資料(使用load)

db2 "load from /dev/null of del replace into $table_name"

2012年1月10日 星期二

Sysdeo Eclipse Tomcat Launcher plugin

http://www.eclipsetotale.com/tomcatPlugin.html

下載解壓縮後,將com.sysdeo.eclipse.tomcat_3.3.0丟到Eclipse的dropins資料夾(for Eclipse 3.4, 3.5 and 3.6)

http://www.eclipsetotale.com/tomcatPlugin.html#A4
Eclipse 2.1, 3.0, 3.1, 3.2 and 3.3丟到plugins資料夾

2012年1月7日 星期六

unrecognized auth response from

http://hackang.iteye.com/blog/234000

如果提示unrecognized auth response from 你的主机名: cvs pserver: cannot open /home/cvsroot/CVSROOT/config: Permission denied
请 执行

vi /etc/selinux/config

修改SELINUX=disabled

保存退出,重启电脑

2012年1月5日 星期四

DB2 profile

http://publib.boulder.ibm.com/infocenter/rtchelp/v1r0/index.jsp?topic=/com.ibm.help.rtc.gateway.doc/i_rtc_t_silent_installation.html




Windows:
db2cmd

Linux or AIX:
.  /db2adminHomeDir/sqllib/db2profile

Note the period (.) and space before /db2adminHomeDir/sqllib/db2profile.

Solaris:
source /db2adminHomeDir/sqllib/db2profile

(DB2 Service Name) db2j_DB2及db2c_DB2

db2j_DB2 55000/tcp
db2c_DB2 50000/tcp

改成其他PORT(如50100):
db2 UPDATE DBM CFG USING SVCENAME 50100

ref:
http://tech.snathan.org/tech/db2/db2_install_on_windows#operating_system_security_for_db2_objects

http://www.ibm.com/developerworks/data/library/techarticle/dm-0410wright/

2012年1月4日 星期三

(變更vdi 的uuid)VBoxManage clonevdi出現UUID already exists

C:\Program Files\Oracle\VirtualBox>VBoxManage clonevdi "D:\MyVMOld.vdi" "D:\MyVMNew.vdi"
VBoxManage.exe: error: Cannot register the hard disk 'D:\MyVMOld.vdi' {439d46fd-1ec5-4da7-9993-744e548bd680} because a hard disk 'D:\MyVMNew.vdi' with UUID {439d46fd-1ec5-4da7-9993-744e548bd680} already exists
VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component VirtualBox, interface IVirtualBox, callee IUnknown
Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, AccessMode_ReadWrite, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 210 of file VBoxManageDisk.cpp

解決方式(使用4.1.8版):
C:\Program Files\Oracle\VirtualBox>VBoxManage internalcommands sethduuid D:\CentOS-6.2_DB2_WAS_25GB_office.vdi
UUID changed to: 75ad028a-3d81-4817-85f5-b0d195527561

Port number settings in WebSphere Application Server

http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.nd.doc%2Finfo%2Fae%2Fae%2Frmig_portnumber.html

安裝及配置 IBM HTTP Server 與 Web 伺服器外掛程式

http://publib.boulder.ibm.com/infocenter/rqmhelp/v2r0/index.jsp?topic=/com.ibm.jazz.install.doc/topics/t_setting_up_ha.html

安裝及配置 IBM HTTP Server 與 Web 伺服器外掛程式

如果要安裝及配置 IBM® HTTP Server 與 Web 伺服器外掛程式,請遵循下列步驟:
  1. 安裝 IBM HTTP Server。請參閱http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/tins_webserver.html
  2. 安裝 Web 伺服器外掛程式。請參閱http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/tins_webplugins.html
  3. 將 Web 伺服器和應用程式伺服器分別配置在不同的機器上(遠端)。請參閱http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/tins_webplugins_remotesa.html
  4. 為了保護 Web 伺服器和用戶端之間的傳輸安全,請在 IBM HTTP Server 上啟用 SSL。請參閱在 IBM HTTP Server 中適當設定 SSL 指引

Shell啟動WebSphere

伺服器名稱:server1
設定檔名稱:server1
設定檔 Home:/opt/IBM/WebSphere/AppServer/profiles/server1
設定檔類型:default
Cell 名稱:localhostNode01Cell
節點名稱:localhostNode01
現行編碼:UTF-8
執行下列指令來啟動:/opt/IBM/WebSphere/AppServer/profiles/server1/bin/startServer.sh server1 -profileName server1
>ADMU0116I: 正在
>           /opt/IBM/WebSphere/AppServer/profiles/server1/logs/server1/startServer.log
>           檔中記載工具資訊
>ADMU0128I: 正在利用 server1 設定檔啟動工具
>ADMU3100I: 正在讀取伺服器的配置:server1
>ADMU3200I: 伺服器已啟動。正在等待起始設定狀態。

登入:
https://127.0.0.1:9043/ibm/console/logon.jsp

yum更新不輸入y

/usr/bin/yum -y update

VirtualBox NAT模式設定固定IP

IP:10.0.2.15
Gateway:10.0.2.2
MASK:255.255.255.0
DNS:10.0.2.2 (或先改用Hinet的:168.95.192.1)

ref: http://www.virtualbox.org/manual/ch09.html#changenat

2012年1月3日 星期二

將檔案從DOS格式轉成UNIX格式

不同檔名:
tr -d '\r' < TEST.sh > TEST2.sh

TEST.sh是來源檔,TEST2.sh是目地檔

同檔名:
perl -pi -e 's/\r\n/\n/g' TEST.sh

p.s.1.如果檔案是DOS格式,用vi編輯會看到^M的換行符號
p.s.2.用WinSCP傳檔會自動改格式,需參考 http://winscp.net/eng/docs/ui_pref_transfer,將
   傳輸模式改成Binary

出處:
http://www.cyberciti.biz/faq/howto-unix-linux-convert-dos-newlines-cr-lf-unix-text-format/

2012年1月2日 星期一

(CentOS)產生空檔

/bin/cat /dev/null > 空檔

用於Shell Script可清之前檔案中的資料,EX:log