准备
如上图所示:VMware的配置
Centos7.6 1804
nat:192.168.25.13
仅主机:192.168.50.13
Oracle包下载:
https://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html
linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
禁用防火墙和selinux
[root@node3 ~]# systemctl disable firewalld
[root@node3 ~]# systemctl stop firewalld
关闭selinux(需重启生效)
[root@node3 ~]# vim /etc/selinux/config
SELINUX=disabled
删除自带的openjdk
[root@node3 ~]# rpm -qa|grep java
java-1.8.0-openjdk-headless-1.8.0.161-2.b14.el7.x86_64
tzdata-java-2018c-1.el7.noarch
python-javapackages-3.4.1-11.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64
[root@node3 ~]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.161-2.b14.el7.x86_64
[root@node3 ~]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64
[root@node3 ~]# java -version
-bash: /usr/bin/java: No such file or directory
删除成功
创建项目目录
[root@node3 ~]# mkdir -pv /fgq/{application,data,www,base-env}
mkdir: created directory ‘/fgq’
mkdir: created directory ‘/fgq/application’
mkdir: created directory ‘/fgq/data’
mkdir: created directory ‘/fgq/www’
mkdir: created directory ‘/fgq/base-env’
配置jdk
[root@node3 ~]# rz 上传Oracle的jdk包:jdk-12.0.1_linux-x64_bin.tar.gz
[root@node3 ~]# mv jdk-12.0.1_linux-x64_bin.tar.gz /fgq/base-env/
[root@node3 ~]# cd /fgq/base-env/
[root@node3 base-env]# tar zxf jdk-12.0.1_linux-x64_bin.tar.gz
[root@node3 base-env]# ln -s jdk-12.0.1 jdk
[root@node3 base-env]# vim /etc/profile 最后面添加如下内容
export JAVA_HOME=/fgq/base-env/jdk
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
[root@node3 base-env]# source /etc/profile
[root@node3 base-env]# java -version
java version "12.0.1" 2019-04-16
Java(TM) SE Runtime Environment (build 12.0.1+12)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)
开始安装Oracle
创建运行oracle数据库的系统用户和用户组
[root@node3 ~]# groupadd oinstall
[root@node3 ~]# groupadd dba
[root@node3 ~]# useradd -g oinstall -G dba -m oracle
[root@node3 ~]# passwd oracle
Changing password for user oracle.
New password: oracle
Retype new password:
passwd: all authentication tokens updated successfully.
[root@node3 ~]# id oracle
uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba)
创建oracle数据库安装目录
[root@node3 ~]# mkdir -pv /fgq/data/{oracle,oraInventory,orapackage}
mkdir: created directory ‘/fgq/data/oracle’
mkdir: created directory ‘/fgq/data/oraInventory’
mkdir: created directory ‘/fgq/data/orapackage’
[root@node3 ~]# cd /fgq/data/
[root@node3 data]# ls
oracle oraInventory orapackage
[root@node3 data]# chown -R oracle:oinstall /fgq/data/oracle
[root@node3 data]# chown -R oracle:oinstall /fgq/data/oraInventory
[root@node3 data]# chown -R oracle:oinstall /fgq/data/orapackage
修改OS系统标识
oracle默认不支持CentOS系统安装,修改文件 /etc/RedHat-release
[root@node3 ~]# cat /proc/version
Linux version 3.10.0-862.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC) ) #1 SMP Fri Apr 20 16:44:24 UTC 2018
[root@node3 ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@node3 ~]# vim /etc/redhat-release
redhat-7
安装依赖的包
[root@node3 ~]# rz 上传epel-release-latest-7.noarch.rpm包
[root@node3 ~]# yum -y install epel-release-latest-7.noarch.rpm
[root@node3 ~]# yum repolist
... ...
base/7/x86_64 CentOS-7 - Base 10,019
*epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,221
extras/7/x86_64 CentOS-7 - Extras 409
updates/7/x86_64 CentOS-7 - Updates 1,982
repolist: 25,631
[root@node3 ~]# yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
检查
[root@node3 ~]# rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
binutils-2.27-34.base.el7.x86_64
compat-libcap1-1.10-7.el7.x86_64
compat-libstdc++-33-3.2.3-72.el7.x86_64
compat-libstdc++-33-3.2.3-72.el7.i686
gcc-4.8.5-36.el7_6.2.x86_64
gcc-c++-4.8.5-36.el7_6.2.x86_64
glibc-2.17-260.el7_6.5.x86_64
glibc-2.17-260.el7_6.5.i686
glibc-devel-2.17-260.el7_6.5.x86_64
glibc-devel-2.17-260.el7_6.5.i686
ksh-20120801-139.el7.x86_64
libaio-0.3.109-13.el7.x86_64
libaio-0.3.109-13.el7.i686
libaio-devel-0.3.109-13.el7.x86_64
libaio-devel-0.3.109-13.el7.i686
libgcc-4.8.5-36.el7_6.2.x86_64
libgcc-4.8.5-36.el7_6.2.i686
libstdc++-4.8.5-36.el7_6.2.x86_64
libstdc++-4.8.5-36.el7_6.2.i686
libstdc++-devel-4.8.5-36.el7_6.2.x86_64
libstdc++-devel-4.8.5-36.el7_6.2.i686
libXi-1.7.9-1.el7.x86_64
libXi-1.7.9-1.el7.i686
libXtst-1.2.3-1.el7.x86_64
libXtst-1.2.3-1.el7.i686
make-3.82-23.el7.x86_64
sysstat-10.1.5-17.el7.x86_64
unixODBC-2.3.1-11.el7.x86_64
unixODBC-2.3.1-11.el7.i686
unixODBC-devel-2.3.1-11.el7.x86_64
unixODBC-devel-2.3.1-11.el7.i686
版本号只能大于规定的版本,不能小于
修改内核参数
[root@node3 ~]# vim /etc/sysctl.conf
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
fs.file-max = 6815744 #设置一个进程可以打开的最大打开文件数
fs.aio-max-nr = 1048576 #限制未完成的并发请求,避免I/O系统故障
kernel.shmall = 2097152 #共享内存的总量,应不小于shmmax/page_size缺省值就是2097152
kernel.shmmax = 2147483648 #最大共享内存的段大小,不小于物理内存的一半
kernel.shmmni = 4096 #整个系统共享内存端的最大数
kernel.sem = 250 32000 100 128 #设置的信号量
net.ipv4.ip_local_port_range = 9000 65500 #可使用的IPv4端口范围
net.core.rmem_default = 262144 #默认接收缓冲区大小
net.core.rmem_max= 4194304 #接收缓冲区最大值
net.core.wmem_default= 262144 #默认的发送缓冲区大小
net.core.wmem_max= 1048576 #发送缓冲区最大值
[root@node3 ~]# sysctl -p
对oracle用户设置限制,提高软件运行性能
[root@node3 ~]# vim /etc/security/limits.conf
... ...
#@student - maxlogins 4
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
# End of file
配置用户的环境变量
[root@node3 ~]# vim /home/oracle/.bash_profile
最下面添加如下内容:
export ORACLE_BASE=/fgq/data/oracle #oracl安装目录
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 #oracle路径
export ORACLE_SID=orcl #oracle启动数据库实例名
export ORACLE_TERM=xterm #xterm窗口模式安装
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH #添加系统环境变量
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib #添加系统环境变量
export LANG=C #防止安装过程出现乱码
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK #设置Oracle客户端字符集,必须与Oracle客户端安装时设置的字符集保持一致。有的是设为AL32UTF8,根据需要自行设定。
[root@node3 ~]# source /home/oracle/.bash_profile
解压Oracle数据库包
[root@node3 ~]# cd /fgq/data/orapackage/
[root@node3 orapackage]# rz 上传前面下载的Oracle数据库包:
linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
[root@node3 orapackage]# unzip linux.x64_11gR2_database_1of2.zip
[root@node3 orapackage]# unzip -q linux.x64_11gR2_database_2of2.zip
[root@node3 orapackage]# ls
database linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
出现一个database目录,并对此目录授权如下:
[root@node3 orapackage]# chown -R oracle:oinstall /fgq/data/orapackage/database/
重启reboot
oracle用户登录系统,进行配置
桌面命令行操作:
查看jdk配置路径
[oracle@node3 ~]$ vim + /etc/profile
export JAVA_HOME=/fgq/base-env/jdk
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
[oracle@node3 ~]$ cd /fgq/data/orapackage/database/
[oracle@node3 database]# ./runInstaller -jreLoc /fgq/base-env/jdk
去掉对勾,点击next,按回车键,此时提示没有写email,点击yes即可
直接回车
直接回车
查看路径是否一致,一致就不用修改(会自动识别),如果不是,就需要修改;
同时修改 global database name 为 orcl,密码为orcl,简便操作而已,生产上,需要严格点,然后直接next,回车;
此时会提示弱密码,直接点击continue,回车,跳至下一步。
路径是否一致,一致则不用修改,修改group name名字为dba,点击next,回车
这几个系统报错是因为现有的包的版本比检测要高,点击Ignore All,忽略即可,然后next,回车
可以点击“save response file”,或者直接“finish”结束也可以;
此处是直接finish,跳至下一步即可
开始安装
68%时,出现报错,此时需要解决,解决方式如下命令行内容
解决报错:
[root@node3 ~]# vim /fgq/data/oracle/product/11.2.0/db_1/ctx/lib/ins_ctx.mk
11行的位置
ctxhx: $(CTXHXOBJ)
$(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK)
改为:
ctxhx: $(CTXHXOBJ)
-static $(LINK_CTXHX) $(CTXHXOBJ) $(INSO_LINK) /usr/lib64/libc.a
保存后,点击Retry继续安装
此时又出现报错,但是错误不一样了,证明上一个错误已经解决,继续解决报错
[root@node3 ~]# vim /fgq/data/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk
190行的位置:
$(SYSMANBIN)emdctl:
$(MK_EMAGENT_NMECTL)
改为:
$(SYSMANBIN)emdctl:
$(MK_EMAGENT_NMECTL) -lnnz11
注意后面的 -lnnz11 :前面的是1个字母“l”,后面的是两个数字“11”
保存后,点击Retry继续安装
点击OK
此时,需要运行图中显示的两个脚本,先不要点击OK
/fgq/data/oraInventory/orainstRoot.sh
/fgq/data/oracle/product/11.2.0/db_1/root.sh
[root@node3 ~]# sh /fgq/data/oraInventory/orainstRoot.sh
Changing permissions of /fgq/data/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /fgq/data/oraInventory to dba.
The execution of the script is complete.
[root@node3 ~]# sh /fgq/data/oracle/product/11.2.0/db_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /fgq/data/oracle/product/11.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]: /usr/local/bin
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
/fgq/data/oracle/product/11.2.0/db_1/rdbms/install/rootadd_rdbms.sh: line 80: [: 6815744#设置一个进程可以打开的最大打开文件数: integer expression expected
/fgq/data/oracle/product/11.2.0/db_1/rdbms/install/rootadd_rdbms.sh: line 91: [: 6815744#设置一个进程可以打开的最大打开文件数: integer expression expected
点击OK,安装完成,关闭界面
创建Oracle监听
图形界面命令行操作:
[oracle@node3 ~]$ netca
由于默认的LISTENER已经存在,所以我们只能改名为LISTENERfgq
选择监听器协议,默认TCP,直接点击Next即可
配置监听端口,默认1521,但是已经被占用,所以选择另外一个端口1522,点击Next即可
选择默认的LISTENER
点击Finish结束配置程序,此时会退出安装界面,并且命令行界面会提示配置的信息并将新的监听器启动;
注意此处的配置是成功了,但显示Listener start failed.虽然failed,此时命令行执行ss -ntl,仍可以看到端口1521
[oracle@node3 ~]$ netca
Oracle Net Services Configuration:
Configuring Listener:LISTENERFGQ
Listener configuration complete.
Configuring Listener:LISTENERFGQ
Listener configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/fgq/data/oracle/product/11.2.0/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener start failed.
Oracle Net Services configuration successful. The exit code is 0
[oracle@node3 ~]$ ss -ntl|grep 1521
LISTEN 0 128 127.0.0.1:1521 *:*
监听器的启动和停止
lsnrctl start LISTENER #启动名为LISTENER的监听器
lsnrctl stop LISTENER #关闭名为LISTENER的监听器
查看监听器运行状态
lsnrctl status LISTENER #查看名为LISTENER的监听器的运行状态
需要注意的是,命令lsnrctl只能oracle用户使用,root用户没有这个命令
[oracle@node3 ~]$ lsnrctl status LISTENER
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-JUN-2019 05:40:22
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 04-JUN-2019 04:28:04
Uptime 0 days 1 hr. 12 min. 17 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /fgq/data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /fgq/data/oracle/diag/tnslsnr/node3/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
安装oracle数据库实例
图形界面命令行操作
[oracle@node3 ~]$ dbca
默认为普通的事务数据库,点击Next
填写数据的全局名称和数据库id,注意此时提示orcl的SID已经存在,需要解决这个问题是很简单的:
编辑文件“/etc/oratab”,注释掉里面的内容即可
为什么会出现这个问题,其实是安装Oracle数据库时,有一个orcl了,把当时安装时的orcl名字改了也可以。
next之后,会提示弱密码,直接点击yes继续即可
设置数据恢复路径,默认,点击next
设置创建实例方案表空间,可以不创建,点击Next
设置数据库内存,作为服务器数据库设置为70%,切换到连接数设置
设置连接数,默认为150,根据需要设置,此处设置为6000
设置字符集,选择与安装Oracle时的设置相同的字符集,ZHS16GBK。如果Oracle用的字符集为AL32UTF8,就选择AL32UTF8。当然,如果这里字符集选错了,安装好了也是可以修改的,只是稍有麻烦。
设置连接类型,共享内存或者独享内存,也可以默认,点击Next
默认点击next即可
选择Generate Database Creation Scripts(生成数据库创建脚本),可以为手工建库脚本提供参考
点击Finish,完成创建
注意出现了很多错误,直接ignore即可,最后返回16图继续进行操作安装
创建数据库,创建完成后点击Exist退出
创建表空间和用户授权
连接数据库
[oracle@node3 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jun 4 07:17:51 2019
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
创建数据表空间
SQL> CREATE TABLESPACE ALS LOGGING DATAFILE '/fgq/data/oracle/oradata/orcl/ALS.DBF' SIZE 50M AUTOEXTEND ON NEXT 50M MAXSIZE 20480M EXTENT MANAGEMENT LOCAL;
Tablespace created.
创建用户并指定表空间
SQL> CREATE USER sa IDENTIFIED BY fgq111 DEFAULT TABLESPACE ALS;
User created.
给用户授予权限
SQL> grant connect,resource,dba to sa;
Grant succeeded.
删除表空间
SQL> drop tablespace ALS including contents and datafiles cascade constraints;
Tablespace dropped.
SQL>
设置数据库自启动
修改/etc/oratab文件
[oracle@node3 ~]$ vim /etc/oratab
找到:orcl:/fgq/data/oracle/product/11.2.0/db_1:N
修改为:orcl:/fgq/data/oracle/product/11.2.0/db_1:Y
把lsnrctl start和dbstart添加到rc.local文件中:
root权限执行:
[root@node3 ~]# vim /etc/rc.d/rc.local
最下面添加如下内容:
su - oracle -lc "/fgq/data/oracle/product/11.2.0/db_1/bin/lsnrctl start"
su - oracle -lc "/fgq/data/oracle/product/11.2.0/db_1/bin/dbstart"
# -l 登录;-c 执行命令;
说明:
第一行为开机启动数据库监听服务,第二行为开机启动数据库。(路径跟安装路径相关)。
注意:CentOs7中/etc/rc.d/rc.local不会开机执行,需添加执行权限。
查看/etc/rc.d/rc.local的权限
[root@node3 ~]# ll /etc/rc.d/rc.local
-rw-r--r-- 1 root root 645 Jun 4 07:47 /etc/rc.d/rc.local
[root@node3 ~]# chmod +x /etc/rc.d/rc.local
重启电脑后查看是否自启动成功
查看监听是否自启动成功
[oracle@node3 ~]$ lsnrctl status LISTENER
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-JUN-2019 07:54:18
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 04-JUN-2019 07:53:34
Uptime 0 days 0 hr. 0 min. 44 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /fgq/data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /fgq/data/oracle/diag/tnslsnr/node3/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
查看Oracle服务状态
[oracle@node3 ~]$ ps -ef |grep oracle
oracle的启动或关闭管理
[oracle@node3 ~]$ dbstart #启动
[oracle@node3 ~]$ dbshut #停止
数据库字符集修改
注意事项:修改字符集前先将数据库进行备份
此处演示将ZHS16GBK字符集修改为AL32UTF8
修改server端字符集
登录sqlpus查看字符集设置
[root@node3 ~]# su - oracle
[oracle@node3 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jun 4 08:03:20 2019
Copyright (c) 1982, 2009, Oracle. All rights reserved.
#连接成功
SQL> conn /as sysdba
Connected.
#server端字符集查询
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.ZHS16GBK
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 973080688 bytes
Database Buffers 620756992 bytes
Redo Buffers 7360512 bytes
Database mounted.
SQL> alter system enable restricted session;
SQL> alter system set job_queue_processes=0;
SQL> alter system set aq_tm_processes=0;
SQL> alter database open;
SQL> alter database character set internal_use AL32UTF8;
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2213776 bytes
Variable Size 973080688 bytes
Database Buffers 620756992 bytes
Redo Buffers 7360512 bytes
Database mounted.
Database opened.
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
--------------------------------------------------------------------------------
AMERICAN_AMERICA.AL32UTF8
SQL>
修改client端字符集
查看系统环境变量设置的字符集(client端字符集)
[oracle@node3 ~]$ cat /home/oracle/.bash_profile
... ...
export ORACLE_BASE=/fgq/data/oracle #oracl安装目录
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 #oracle路径
export ORACLE_SID=orcl #oracle启动数据库实例名
export ORACLE_TERM=xterm #xterm窗口模式安装
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH #添加系统环境变量
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib #添加系统环境变量
export LANG=C #防止安装过程出现乱码
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK #设置Oracle客户端字符集,必须与Oracle客户端安装时设置的字符集保持一致。有的是设为AL32UTF8,根据需要自行设定。
[oracle@node3 ~]$ vim /home/oracle/.bash_profile
将ZHS16GBK改为AL32UTF8
找到:export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
改为:export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
[oracle@node3 ~]$ source /home/oracle/.bash_profile