linux下oracle报错为问号
1、在 /etc/profile 添加:
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
SIMPLIFIED CHINESE_CHINA需要用双引号,要不然中间就出现空格,解析就会出问题了
再执行:
source /etc/profile
2、linux 添加环境变量的几种方法
(1)直接在终端用命令添加,这个环境变量设置只在该终端窗口中有效,退出窗口就会失效;
export NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
(2)在.bash_profile文件中添加,/etc/profile对所有用户生效,~/.bash_profile只对当前用户生效。用命令vi .bash_profile添加也是用export NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
(3)在/etc/profile中添加,对所有的用户有效;修改完后需要用source命令使其生效;
vi /etc/profile
(4)使用 shell 脚本添加环境变量
if grep -Fxq "export NLS_LANG=\"SIMPLIFIED CHINESE\"_CHINA.ZHS16GBK" /etc/profile
then
echo " export NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK found"
else
echo " add NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK to file"
sed -i '$a export NLS_LANG=\"SIMPLIFIED CHINESE\"_CHINA.ZHS16GBK' /etc/profile
source /etc/profile
fi
3、profile 文件内容如下
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
esac
}
if [ -x /usr/bin/id ]; then
if [ -z "$EUID" ]; then
# ksh workaround
EUID=`/usr/bin/id -u`
UID=`/usr/bin/id -ru`
fi
USER="`/usr/bin/id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi
# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
fi
HOSTNAME=`/usr/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
export HISTCONTROL=ignoreboth
else
export HISTCONTROL=ignoredups
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
# !!!!!!!!!!!!!!在这里添加!!!!!!!!!!!!!!
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.ZHS16GBK"
# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
umask 002
else
umask 022
fi
for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null
fi
fi
done
unset i
unset -f pathmunge
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi