ITPub博客

首页 > 数据库 > 数据库开发技术 > DB2 Q&A

DB2 Q&A

原创 数据库开发技术 作者:husthxd 时间:2017-08-22 21:53:43 0 删除 编辑
1、问题:抽取/装载出现JAVA.IO.CHARCONVERSIONEXCEPTION异常,如何处理?
解决方法:
在java进程启动参数中加入-Ddb2.jcc.charsetDecoderEncoder=3

2、问题:如何更改log日志文件的大小?
解决方法:
db2 get db cfg for your_Database_Name
db2 update database your_Database_Name for LOGFILSIZE using 10240 db2 update database your_Database_Name for LOGPRIMARY using 256
db2stop
db2start

3、问题:如何查看执行计划?
db2expln -database sample -stmtfile /tmp/sql1.txt -terminal
db2expln -database sample -q "select * from sales where inv_year < 2001" -terminal

4、问题:SQL0332N Character conversion from the source code page "819" to the target
code page "1386" is not supported. SQLSTATE=57017

$db2set DB2CODEPAGE=819
$db2 terminate
$db2stop force
$db2start
$db2 connect to iso8859

5、问题:How to resolve MON_HEAP_SZ exception
set the MON_HEAP_SZ DB2 dbm variable to AUTOMATIC on the CTGINST1 instance. Run these commands from the DB2 command prompt opened in step 1:
get dbm cfg (to see the current settings)

If using DB2 9.5 or later using this command:
update dbm cfg using MON_HEAP_SZ AUTOMATIC

If using earlier versions of DB2, then use this command:
update dbm cfg using MON_HEAP_SZ

6、问题:如何设置控制台的终止符和设置当前的schema
设置终止符为分号";"
$db2 -t

设置当前schema为DBUSER
db2=>set current schema DBUSER

7、如何远程连接DB2服务器
db2 catalog tcpip node pc83 remote 192.168.1.83 server 50000
db2 catalog database iso8859 at node pc83
db2 list node directory
db2  LIST DATABASE DIRECTORY
-- 1.84 latin84
db2 catalog tcpip node pc84 remote 192.168.1.84 server 50000
db2 catalog database latin84 at node pc84
db2 list node directory
db2  LIST DATABASE DIRECTORY

db2set DB2CODEPAGE=819
db2 terminate
db2 connect to user db2inst1 using db2inst1

8、安装数据库后无法远程连接,但在本地可以正常连接
A.确认服务services是否存在
$grep db2 /etc/services
B.确认服务/端口是否已配置
$db2 get dbm cfg|grep SVC
如没有配置,则使用以下命令配置:
$db2 update database manager configuration using svcename [service_name|port_number] $db2stop $db2start
C.确认端口是否已监听
$netstat -an|grep

9、在console执行脚本
db2 -td; -cf -l <输出日志文件路径>


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/6906/viewspace-2143970/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
ITPUB数据库版块资深版主,对Oracle、PostgreSQL有深入研究。

注册时间:2007-12-28

  • 博文量
    1602
  • 访问量
    4380083