Oracle 11g 软件显示中文乱码

2024年 4月 30日 52.3k 0

Oracle 11g 软件显示中文乱码

环境说明

Red Hat Enterprise Linux Server release 6.10 (Santiago) 系统;

Oracle 11.2.0.4.0 版本搭建备库。

现象

Oracle 提示字乱码。

oracle@hostname:/home/oracle $sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 22 15:22:33 2024

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

???:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> set lines 200 pages 200

SQL> col name for a20

SQL> col db_unique_name for a20

SQL> select name,db_unique_name,open_mode,database_role,switchover_status from v$database;

select name,db_unique_name,open_mode,database_role,switchover_status from v$database

*

? 1 ?????:

ORA-01507: ??????

问题分析

操作系统安装的中文字体。

检查了终端显示字符,设置utf8\gb18030等字符都一样中文乱码,说明与终端工具无关。

再次检查操作系统支持字符也是支持中文的,最后检查oracle客户端显示字符,NLS_LANG值未设置。

解决办法

将环境变量设置:export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"后,可以正常显示中文字体。

oracle@hostname:/home/oracle $cat .bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

export PATH

export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"

export ORACLE_BASE=/oracle/app

export ORACLE_HOME=/oracle/app/product/11.2.0.4

export ORACLE_SID=test

export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH

export TNS_ADMIN=$ORACLE_HOME/network/admin

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:/lib/usr/lib:/usr/local/lib

alias s='sqlplus / as sysdba'

PS1='$LOGNAME@'hostname':$PWD $'; export PS1

NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'; export NLS_DATE_FORMAT

ORACLE_TERM=xterm; export ORACLE_TERM

set -o vi

if [ -t 0 ]; then

stty intr ^C

fi

umask 022

oracle@hostname:/home/oracle $source .bash_profile

oracle@hostname:/home/oracle $sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on 星期五 3月 22 15:25:17 2024

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

连接到:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> exit

从 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options 断开

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论