Deploy Oracle 11g under Linux (detailed documentation)

1. Environmental preparation

If you need to install the software or some problems encountered in the installation, please private message to solve!

1.linux.x64_11gR2_database_1of2.zip

linux.x64_11gR2_database_2of2.zip ( download link )

2. Xstart in Xmanager may also be used

2. Preparation before installation

1. Create system users and user groups for the oracle database

admin \@localhost \~]\$ su root
Password:

[root\@localhost admin]\# groupadd oinstall   \#创建用户组oinstall

[root\@localhost admin]\# groupadd dba      \#创建用户组dba

[root\@localhost admin]\# useradd -g oinstall -G dba -m oracle  
   \#创建oracle用户,并加入到oinstall和dba用户组\
   
[root\@localhost admin]\# passwd oracle     \#设置用户oracle的登陆密码
Changing password for user oracle.
New password: BAD PASSWORD: The password is shorter than 8 characters Retype new
password:                                    \#确认密码
passwd: all authentication tokens updated successfully.

[root\@localhost admin]\# id oracle           \#查看新建的oracle用户
uid=1001(oracle) gid=1002(dba) groups=1002(dba)

*: -g: specify the group to which the user belongs -G: specify the additional group to which the user belongs -m: automatically create the user's login directory

2. Create the oracle database installation directory

[root\@localhost admin]\# mkdir -p /data/oracle         \#安装目录

[root\@localhost admin]\# mkdir -p /data/oraInventory      \#配置文件目录

[root\@localhost admin]\# mkdir -p /data/orapackage     \#软件包解压目录

[root\@localhost admin]\# cd /usr

[root\@localhost usr]\# ls 
orapackage oracle oraInventory ...
[root\@localhost usr]\# chown -R oracle:oinstall /data/oracle 
  \#设置目录所有者为oinstall用户组的oracle用户
[root\@localhost usr]\# chown -R oracle:oinstall /data/oraInventory

[root\@localhost usr]\# chown -R oracle:oinstall /data/orapackage

3. Modify the OS system logo

Oracle does not support CentOS system installation by default, modify the content of the file /etc/ RedHat -release
to RedHat-7

[root\@localhost admin]\#vi /etc/redhat-release   \#修改文件名称
redhat-7

4. Install the software packages required by the oracle database

You can refer to: https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#BABCFJFG
install the required installation package

[root\@localhost admin]\# 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

Check if all 31 packages are installed

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

5. Turn off the firewall

CentOS 7 uses firewall as the firewall by default

[root\@localhost admin]\# systemctl status firewalld.service         \#查看防火墙状态
● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded
(/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2016-04-07 18:54:29 PDT; 2h 20min ago

[root\@localhost admin]\# systemctl stop firewalld.service          \#关闭防火墙

[root\@localhost admin]\# systemctl status firewalld.service       \#再次查看防火墙状态 
● firewalld.service - firewalld -dynamic firewall daemon Loaded: loaded
(/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Thu 2016-04-07 21:15:34 PDT; 9s ago

[root\@localhost admin]\# systemctl disable firewalld.service        \#关闭开机自动启动

6. Close selinux (restart to take effect)

[root\@localhost /]\# vi /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded. SELINUX=disabled    \#此处修改为disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are
protected.
# mls - Multi Level Security protection. SELINUXTYPE=targeted

7. Modify the kernel parameters

[root\@localhost admin]\# vi /etc/sysctl.conf

# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an
/etc/sysctl.d/\<name\>.conf file
# For more information, see sysctl.conf(5) and sysctl.d(5).
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\@localhost admin]\# sysctl –p

8. Set user restrictions to improve software performance

[root\@localhost admin]\# vi /etc/security/limits.conf

#@student - maxlogins 4
.................
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536  
oracle soft stack 10240  
oracle hard stack 32768

# End of file

10. Configure the user's environment variables

[root\@localhost /]\# vi /home/oracle/.bash_profile (看仔细,很重要)
...........

export PATH

export ORACLE_BASE=/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客户端字符集,

It must be consistent with the character set set during the Oracle client installation. Some are set to AL32UTF8, set according to your needs.

The method to obtain the installation package file can be through the ftp server or download to the specified directory through wget. The decompression method is as follows

Upload the 1gR2_database_1of2.ziplinux.x64_11gR2_database_2of2.zip installation package in the oracle user and upload it to /usr/local/src

[oracle\@localhost /]\$ cd /usr/local/src  \#进入/usr/local/src目录

[oracle\@localhost src]\$ ls

linux.x64_11gR2_database_1of2.zip  linux.x64_11gR2_database_2of2.zip

[oracle\@localhost src]\$ unzip linux.x64_11gR2_database_1of2.zip –d
/data/database/                      \#解压到data目录下

(省略...)

[oracle\@localhost src]\$ unzip linux.x64_11gR2_database_2of2.zip -d
/data/database/              \#解压到data目录下

(省略...)

使配置生效

[root\@localhost admin]\# source /home/oracle/.bash_profile

Three, oracle installation

[oracle\@localhost \~]\$ cd /data/database/

[oracle\@localhost database]\$ ls

doc install response rpm runInstaller sshsetup stage welcome.html
[oracle\@localhost database]\$ ./runInstaller

Installation issues:

  1. Install the Oracle database software, it prompts "Check Monitor" failed

Check the temporary space: it must be greater than 120 MB. Actual 36,939 MB passed

Check the swap space: it must be greater than 150 MB. Actually 8047 MB ​​passed

Check the monitor: The monitor configuration must display at least 256 colors

\>\>\> 无法使用命令 /usr/bin/xdpyinfo 自动检查显示器颜色。请检查是否设置了

DISPLAY variable. Failed <<<<

Solution: According to the error message, the first thing that comes to mind is to configure the DISPLAY variable (generally, it can be solved by configuring it)

[root\@db130 \~]\# yum install -y xdpyinfo

[root\@db130 \~]\# xhost +

access control disabled, clients can connect from any host

[root\@db130 \~]\# su - oracle

[oracle\@db130 \~]\$ export DISPLAY=:0.0

[oracle\@db130 \~]\$ cd /data/database/database/

[oracle\@db130 database]\$ ./runInstaller

Starting Oracle Universal Installer...

  1. The pop-up interface in the process is generally a white vertical line, and the next button cannot be clicked on the entire interface

Solution : It is recommended to use Xstart in the Xmanager tool .

Keep the CentOS network connected, log in as the root user, and execute the command: yum install -y xterm

After the installation is complete, start Xstart, enter the host IP and log in as the oracle user ,

Enter the command: /usr/bin/xterm -ls -display $DISPLAY

Enter the installation interface

(1) As shown in the figure below, uncheck "I wish receive security via
My Oracle Support", click "next", and select "yes" to continue.

(2) Select "Create and configure a database" and click "next"

The first item is enterprise-level applications

The second item only installs the database

The third item is to upgrade the existing database

(3) Select "DesktopClass" and click "next"

The first item is the desktop category: generally applicable to desktops and notebooks, including minimum database and minimum configuration requirements, and only basic options during installation.

The second item is the service category: applicable to servers, for example, it will provide you with data centers and applications to support enterprise-level applications.

4) If you are going to follow the document before installation, just fill in passwrod here (ignore the warning), click "next"

Default selection

(5) The subsequent configuration generally selects the default. When the flow goes to this interface, select the Character sets option,

Continue to "next" after modifying the character set to UTF-8

(6) After that, the configuration can continue to follow the default. When the flow goes to this interface, you can set passwords for all users. For the oracle I set, click "next

(6) Flow to this page. If the dependency package was installed before, there will be a package prompt failure in the following figure. Check the package one by one. If it is missed in the preparation stage, install it here. Some systems report errors because of existing packages. The version is higher than the detection, just ignore it at the end. (Click Check_Again
to check several times and operate according to the error prompt)

(7) When the installation progress reaches 68%, there will be an error as shown in the figure above (open the file according to the error)

Find the file in the installation directory: /usr/oracle/product/11.2.0/db_1/ctx/lib/ins_ctx.mk

[admin \@localhost \~]\$ su root
Password:
[root\@localhost admin]\# vim /usr/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

After saving (:wq), click Retry to continue installation

If you still report an error,
open the file in this installation directory: /usr/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk

修改如下内容(190行左右)
\$(MK_EMAGENT_NMECTL)
修改为
\$(MK_EMAGENT_NMECTL) -lnnz11

Open the control terminal and execute the two scripts shown with root privileges

[root\@localhost /]\# sh /usr/oraInventory/orainstRoot.sh
[root\@localhost /]\# sh /usr/oracle/product/11.2.0/db_1/root.sh
此处输入红色部分的路径回车:
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...

4. Create an Oracle monitor

[oracle\@localhost \~]\$ netca

Select the listener protocol, default TCP, click Next to
configure the listening port, default 1521, click Next to
complete the configuration, prompt whether to add another listener, select No, click Next,
click Finish to end the configuration program, the command line interface will prompt the configuration information and Start the new listener

Start and stop of the listener

lsnrctl start LISTENER #Start the listener named LISTENER
lsnrctl stop LISTENER #Close the listener named LISTENER

View the running status of the listener

lsnrctl status LISTENER #View the running status of the listener named LISTENER

5. Install the oracle database instance

[oracle\@localhost \~]\$ dbca

1), clearly specify the mount sizes parameter of /dev/shm in /etc/fstab**

View the size of /dev/shm

[oracle\@localhost \~]\$ df –h /dev/shm

Filesystem Size Used Avail Use% Mounted on

tmpfs 1.9G 29M 1.8G 2% /dev/shm

It can be seen that the size of /dev/shm is 1.9G, and when it is set to 70%, the required space is 2582M, which has exceeded its maximum space. /dev/shm defaults to half the size of the physical memory. I set it to 3G as needed, and execute the following command with root privileges:

[root\@localhost oracle]\# vi /etc/fstab

tmpfs /dev/shm tmpfs defaults 0 0

修改为

tmpfs /dev/shm tmpfs defaults,size=3G 0 0

If not, add it directly, save and exit (:wq)

2), remount /dev/shm

[root\@localhost oracle]\# mount -o remount /dev/shm

[root\@localhost oracle]\# df –h /dev/shm

Filesystem Size Used Avail Use% Mounted on

tmpfs 3.0G 25M 3.0G 1% /dev/shm

This method is to permanently change
the space size of /dev/shm . If you want to change it temporarily (restart invalid), execute the following command:

[oracle\@localhost \~]\$ sudo mount -o size=3G -o remount /dev/shm

Set the character set, select the same character set as the one set when Oracle is installed, ZHS16GBK. If the character set used by Oracle is AL32UTF8, select AL32UTF8. Of course, if the wrong character set is selected here, it can be modified after installation, but it is a little troublesome.

Set the connection type, shared memory or exclusive memory, or default, click Next

Select Generate Database Creation
Scripts to provide a reference for manual library creation scripts

Click Finish to complete the creation

Start monitoring: lsnrctl start #The monitoring must be started. If the firewall has not been turned off before, you also need to turn off the firewall.

Input: sqlplus /nolog

Input: conn sys/sys@orcl as sysdba

Among them, orcl is the instance name, and sys is its password. If the "Connected." shown in the figure below appears, the connection is successful, indicating that the database is successfully established (here it is used on the CentOS terminal).

Input: sqlplus scott/[email protected]:1521/orcl, press Enter (query ip, use ifconfig
command)

Query the current user: show user;

There are several tables under the query user: select * from tab;

Query table field: desc emp; #emp is the table name

Query table data: select * from emp;

Exit SQL command mode exit;

6, create table space and user authorization

1), connect to the database

[oracle\@localhost \~]\$ sqlplus /nolog

SQL\*Plus: Release 11.2.0.1.0 Production on Fri Jan 19 10:23:13 2018

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

SQL\> conn / as sysdba

Connected.

SQL\>

2), create a data table space

SQL\> CREATE TABLESPACE ALS LOGGING DATAFILE '/usr/oracle/oradata/orcl/ALS.DBF'
SIZE 50M AUTOEXTEND ON NEXT 50M MAXSIZE 20480M EXTENT MANAGEMENT LOCAL;

Description:

CREATE TABLESPACE tablespace name LOGGING DATAFILE'Storage path' SIZE 50M AUTOEXTEND ON
NEXT 50M MAXSIZE 20480M EXTENT MANAGEMENT LOCAL;

3), create a user and specify the table space

SQL\> CREATE USER sa IDENTIFIED BY kcsm111 DEFAULT TABLESPACE ALS;

Description:

CREATE USER username IDENTIFIED BY password DEFAULT TABLESPACE tablespace name;

4) Grant permissions to users

SQL\>grant connect,resource,dba to sa;

Description:

grant connect, resource, dba to username;

5), delete the table space

SQL\> drop tablespace ALS including contents and datafiles cascade constraints;

Description:

drop tablespace 表空间名 including contents and datafiles cascade constraints;

Including contents
deletes the contents of the table space. If there are contents in the table space before the table space is deleted, and this parameter is not added, the table space cannot be deleted.

including datafiles delete data files in the table space

Cascade constraints also delete foreign key references to tables in the table space

So far all the installation is complete

Fourth, set the database to start automatically
Method 1:
1. After installing the Oracle database: execute dbstart and dbshut

[oracle\@localhost \~]\$ dbstart

ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener

Usage: /usr/oracle/product/11.2.0/db_1/bin/dbstart ORACLE_HOME

Cause of error: There is a problem with the setting of ORACLE_HOME_LISTNER in the dbstart and dbshut script files

[oracle\@localhost \~]\$ vim \$ORACLE_HOME/bin/dbstart

[oracle\@localhost \~]\$ vim \$ORACLE_HOME/bin/dbshut

分别打开两个文件修改(50行左右)

ORACLE_HOME_LISTNER=\$1

修改为:

ORACLE_HOME_LISTNER=\$ORACLE_HOME

Save and exit after modification, the problem is solved

2. Automatically start Oracle monitoring and instance when Linux starts

第一步:修改/etc/oratab文件

[oracle\@localhost \~]\$ vim /etc/oratab

找到: orcl:/usr/oracle/product/11.2.0/db_1:N

修改为: orcl:/usr/oracle/product/11.2.0/db_1:Y

(This path is related to the installation path, $ORACLE_SID:$ORACLE_HOME:<N|Y>)

Step 2: Add lsnrctl start and dbstart to the rc.local file:

Root execution

[root\@localhost oracle]\# vim /etc/rc.d/rc.local

添加:

su - oracle -lc "/usr/oracle/product/11.2.0/db_1/bin/lsnrctl start"

su - oracle -lc "/usr/oracle/product/11.2.0/db_1/bin/dbstart"

Description:

The first line starts the database monitoring service at boot, and the second line starts the database at boot. (The path is related to the installation path).

Note: In CentOs7, /etc/rc.d/rc.local will not be executed on boot, and execution permissions need to be added.

View the permissions of /etc/rc.d/rc.local

[root\@localhost oracle]\# ll /etc/rc.d/rc.local

添加执行权限

[root\@localhost oracle]\# chmod +x /etc/rc.d/rc.local

3. Check whether the auto-start is successful after restarting the computer

Check whether the monitor has started successfully

[oracle\@localhost \~]\$ lsnrctl status LISTENER

查看Oracle服务状态

[oracle\@localhost \~]\$ ps –ef \| grep oracle

4. Oracle startup or shutdown management

[root\@localhost oracle]\# dbstart    \#启动

[root\@localhost oracle]\# dbshut

Method Two:

1. Modify the /etc/oratab file

Root execution

[root\@localhost oracle]\# vim /etc/oratab

找到: orcl:/usr/oracle/product/11.2.0/db_1:N

修改为: orcl:/usr/oracle/product/11.2.0/db_1:Y

(This path is related to the installation path, $ORACLE_SID:$ORACLE_HOME:<N|Y>)

2. Create a new Oracle service self-start script

[root\@localhost oracle]\# vim /etc/init.d/oracle

将以下脚本复制到文件中,保存退出(:wq)

\#!/bin/sh

\# chkconfig: 2345 61 61

\# description: Oracle 11g R2 AutoRun Servimces

\# /etc/init.d/oracle

\#

\# Run-level Startup script for the Oracle Instance, Listener, and

\# Web Interface

export ORACLE_BASE=/usr/oracle    \#oracle安装位置

export ORACLE_HOME=\$ORACLE_BASE/product/11.2.0/db_1   \#Oracle安装路径

export ORACLE_SID=orcl

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

ORA_OWNR="oracle"
\# if the executables do not exist -- display error
if [ ! -f \$ORACLE_HOME/bin/dbstart -o ! -d \$ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
\# depending on parameter -- startup, shutdown, restart
\# of the instance and listener or usage display
case "\$1" in
start)
\# Oracle listener and instance startup
su \$ORA_OWNR -lc \$ORACLE_HOME/bin/dbstart
echo "Oracle Start Succesful!OK."
;;
stop)

\# Oracle listener and instance shutdown
su \$ORA_OWNR -lc \$ORACLE_HOME/bin/dbshut
echo "Oracle Stop Succesful!OK."
;;
reload\|restart)
\$0 stop
\$0 start
;;
\*)
echo \$"Usage: \`basename \$0\` {start\|stop\|reload\|reload}"
exit 1
esac
exit 0

3. Check whether the script can be executed

[root\@localhost oracle]\# /etc/init.d/oracle start   \#启动oracle脚本

[root\@localhost oracle]\# /etc/init.d/oracle stop    \#关闭oracle脚本

[root\@localhost oracle]\# /etc/init.d/oracle restart  \#重启oracle脚本

4. Add execution permissions and establish links

Change the execution permissions of the oracle script

[root\@localhost oracle]\# chmod a+x /etc/init.d/oracle

Build link

Add the startup script to the system service and set up auto-start

[root\@localhost oracle]\# chkconfig --add oracle

Modify the service run level (although it is written in the script, but set it again), you can set the run level of the oracle script by yourself

[root\@localhost oracle]\# chkconfig --level 2345 oracle on

Description: Set the oracle script to be in the on (open) state when the run level is 2, 3, 4, and 5, and off to close

View oracle automatic startup settings

[root\@localhost oracle]\# chkconfig –list oracle

Oracle 0:off 1:off 2:on 3:on 4:on 5:on 6:off

*等级0表示:表示关机
等级1表示:单用户模式
等级2表示:无网络连接的多用户命令行模式
等级3表示:有网络连接的多用户命令行模式
等级4表示:不可用
等级5表示:带图形界面的多用户模式
等级6表示:重新启动*

Manually create a symbolic link file (the execution effect
is the same as the execution of chkconfig --add oracle, as a knowledge note record, you can not execute it)

[root\@localhost oracle]\# ln –s /etc/rc.d/init.d/oracle /etc/rc0.d/K61oracle

[root\@localhost oracle]\# ln –s /etc/rc.d/init.d/oracle /etc/rc1.d/K61oracle

[root\@localhost oracle]\# ln –s /etc/rc.d/init.d/oracle /etc/rc2.d/S61oracle

[root\@localhost oracle]\# ln –s /etc/rc.d/init.d/oracle /etc/rc3.d/S61oracle

[root\@localhost oracle]\# ln –s /etc/rc.d/init.d/oracle /etc/rc4.d/S61oracle

[root\@localhost oracle]\# ln –s /etc/rc.d/init.d/oracle /etc/rc5.d/S61oracle

[root\@localhost oracle]\# ln –s /etc/rc.d/init.d/oracle /etc/rc6.d/K61oracle

5. Oracle startup or shutdown management

[root\@localhost oracle]\# service oracle start    ##//启动

[root\@localhost oracle]\# service oracle stop     ##//停止

[root\@localhost oracle]\# service oracle restart   ##//重启

Five, database character set modification

Note: Back up the database before modifying the character set

Here is a demonstration to modify the ZHS16GBK character set to AL32UTF8

1. Modify the server character set

Log in to sqlpus to view the character set settings

[oracle\@localhost \~]\$ sqlplus /nolog

SQL\*Plus: Release 11.2.0.1.0 Production on Wed Jan 24 13:55:51 2018

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

SQL\> conn /as sysdba

Connected to an idle instance.

The database is not started, start the database first. It is best to set the database to not start up

SQL\> startup

SQL\> conn /as sysdba

Connected. \#连接成功

SQL\> select userenv('language') from dual; \#server端字符集查询

USERENV('LANGUAGE')

\----------------------------------------------------

AMERICAN_AMERICA.ZHS16GBK

Execute the following commands in sequence

SQL\>SHUTDOWN IMMEDIATE;

SQL\>STARTUP MOUNT;

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;

SQL\>STARTUP;

SQL\> select userenv('language') from dual;

USERENV('LANGUAGE')

AMERICAN_AMERICA.AL32UTF8

SQL\>

2. Modify the client character set

View the character set set by the system environment variable (client-side character set)


[oracle\@localhost \~]\$ cat /home/oracle/.bash_profile

...

PATH=\$PATH:\$HOME/.local/bin:\$HOME/bin

export PATH

export ORACLE_BASE=/usr/oracle

export ORACLE_HOME=\$ORACLE_BASE/product/**11.2**.**0**/db_1

export ORACLE_SID=orcl

export ORACLE_TERM=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  \#客户端字符集

[外链图片转存中...(img-iD0JQrjM-1576131393379)]

进入编辑界面,将ZHS16GBK改为AL32UTF8,保存退出

[oracle\@localhost \~]\$ vim /home/oracle/.bash_profile

那么使配置生效

[oracle\@localhost \~]\$ source /home/oracle/.bash_profile

If you cannot log in with the created user name and password, carefully check whether the environment variable (vim
/home/oracle/.bash_profile) is correct, the SID may not be found, execute:

[oracle\@localhost \~]\$ export ORACLE_SID=orcl

The deployment is basically completed below, please leave a message if you have any additions or modifications! ! ///

Guess you like

Origin blog.csdn.net/wlc_1111/article/details/103508149