Skip to content

设置MYSQL字符集附上常见错误

一、mysql的多字符集支持
1:设置mysqld服务同时支持多个字符集
        将mysqld服务的默认字符集改为utf8,并同时支持latin1、gbk、gb2312、big5、ascii字符集。可以为不同的数据库、表使用不同的字符集编码。

      1) 源码编译时候:./configure步骤时需增加字符集支持选项,例如:
shell> ./configure –with-charset=utf8 –with-collation=utf8_bin –with-extra-charsets=big5,ascii,gb2312,gbk,utf8,latin1

          //默认的字符集缺省为latin1。
          //其中,utf8对应可用的collation值为:utf8_bin、utf8_general_ci、utf8_unicode_ci
          //extra支持也可以使用 "–with-extra-charsets=all"。

      2) make设置:在make步骤之前,修改config.h头文件,查找utf8、gbk、gb2312等定义字符集变量的行,确认有如下内容(如果没有则需要手动添加),例如:
#define HAVE_CHARSET_ascii 1
#define HAVE_CHARSET_big5 1
#define HAVE_CHARSET_gb2312 1
#define HAVE_CHARSET_gbk 1
#define HAVE_CHARSET_latin1 1
#define HAVE_CHARSET_utf8 1

          //一开始没有修改config.h,费了好多功夫,"mysql>"环境中使用非默认字符集时总报"Error 1115"错误:
mysqld> set names gbk;
ERROR 1115 (42000): Unknown character set: 'gbk'
          //后来发现在./configure完成后,config.h文件中并没有自动打开gbk、gb2312等变量定义,不得不手动修改添加。

2、验证mysqld服务的多字符集支持
        1) 查看当前mysql数据库支持的字符集
mysql> show character set;

        2) 查看对应字符集可用的校对规则
mysql> show collation like 'gb%';
mysql> show collation like 'utf8%';

        3) 查看当前mysql服务器使用的默认字符集状态
mysql> status
……
Server characterset:  utf8
Db     characterset:  utf8
Client characterset:  utf8
Conn.  characterset:  utf8

        4) 在创建数据库时指定使用的默认字符集:
mysql> create database testdb default character set utf8;
mysql> show create database testdb;     //验证数据库建立信息

        5) 在创建数据表时指定使用的默认字符集:
mysql> create table testdb.tb1 ( id int(10) unsigned NOT NULL AUTO_INCREMENT,name varchar(15) NOT NULL default '',PRIMARY KEY  (id) ) ENGINE=MyISAM DEFAULT CHARACTER SET gb2312;
mysql> show create table testdb.tb1;     //验证数据表建立信息

        6) 在mysql>客户端环境中设置使用的默认字符集
mysql> set NAMES utf8;

 

——————————————————

 

安装mysql遭遇的一些错误

1.Starting MySQL.Manager of pid-file quit without updating file.[FAILED]

解决 — 删除mysql-bin.index文件,

这个文件你可能不知道在哪里,可以这样子找

find /  -name mysql-bin.index

一般是在安装目录下的data或者是/var/lib/mysql下面

2.编译时候遭遇的错误

指定/usr/local/mysql目录的configure。
./configure –prefix=/usr/local/mysql –with-charset=utf8 –with-collation=utf8_bin –with-extra-charsets=gbk,ascii,gb2312,big5,utf8,latin1

问题:
configure: error: No curses/termcap library found

原因是缺少curses这个依赖包,通过yum安装即可

解决:
yum install ncurses-devel*

yum -y install gcc-c++

ORA-00932: inconsistent datatypes: expected BLOB, CLOB got CHAR

aix 5.309

oracle:10204

中午在导库时候报错:

misdb1:/home/oracle$exp userid=system/oracle full=y direct=y recordlength=65535 file=/backup/oracle/exp_full.dmp log=/backup/oracle/exp_full.log

Export: Release 10.2.0.4.0 – Production on Fri Jun 10 12:39:19 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set

About to export the entire database …
. exporting tablespace definitions
. exporting profiles
. exporting user definitions
. exporting roles
. exporting resource costs
. exporting rollback segment definitions
. exporting database links
. exporting sequence numbers
. exporting directory aliases
. exporting context namespaces
. exporting foreign function library names
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions
. exporting system procedural objects and actions
. exporting pre-schema procedural objects and actions
. exporting cluster definitions
EXP-00056: ORACLE error 932 encountered
ORA-00932: inconsistent datatypes: expected BLOB, CLOB got CHAR
EXP-00056: ORACLE error 932 encountered
ORA-00932: inconsistent datatypes: expected BLOB, CLOB got CHAR
EXP-00000: Export terminated unsuccessfully

 

 

——————————————————————————————

登陆sqlplus 执行以下脚本解决

 

/oracle/product/10.2.0/rdbms/admin/catmetx.sql
/opt/oracle/product/10.2.0/rdbms/admin/utlrp.sql

 

 

添加几个dump进程的查询脚本

 

select sid, serial#
from v$session s, dba_datapump_sessions d
where s.saddr = d.saddr;

select sid, program from v$session where paddr in
  (select addr from v$process where pid in (—–));

这里的PID可以在后来的告警日志文件中找到。
使用并行的时候,可以在后台日志中找到PID,就是这里qcsid
select sid from v$px_session where qcsid = 23;
 

Rman 备份存储格式参数

%a,活动ID
%c,在多重备份中,备份片的拷贝数,最大256
不是多重备份时,用于备份集为1,用于代理副本拷贝为0
%d,数据库
%D,公历某月的日期(只有day部分),格式DD
%e,归档日志序号
%f,绝对文件号
%F,由DBID(数据库ID),日月年,序号组成
形式为c-IIIIIIIIII-YYYYMMDD-QQ,c为固定
IIIIIIIIII表示DBID,连接RMAN时指定target,会显示DBID
YYYYMMDD为生成备份时的公历时间,比如20081122
QQ表示为16进制序号,00到FF
%h,归档日志线程号
%I,DBID
%M,公历月份,格式MM
%N,表空间名
%n,数据库名,如果数据库名不满8字符,将在右边自动填充'x'
比如,库名为test,结果将是testxxxx
%p,备份集中的备份片号,从1开始,步进1
Note: If you specify PROXY, then the %p variable must be included in the
FORMAT string either explicitly or implicitly within %U.
%s,备份集号,此号记录在控制文件中,每次备份会自动增加
重建控制文件将会初始化为1
%t,备份集时间戳,秒为单位
%T,公历年月日,格式YYYYMMDD
%u,8字符名称,利用备份集或副本拷贝号,备份生成时间,由系统通过某种算法得出
%U,许多FORMAT的默认值,由系统生成的唯一名称,对于副本拷贝和备份集的含义不同
对于备份集的备份片来说,等同于%u_%p_%c
对于数据文件副本拷贝,等同data-D-%d_id-%I_TS-%N_FNO-%f_%u
对于归档日志副本拷贝,等同arch-D_%d-id-%I_S-%e_T-%h_A-%a_%u
对于控制文件副本拷贝,等同cf-D_%d-id-%I_%u
%Y,公历年,格式YYYY
%%,表示一个百分号字符'%'

Oracle Recommended Patches — Oracle Database

Oracle Recommended Patches — Oracle Database

Beginning with release 10.2.0.3, Oracle releases Recommended Patches for Oracle Database. For an introduction to Recommended Patches, see Note:756388.1.

Target Configurations

Recommended Patches are provided for the following target configurations:

  • Generic
  • Real Application Clusters
  • Data Guard
  • Exadata
  • Ebusiness Suite Certification

Patch Availability

Recommended Patches are released on all platforms at the same time. They are generally available on the following platforms: HP-UX PA-RISC, Solaris Operating System (SPARC 64-Bit), HP-UX Itanium, IBM AIX on POWER Systems (64-Bit), Linux x86 (32-bit), and Linux x86-64.

Oracle provides bundled patches for Microsoft Windows platforms. Recommended patches are included in these bundles rather than as separately downloadable patches. See Note:161549.1 for details of the bundled patches for Microsoft platforms. It is recommended to apply the most current Windows bundle patch .

Patches on other platforms are created on request.

Whenever planning on patching or upgrading you can get help from the Patch Planner or Upgrade Planner in My Oracle Support – See Note:847410.5 for more information.

Current Recommended Patches

 

11.2.0.2 Current Recommended Patches

Patch Set Updates

Document Description Rolling RAC Patch Download
Note:11724916.8 11.2.0.2.2 Patch Set Update (PSU) Yes Patch:11724916

Generic

Document Description Rolling RAC Patch Download
Note:1321817.1 Mutex waits may cause higher CPU usage in 11.2.0.2.2 PSU / GI PSU Yes Patch:12431716

Grid Infrastructure

Document Description Rolling RAC Patch Download
Note:12311357.8 11.2.0.2.2 Grid Infrastructure Patch Set Update (GI PSU) Yes Patch:12311357

Exadata

Document Description Rolling RAC Patch Download
Note:888828.1 Recommended Patch Information for Database Machine and Exadata Storage Server 11g Release 2 (11.2)

EBusiness Suite R11i Certification

Document Description Rolling RAC Patch Download
Note:881505.1 Interoperability Notes for Oracle E-Business Suite Release 11i with Oracle Database 11.2.0.2

EBusiness Suite R12 Certification

Document Description Rolling RAC Patch Download
Note:1058763.1 Interoperability Notes for Oracle E-Business Suite Release 12 with Oracle Database 11.2.0.2

 

11.2.0.1 Current Recommended Patches

Patch Set Updates

Document Description Rolling RAC Patch Download
Note:11724930.8 11.2.0.1.5 Patch Set Update (PSU) Yes Patch:11724930

Grid Infrastructure

Document Description Rolling RAC Patch Download
Note:9655006.8 11.2.0.1.2 Grid Infrastructure Patch Set Update (GI PSU) Yes Patch:9655006

Exadata

Document Description Rolling RAC Patch Download
Note:888828.1 Recommended Patch Information for Database Machine and Exadata Storage Server 11g Release 2 (11.2)

EBusiness Suite R11i Certification

Document Description Rolling RAC Patch Download
Note:1265268.1 Interoperability Notes for Oracle E-Business Suite Release 11i with Oracle Database 11.2.0.1

EBusiness Suite R12 Certification

Document Description Rolling RAC Patch Download
Note:1265232.1 Interoperability Notes for Oracle E-Business Suite Release 12 with Oracle Database 11.2.0.1

11.1.0.7 Current Recommended Patches

Patch Set Updates

Document Description Rolling RAC Patch Download
Note:11724936.8 11.1.0.7.7 Patch Set Update (PSU) Yes Patch:11724936

CRS

Document Description Rolling RAC Patch Download
Note:11724953.8 11.1.0.7.7 CRS Patch Set Update (CRS PSU) Yes Patch:11724953

Data Guard

Document Description Rolling RAC Patch Download
Note:7628357.8 11.1.0.7 Data Guard Broker Recommended Patch Bundle #1 No Patch:7628357

Exadata

Document Description Rolling RAC Patch Download
Note:835032.1 Recommended Patch Information for Database Machine and Exadata Storage Server 11g Release 1 (11.1)

EBusiness Suite R11i Certification

Document Description Rolling RAC Patch Download
Note:452783.1 Interoperability Notes for Oracle E-Business Suite Release 11i with Oracle Database 11.1.0.7
Note:7295298.8 Poor Subquery filter order / Queries against ALL_OBJECTS can be slow Yes Patch:7295298
Note:7253531.8 A dump [ttci2u] passing LOB data over heterogeneous connection with multibyte Yes Patch:7253531
Note:6530141.8 False ORA-979 can occur on an UPDATE DML Yes Patch:6530141

EBusiness Suite R12 Certification

Document Description Rolling RAC Patch Download
Note:735276.1 Interoperability Notes for Oracle E-Business Suite Release 12 with Oracle Database 11.1.0.7
Note:7684818.8 11.1.0.7 EBusiness Suite R12 Certification Patch Bundle #1 Yes Patch:7684818
Note:7630760.8 HPUX: 11.1.0.7 patch install deletes libskgxp11.a No Patch:7630760
Note:7253531.8 A dump [ttci2u] passing LOB data over heterogeneous connection with multibyte Yes Patch:7253531

11.1.0.6 Current Recommended Patches

EBusiness Suite R11i Certification

Document Description Rolling RAC Patch Download
Note:9196488.8 PLS-306 executing procedure on 11g from lower version PLSQL client No Patch:9196488
Note:7253531.8 A dump [ttci2u] passing LOB data over heterogeneous connection with multibyte Yes Patch:7253531
Note:6972189.8 Invalid package bodies when using _load_without_compile option Yes Patch:6972189
Note:6778860.8 11.1.0.6 EBusiness Suite R11 Certification Patch Bundle #1 No Patch:6778860
Note:6501565.8 Dump under JVM from JIT of Java class compiled with old Java compiler No Patch:6501565

EBusiness Suite R12 Certification

Document Description Rolling RAC Patch Download
Note:7377378.8 11.1.0.6 EBusiness Suite R12 Certification Patch Bundle #1 Yes Patch:7377378
Note:7253531.8 A dump [ttci2u] passing LOB data over heterogeneous connection with multibyte Yes Patch:7253531
Note:6991626.8 Datapump export fails with ORA-39126 / ORA-22813 Yes Patch:6991626
Note:6815733.8 OERI [qctcte1] from cost based transformation with subquery in ORDER BY clause Yes Patch:6815733
Note:6598432.8 ORA-1466 from read-only transaction when client / server in different timezones Yes Patch:6598432
Note:6266400.8 A dump can occur in kokbTabFuncRewrite Yes Patch:6266400

10.2.0.5 Current Recommended Patches

Patch Set Updates

Document Description Rolling RAC Patch Download
Note:11724962.8 10.2.0.5.3 Patch Set Update (PSU) Yes Patch:11724962

CRS

Document Description Rolling RAC Patch Download
Note:9952245.8 10.2.0.5.2 CRS Patch Set Update (CRS PSU) Yes Patch:9952245

10.2.0.4 Current Recommended Patches

Oracle has introduced Patch Set Updates (PSU) for 10.2.0.4 which include recommended fixes for generic , RAC and DataGuard issues.
The PSU should be treated as the recommended patch for these areas – additional recommendations may be listed below under relevant areas.
Please read Note:854428.1 for an introduction to Patch Set Updates.

Patch Set Updates

Document Description Rolling RAC Patch Download
Note:11724977.8 10.2.0.4.8 Patch Set Update (PSU) Overlay Yes Patch:11724977
Note:9352164.8 10.2.0.4.4 Patch Set Update (PSU) Yes Patch:9352164

Generic

Document Description Rolling RAC Patch Download
Note:9572766.8 Recommended merge fix for bug 6994194 and bug 8830147 Yes Patch:9572766

RAC

Document Description Rolling RAC Patch Download
Note:6367097.8 Recommended on HP Itanium: RAC diagnostics can abort the instance (LMS ORA-484) Yes Patch:6367097
Note:6079224.8 Recommended on Linux: RAC ORA-27506 / IPC Send timeout Yes Patch:6079224

CRS

Document Description Rolling RAC Patch Download
Note:9294403.8 10.2.0.4.4 CRS Patch Set Update (CRS PSU) Yes Patch:9294403

EBusiness Suite R12 Certification

Document Description Rolling RAC Patch Download
Note:7014646.8 OERI [kkocxj : pjpctx] from complex query Yes Patch:7014646

10.2.0.3 Current Recommended Patches

RAC

Document Description Rolling RAC Patch Download
Note:7145055.8 10.2.0.3 RAC Recommended Patch Bundle #2 Yes Patch:7145055

CRS

Document Description Rolling RAC Patch Download
Note:7117233.8 10.2.0.3 CRS Recommended Patch Bundle #3 Yes Patch:7117233

Data Guard

Document Description Rolling RAC Patch Download
Note:6909784.8 Recommended Merge Fix for bug 6128197 with Data Guard Logical No Patch:6909784
Note:6081556.8 10.2.0.3 Data Guard RMAN Recommended Patch Bundle #1 Yes Patch:6081556
Note:6081550.8 10.2.0.3 Data Guard Logical Recommended Patch Bundle #1 No Patch:6081550
Note:6081547.8 10.2.0.3 Data Guard Physical Recommended Patch Bundle #1 Yes Patch:6081547
Note:6048286.8 10.2.0.3 Data Guard Broker Recommended Patch #1 No Patch:6048286

EBusiness Suite R11i Certification

Document Description Rolling RAC Patch Download
Note:6166683.8 Z-Linux: ctxhx missing from 10.2.0.3 Yes Patch:6166683
Note:412271.1 Upgrade to 10.2.0.3 can fail with ORA-600 [22635] Yes Patch:5892355
Note:5871314.8 Pickler fix needed to allow some DB upgrade / downgrade to work Yes Patch:5871314
Note:5257698.8 9idata NLS files missing leading to file handle leak No Patch:5257698

EBusiness Suite R12 Certification

Document Description Rolling RAC Patch Download
Note:6319846.8 EBusiness Suite R12 Certification Recommended Patch Bundle Yes Patch:6319846
Note:5240469.8 Linux-X86 64bit: genoccish generates lots of errors No Patch:5240469

Miscellaneous One Off Fixes

Document Description Rolling RAC Patch Download
Note:6875865.8 Database instrumentation for OCM Yes Patch:6875865
Note:6869828.8 Recommended Merge Fix of 6122097 and 5903829 Yes Patch:6869828
Note:471479.1 IOT corruption after upgrade from <= 9.2 to >= 10g Yes Patch:6646613
Note:6455161.8 Higher CPU / Higher "cache buffer chains" latch gets / Higher "consistent gets" after truncate/Rebuild No Patch:6455161
Note:453259.1 OERI[kcrfr_resize2] / cannot recover database No Patch:6128197
Note:453309.1 OERI[kcbo_link_q_1] / crash with fix for bug 5454831 installed Yes Patch:6017420
Note:5949701.8 Recommended Merge Fix of 5648872 and 5863277 Yes Patch:5949701
Note:455832.1 Client <= 9.2.0.7 / 10.1.0.4 can dump when running against higher level database No Patch:5933477
Note:5907779.8 Self deadlock hang on "cursor: pin S wait on X" (typically from DBMS_STATS) No Patch:5907779
Note:5896963.8 High LGWR CPU and longer "log file sync" with fix for bug 5065930 Yes Patch:5896963
Note:5765958.8 OERI[qcscpqbTxt] / OERI[qcsfbdnp:1] from ANSI query in PLSQL No Patch:5765958
Note:5728380.8 DML may spin under ktspffc searching for space in ASSM segment No Patch:5728380
Note:454464.1 Various dumps / instance crash possible Yes Patch:5605370
Note:5577046.8 ADD or DROP attribute causes UNION query to fail with ORA-1790 Yes Patch:5577046
Note:5514109.8 OERI [kql-hash-collision] / false ORA-955 No Patch:5514109
Note:5364143.8 Bind Peeking is not done upon query reload, Execution Plan changes Yes Patch:5364143
Note:5363584.8 Array insert into table can corrupt redo Yes Patch:5363584
Note:4899479.8 Undo/redo corruption if distributed transactions used No Patch:4899479