在系统环境变量中,新增变量 NLS_LANG,设置字符集为:AMERICAN_AMERICA.AL32UTF8(服务器端的字符集)。
Oracle字符串函数 平常我们用Oracle主要有两种字符串类型 1.char始终为固定的长度,如果设置了长度小于char列的值,则Oracle会自动用空格填充的。当比较char时,Oracle用空格将其填充为等长,再进行比较。 2.VarChar2数据类型为可变长度,虽然与VarChar数据类型是同义的,但在今后的Oracle版本中也许会有变化,所以应该避免使用VarChar,优先使用VarChar2。 固定长度的字符串字段使用Char,而其他所有的字符串字段都应使用VarChar2. 下面列出部分Or
NLS(National Language Support,国家语言支持)是数据库的一个非常强大的特性,控制着数据的许多方面,最重要的两个方面包括:1、文本数据采用何种编码存储在磁盘上。2、透明地将数据从一个字符集转换到另一个字符集。Oracle字符集可以分为数据库字符集和客户端字符集。客户端字符集定义了客户端字符数据的编码方式,任何发自或发往客户端的字符数据均使用客户端定义的字符集编码,客户端可以看作是能与数据库直接连接的各种应用,例如SQL*Plus、exp/imp等。客户端字符集是通过设置NLS_LANG参数来设定的。
1.数据库字符集:数据库需要存储多国语言选择AL32UTF8,只有中英文选择ZHS16GBK
在部署重构版测试环境时,需要创建Oracle数据库,使用dbca创建数据库之后没有注意数据库本身的字符集,导致后续所有的数据库脚本执行后中文乱码。最后的解决办法是清掉全库数据,再修改字符集,重启数据库。
编辑手记:很多人在进行数据库导入导出操作的时候会遇到字符集的问题,今日拣选了 《循序渐进Oracle》一书中的相关章节,希望对初学Oracle的朋友有所帮助。 在传统的EXP导出文件中,记录着导出使用
操作系统环境变量针对语言项设置有几个,我经常设置的是这两个LANG和NLS_LANG。
userenv函数返回当前会话(session)的相关信息。以下sql语句可以查询当前会话连接的数据库字符集
Oracle创建数据库时指定字符集,一般不能修改,整个数据库都是一个字符集。虽然还支持指定国家字符集,用于nvarchar2类型,不过很少用到。常用的字符集:AL32UTF8和ZHS16GBK,其中AL32UTF8与UTF8几乎是等价的。一个汉字在AL32UTF8中占三个字节,而在ZHS16GBK中占用两个字节。
在开发中常常碰到,需要导入dmp文件到现有数据库。这里的dmp文件可能来自于其它系统,所以,一般情况下是不知道导出程序(exp)的版本、导出时间或者导出模式等信息的。那么如何从现有的dmp文件中获取到这些信息呢?下面作者将一一讲解。
在Linux的系统中经常碰到字符集导致的错误,下面总结了设置修改系统语言环境的方法。
很多刚接触的朋友经常会搞混这两个字符集,数据库字符集是在创建数据库时进行指定的,不建议更改!而客户端字符集是可以随时更改的!
导读:本文来自『墨天轮』专栏“循序渐进Oralcle”(https://www.modb.pro/topic/6289,复制到浏览器中打开或者点击“阅读原文”),介绍《循序渐进Oracle》第三章的3.1-3.4节:字符集的基本知识、数据库的字符集、字符集文件及字符支持、NLS_LANG的设置与影响、导入导出及字符转换。
如果UTF8字符集且是Java服务器的话,当存储含有emoji表情时,会抛出类似如下异常:
环境说明: Oracle: 12.1.0.2.0 OS: CentOS Linux release 7.9.2009 MySQL: 5.7.38 Oracle 字符集:AMERICAN_AMERICA.AL32UTF8 MySQL 字符集:utf8
在使用exp/imp导出导入,经常会碰见各种的问题,前两天某公众号发了篇《IMP-00009:异常结束导出文件解决方案》,介绍了导入出现IMP-00009错误的解决方案,讲了各种场景,可以参考。
在开发过程中,我们有时会遇到数据库存储数据时出现字符编码问题的情况。其中一个常见的错误是Caused by: java.sql.SQLException: Incorrect string value,并且提到了具体的列名和行号。本文将详细介绍这个错误的原因和解决方案。
ORA-02374: conversion error loading table "QBJMES"."PROJECT"
http://www.eygle.com/special/NLS_CHARACTER_SET_04.htm
原文发表于itpub技术丛书《Oracle数据库DBA专题技术精粹》,未经许可,严禁转载本文.
不知不觉,MySQL8.0已经发布好多个GA小版本了。目前互联网上也有很多关于MySQL8.0的内容了,MySQL8.0版本基本已到稳定期,相信很多小伙伴已经在接触8.0了。本篇文章主要介绍从5.7升级到8.0版本的过程及注意事项,有想做版本升级的小伙伴可以参考下。
http://www.eygle.com/special/NLS_CHARACTER_SET_03.htm
正则表达式或“ regex”用于匹配字符串的各个部分。以下是我用于创建正则表达式的备忘单。
con = cx_Oracle.connect("pythondemo","welcome","192.168.188.11:1521/std1")
发现网上很多坑爹货,有很多意思表达不全,比如jdbc连接mysql数据库的时候,设置字符集编码
http://www.eygle.com/special/NLS_CHARACTER_SET_06.htm
数据库的全球化特性是数据库发展的必然结果,位于不同地区、不同国家、不用语言而使用同一数据库越来越普遍。对于不同国家或地区数据库通常会使用不同的字符集,而全球性企业也会选择使用统一编码的数据库字符集。Oracle数据库统一字符集为AL32UTF8,可以参考:Oracle 全球化特性与字符集。对于不同的字符集容易出现转换乱码,同时不同字符集也影响存储空间的占用。 如本文下面的描述。 一、字符集环境变量对数据库的影响 [oracle@java_1 ~]$ env |grep LANG LANG=zh_CN.
1、下载Oracle安装包:linux.x64_11gR2_database_1of2.zip 和 linux.x64_11gR2_database_2of2.zip ,可以下载到本地,通过ftp服务上传到Linux系统,也可以使用Linux系统的wget命令,下载文件包;
数据库的全球化特性是数据库发展的必然结果,位于不同地区、不同国家、不用语言而使用同一数据库越来越普遍。Oracle数据库提供
最近在一次MySQL数据迁移的过程中遭遇了字符集的问题,提示为"Character set 'utf8mb4' is not a compiled character set"。即是字符集utf8mb4不是一个编译的字符集以及没有在Index.xml文件里指定。下面是其处理过程及解决办法,供大家参考。
有时我们使用SecureCRT软件连接到我们的Oracle目标主机,会发现有些回显信息显示为乱码,非常不方便操作。 本文将介绍最常见的两种乱码情况解决方法。
最近因为业务需要安装oracle数据库,那真是一顿操作猛如虎,结果一看都是坑,要么无法远程安装,要么依赖包装不上,要么参数配置有问题。最后在同事的帮助下,终于可以安装成功了。今天小编就和大家分享下centos7.6下安装oracle11g的详细操作方法。
Oracle的imp/exp组件是我们常用的工具,它的一个操作原则就是向下兼容。下面是据此总结的几个使用规则和相关测试: 规则1:低版本的exp/imp可以连接到高版本(或同版本)的数据库服务器,但高版本的exp/imp不能连接到低版本的数据库服务器 --1.1 使用9i客户端通过imp连接到10g数据库 C:\Documents and Settings\yuechaotian>exp userid=hdtest/test@s67 tables=(ab01) rows=n file=d:\x.dmp Export: Release 9.2.0.1.0 - Production on 星期三 2月 20 10:09:55 2008 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. 连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options 已导出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集 注: 将不会导出表数据(行) 即将导出指定的表通过常规路径 ... . . 正在导出表 AB01 在没有警告的情况下成功终止导出。 --1.2 使用10g客户端通过imp连接9i数据库:连接失败(而不是导出失败) C:\Documents and Settings\yuechaotian>exp userid=hbjb_kf_hd/test@s46 owner=hdtest file=d:\x.dmp Export: Release 10.2.0.1.0 - Production on 星期三 2月 20 09:57:22 2008 Copyright (c) 1982, 2005, Oracle. All rights reserved. EXP-00056: 遇到 ORACLE 错误 6550 ORA-06550: 第 1 行, 第 41 列: PLS-00302: 必须说明 'SET_NO_OUTLINES' 组件 ORA-06550: 第 1 行, 第 15 列: PL/SQL: Statement ignored EXP-00000: 导出终止失败 规则2:高版本exp出的dmp文件,低版本无法imp(无法识别dmp文件) --2.1 使用10g客户端exp出10g的数据 C:\Documents and Settings\yuechaotian>exp userid=test/test@orcl owner=test file=d:\10g.dmp Export: Release 10.2.0.1.0 - Production on 星期三 2月 20 11:16:39 2008 Copyright (c) 1982, 2005, Oracle. All rights reserved. 连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options 已导出 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集 服务器使用 AL32UTF8 字符集 (可能的字符集转换) 即将导出指定的用户... …… 导出成功终止, 但出现警告。 C:\Documents and Settings\yuechaotian> --2.2 使用9i客户端imp上面所导出的dmp文件到10g:可以连接到10g中,但无法识别文件 C:\Documents and Settings\yuechaotian>imp userid=test/test@s10g fromuser=test touser=test file=d:\10g.dmp Import: Release 9.2.0.1.0 - Production on 星期三 2月 20 11:20:33 2008 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. 连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With t
Oracle数据库是广泛使用的关系型数据库管理系统,而SQLPlus是Oracle提供的一种交互式命令行工具,用于执行SQL语句。然而,当在SQLPlus中执行SQL语句时,如果SQL语句中包含中文字符,可能会出现乱码问题,甚至导致错误。本文将介绍如何解决在Oracle SQL*Plus中执行SQL语句时出现中文乱码和报错的问题。
前一段时间 ,我们完成了 Java 集合与数据结构的学习 , 之后我们将进入 Mysql 数据库的课程中。
这里要注意字符集应和校对规则名称相对应,不可一边UTF8 一边GBK, 如若没有指定字符集和校对规则名字,则会按照默认MySQL默认方式(MySQL目录 my.ini配置文件)创建数据库,下面给出一些常用的字符集以及校对规则名称。
创建备份数据的目录 mkdir -p /home/oracle/dbbak/data
编码问题我仍旧没搞懂,最根本的从哪里来就没搞懂。当页面发送请求,编码到后台是什么编码呢?好吧,我默认的都是utf-8.后台接收参数后,可以在控制台打印出来,我也不清楚是什么编码。然后,就是数据库问题。 在mysql数据库,首先会设置mysql安装的字符集为utf-8,然后在连接的jdbc上注明characterEncoding是utf-8.一直这样统一下去,没有出现乱码。 连接oracle就出现问题了,我使用的一个已经安装好的oracle数据库。字符集是American,us7ascii.我插入和查询的中文
instantclient-basic-nt-11.2.0.3.0.zip客户端压缩包为例
近期在项目中,要对1张100多万条记录的表进行查询,然后进行一些数据的统计,但是在这个过程中,发现只查询出来几条数据就出现了UnicodeDecodeError了。 在这里,我们使用sqlalchemy库进行查询,其内部还是Cx_Oracle来进行对应的操作,使用的Python版本为3.5.0,宿主系统为Windows 2008 Server,然后进行类似如下的操作: from sqlalchemy import create_engine engine = create_engine('oracl
针对已经存在的 Confluence 安装,如果你安装的 Confluence 版本是 6.4 或者早期的版本,我们在安装的时候没有检查你数据库的字符设置。
何剑敏 Oracle ACS华南区售后团队,首席技术工程师 曾供职于中国联通信息计费部、卓望数码,系统支撑部首席DBA,负责中国移动全网梦网业务和移动应用商城数据库维护。后供职于IBM,负责米其林项目和澳洲电信(Telstra)项目数据库管理。现供职于Oracle ACS华南区售后团队,首席技术工程师。多年从事第一线的数据库运维工作,有丰富项目经验、维护经验和调优经验,专注于数据库的整体运维。 编辑手记:字符集是数据库中很复杂的一个问题,通常设定后不做改变,但因生产的需要,也提供通过导入导出或命令修改的
昨天安装了个oracle19c,但在导入数据库时发现原来数据库的字符集设置错了,导致数据库文件无法正常导入并还原。今天又折腾了一半天查找如果修改oracle的字符集的操作。特此整理出来分享给大家,如果能用到的同学给点个赞!
Netty是一个高性能的网络应用程序框架,它提供了丰富的功能,包括编解码器,这些编解码器用于在网络中发送和接收数据时进行数据的编码和解码。
今天在写一个StringIO.write(int)示例时思维那么一发散就拐到了字符集的问题上,顺手搜索一发,除了极少数以外,绝大多数中文博客都解释的惨不忍睹,再鉴于被此问题在oracle的字符集体系中蹂躏过,因此在过往笔记的基础上增删了几个示例贴出来。
从12c版本12.1开始,就有了新特性——Pluggable Database,相比较之前通过schema的管理方式实现多用户管理,Pluggable Database实现了进一步的隔离,其中包含如下特点: 1.将业务用户元数据和数据库本身的元数据进行分离,减少核心数据字典的性能衰减,增加管理便捷性。 2.sga统一分配,各PDB通过各自的标识进行空间管理。 但在12.1中,PDB的字符集与root容器必须保持一致,这样无形中造成了PDB迁移或者克隆的限制性。从12.2开始,同一个cdb中的各个PDB字符集
原文发表于itpub技术丛书《Oracle数据库DBA专题技术精粹》,未经许可,严禁转载本文. 原文链接: http://www.eygle.com/special/NLS_CHARACTER_SET_01.htm Oracle全球支持(即Globalization Support)允许我们使用本地语言和格式来存储和检索数据。通过全球支持,Oracle可以支持多种语言及字符集,得以展示数据库的强大魅力。 由于不同语言及字符集的共同存储存在设置上具有一定的复杂性,字符集一度成为普遍困
本人在写一个测试demo的时候,遇到一个问题就是添加的中文数据在数据库定义的明明是varchar类型,但是显示出来还是乱码,不过还是自己粗心导致的问题。
如果你还没有在安装可以连接的 Oracle 数据库,请先下载后进行安装。请参考 Oracle 文档 来获取有关安装的指南。
Linux平台 Oracle 18c RAC安装指导: Part1:Linux平台 Oracle 18c RAC安装Part1:准备工作 Part2:Linux平台 Oracle 18c RAC安装Part2:GI配置 Part3:Linux平台 Oracle 18c RAC安装Part3:DB配置
领取专属 10元无门槛券
手把手带您无忧上云