Chinaunix首页 | 论坛 | 博客
  • 博客访问: 664752
  • 博文数量: 168
  • 博客积分: 2928
  • 博客等级: 中校
  • 技术积分: 1904
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-04 09:56
文章分类

全部博文(168)

文章存档

2010年(168)

我的朋友

分类: 数据库开发技术

2010-12-23 10:17:10

在timesten中的字符集问题 5107


Command> create readonly cache group read_tt autorefresh interval 5 seconds from tt(a int primary

key);
 5107: Oracle(OCI) error in OCIStmtExecute(): ORA-06552: PL/SQL: Compilation unit analysis

terminated
ORA-06553: PLS-553: character set name is not recognized rc = -1
The command failed.
解决方法:
首先检查oracle中的字符集:
SQL> select * from v$nls_parameters where parameter='NLS_CHARACTERSET';

PARAMETER
----------------------------------------------------------------
VALUE
----------------------------------------------------------------
NLS_CHARACTERSET
AL32UTF

将字符集修改为ZHS16GBK
SQL> update props$ set value$='ZHS16GBK' where name='NLS_CHARACTERSET';

1 row updated.

SQL> select * from v$nls_parameters where parameter='NLS_CHARACTERSET';

PARAMETER
----------------------------------------------------------------
VALUE
----------------------------------------------------------------
NLS_CHARACTERSET
ZHS16GBK


到这里还不算结束,对于平常的操作可以正常显示,但对于exp,imp以及于timsten的连接时创建就会报错。
另外,终端选项卡里的字符设置成为GB2312.
SQL>shutdown immediate;
SQL>startup mount;
SQL> alter system enable restricted session;
SQL> alter system set job_queue_processes=0;
System altered.
SQL> alter system set AQ_TM_PROCESSES=0;
System altered.
SQL> alter database open;
SQL>alter database character set internal_use ZHS16GBK; (统一化设置)
SQL> alter database national character set internal_use ZHS16GBK;
检查一下字符集:
SQL>SELECT DISTINCT (NLS_CHARSET_NAME(CHARSETID)) CHARACTERSET,
DECODE(TYPE#, 1,
DECODE(CHARSETFORM, 1, 'VARCHAR2', 2, 'NVARCHAR2', 'UNKOWN'),
9,
DECODE(CHARSETFORM, 1, 'VARCHAR', 2, 'NCHAR VARYING', 'UNKOWN'),
96,
DECODE(CHARSETFORM, 1, 'CHAR', 2, 'NCHAR', 'UNKOWN'),
112,
DECODE(CHARSETFORM, 1, 'CLOB', 2, 'NCLOB', 'UNKOWN')) TYPES_USED_IN
FROM SYS.COL$
WHERE CHARSETFORM IN (1, 2)
 12  AND TYPE# IN (1, 9, 96, 112);

CHARACTERSET                             TYPES_USED_IN
---------------------------------------- -------------
AL16UTF16                                NCHAR
AL16UTF16                                NCLOB
AL16UTF16                                NVARCHAR2
ZHS16GBK                                 CHAR
ZHS16GBK                                 CLOB
ZHS16GBK                                 VARCHAR2

注意:sys.odbc.ini的文件中要写上数据库的字符集:
以上做完之后可能在timesten中看到的仍然是乱码,这是需要在sys.odbc.ini文件中按如下属性:

[ODBC Data Sources]
dsa=TimesTen 7.0 Driver
dsacs=TimesTen 7.0 Driver

[dsa]
Driver=/timesten/TimesTen/tt80/lib/libtten.so
DataStore=/timesten/TimesTen/tt80/info/dsa/dsa
DatabaseCharacterSet=ZHS16GBK
ConnectionCharacterSet=ZHS16GBK
PermSize=64
TempSize=16
Authenticate=0
OracleID=ora10
UID=tt
Oraclepwd=tt
PWD=redhat
[dsacs]
TTC_SERVER=LocalHost_tt80
TTC_SERVER_DSN=dsa

,然后重新启动ttisql

[timesten@yy info]$ ttDaemonAdmin -stop
TimesTen Daemon stopped.
[timesten@yy info]$ ttDaemonAdmin -start
TimesTen Daemon startup OK.
[timesten@yy info]$ ttisql dsa

Copyright (c) 1996-2008, Oracle.  All rights reserved.
Type ? or "help" for help, type "exit" to quit ttIsql.
All commands must end with a semicolon character.

 

connect "DSN=dsa";
Connection successful:

DSN=dsa;UID=tt;DataStore=/timesten/TimesTen/tt80/info/dsa/dsa;DatabaseCharacterSet=ZHS16GBK;Conne

ctionCharacterSet=ZHS16GBK;DRIVER=/timesten/TimesTen/tt80/lib/libtten.so;OracleId=ora10;Authentic

ate=0;PermSize=64;TempSize=16;TypeMode=0;
(Default setting AutoCommit=1)
Command> select * from tt2;
< 慕容落雪 >
1 row found.
Command>

 

阅读(3401) | 评论(0) | 转发(0) |
0

上一篇:安装timesten70620在redhat4.7

下一篇:没有了

给主人留下些什么吧!~~