分类归档 Database

CentOS7下使用Oracle 11g sqlplus信息显示乱码

CentOS7下使用Oracle 11g sqlplus信息显示乱码

现象
[[email protected] ~]$ sqlplus /nologin

SQL*Plus: Release 11.2.0.1.0 Production on ������ 1�� 20 23:43:44 2021

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

SQL*Plus: Release 11.2.0.1.0 Production

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

ʹ�� SQL*Plus ִ�� SQL, PL/SQL �� SQL*Plus ���䡣

�÷� 1: sqlplus -H | -V

    -H             ��ʾ SQL*Plus �汾��
                   �÷�������
    -V             ��ʾ SQL*Plus �汾��

�÷� 2: sqlplus [ [<option>] [{logon | /nolog}] [<start>] ]

  <option> Ϊ: [-C <version>] [-L] [-M "<options>"] [-R <level>] [-S]

    -C <version>   ����Ӱ���������ļ���������Ϊ
                   <version> ָ���İ汾���ð汾����
                   "x.y[.z]" ��ʽ������, -C 10.2.0
    -L             ֻ���Ե�¼һ��, ������
                   �ڳ���ʱ�ٴ���ʾ��
    -M "<options>" �����������Զ� HTML ���ǡ�ѡ��
                   �ĸ�ʽΪ:
                   HTML [ON|OFF] [HEAD text] [BODY text] [TABLE text]
                   [ENTMAP {ON|OFF}] [SPOOL {ON|OFF}] [PRE[FORMAT] {ON|OFF}]
    -R <level>     ��������ģʽ, �Խ������ļ�ϵͳ������
                    SQL*Plus �����������
                   �� 1, 2 �� 3���������Ƽ���Ϊ -R 3, �ü���
                   �������ļ�ϵͳ������
                   �����û����
    -S             ��������ʾģʽ, ��ģʽ����
                   ������ SQL*Plus ����, ��ʾ�ͻ���
                   ����ʾ��
解决
# 查看 Oracle 环境变量
[[email protected] ~]$ echo $NLS_LANG
SIMPLIFIED CHINESE_CHINA.ZHS16GBK

# 修改环境变量为 SIMPLIFIED CHINESE_CHINA.AL32UTF8 [这种修改方式,只在当前 bash 中生效]
[[email protected] ~]$ export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"

# 检查是否还乱码 (如下图所示)
[[email protected] ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on 星期三 1月 20 23:21:51 2021

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

SQL> exit
[[email protected] ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期三 1月 20 23:22:05 2021

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

连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
扩展阅读
  • NLS_LANG 是一个环境变量,用于定义语言,地域以及字符集属性。对于非英语的字符集,NLS_LANG 的设置就非常重要。

  • NLS(National Language Support) 当我们设定一种 NLS 的时候实际上我们是为 Oracle 在存放数据时指定了他的语种所特有的一些表达形式,比如我们选择 Chinese, 那么它的中文字符如何存放,按什么规则排序,货币如何表示,日期格式也就被设定了。

  • NLS_LANG 参数由以下部分组成

    NLS_LANG=<Language>_<Territory>.<Clients Characterset>
    • Language

      • Oracle(错误)信息的语言
      • 日和月份的名称
        注意:NLS_LANGUAGE与插入和查询的数据的语言无关。
    • Territory

      • 货币和数字格式
      • 计算星期和天数的范围和惯例
    • Clients Characterset(客户端字符集)

      • 定义Oracle客户端,客户应用使用的编码
      • 或者它要符合您 Microsoft Windows 代码页( GUI 工具的 ACP, 命令提示符的 CHCP 值)
      • 或者为 Unicode WIN32 应用设置为 UTF8/AL32UTF8

消除Redis启动时的三个警告

现象

问题分析

第一个警告:
  • WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128
第二个警告:
  • WARNING: overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
第三个警告:
  • WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

解决办法

# 1.输入以下命令
[[email protected] ~]# echo "net.core.somaxconn = 511" >> /etc/sysctl.conf
[[email protected] ~]# echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf
[[email protected] ~]# sysctl -p
[[email protected] ~]# echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local
[[email protected] ~]# source /etc/rc.local
# 2.启动 Redis 服务