Oracle11g安装包:

p13390677_112040_Linux-x86-64_1of7.zip
p13390677_112040_Linux-x86-64_2of7.zip

下载地址:

百度云:https://pan.baidu.com/s/1FU0NSbptjGXTXpLmLTzX6g
提取码:q03g

操作系统配置

注意:

1、如没有关闭防火墙,请先关闭:

systemctl stop firewalld.service
systemctl status firewalld.service
systemctl disable firewalld.service

2、如没有关闭selinux,请先关闭:

[root@cdh02 data]# 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

接下来修改系统参数,在Root用户下执行以下步骤:

1)修改用户的 SHELL 的限制(资源限制),修改 /etc/security/limits.conf 文件:

$ vi /etc/security/limits.conf

按i键进入编辑模式,将下列内容加入该文件:

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

编辑完成后按Esc键,输入“:wq”存盘退出

2)修改 /etc/pam.d/login 文件

查找pam_limits.so文件位置:

$ find / -name pam_limits.so

获取路径/usr/lib64/security/pam_limits.so

$ vi /etc/pam.d/login

按i键进入编辑模式,将下列内容加入该文件:

session required /usr/lib64/security/pam_limits.so
session required pam_limits.so

编辑完成后按Esc键,输入“:wq”存盘退出

3)修改 linux 内核,修改 /etc/sysctl.conf 文件

$ vi /etc/sysctl.conf

按i键进入编辑模式,将下列内容加入该文件

fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

编辑完成后按Esc键,输入“:wq”存盘退出

4)要使 /etc/sysctl.conf更改立即生效,执行以下命令

$ sysctl -p

显示如下:

linux:~ $ sysctl -p
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

5)编辑 /etc/profile

$ vi /etc/profile

按i键进入编辑模式,将下列内容加入该文件

if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

编辑完成后按 Esc 键,输入“:wq”存盘退出

6)创建相关用户和组

groupadd oinstall
groupadd dba
useradd -g oinstall -G dba -m oracle  #创建oracle用户,归属oinstall和dba两个组
groups oracle  # 验证oracle对应的组
passwd oracle

7)创建目录及更改权限

[root@cdh02 /]# mkdir -p /data/oracle
[root@cdh02 /]# mkdir -p /data/oraInventory
[root@cdh02 /]# mkdir -p /data/database
[root@cdh02 /]# cd /data  #验证创建情况
[root@cdh02 data]# ll
total 0
drwxr-xr-x. 2 root root 6 Jul 11 11:36 database
drwxr-xr-x. 2 root root 6 Jul 11 11:36 oracle
drwxr-xr-x. 2 root root 6 Jul 11 11:36 oraInventory
[root@cdh02 data]# cd ..
[root@cdh02 /]# chown -R oracle:oinstall /data/oracle  #改变目录属主为oracle
[root@cdh02 /]# chown -R oracle:oinstall /data/oraInventory
[root@cdh02 /]# chown -R oracle:oinstall /data/database
[root@cdh02 /]# ll /data
total 0
drwxr-xr-x. 2 oracle oinstall 6 Jul 11 11:36 database
drwxr-xr-x. 2 oracle oinstall 6 Jul 11 11:36 oracle
drwxr-xr-x. 2 oracle oinstall 6 Jul 11 11:36 oraInventory

8)修改内核版本名称

因为oracle默认不支持在centos7上安装,所以改为redhat-7

[root@cdh02 /]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
[root@cdh02 /]# cp /etc/redhat-release /etc/redhat-release.bak #备份
[root@cdh02 /]# vi /etc/redhat-release
redhat-7

9)安装依赖包

yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers gl ibc-static kernel-headers libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel libstdc++-static make numactl-devel sysstat unixODBC unixODBC-devel

10)修改用户oracle环境变量

vi /home/oracle/.bash_profile
# 注释下面两行
# PATH=$PATH:$HOME/.local/bin:$HOME/bin  
# export PATH 

# 添加下面内容
export ORACLE_BASE=/data/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=en_US.UTF-8
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

退出后用root用户执行下面命令,使该配置文件即时生效。

source /home/oracle/.bash_profile

安装Oracle数据库

1)使用VNC远程连接服务器

centos的远程桌面 centos远程桌面连接安装包_libstdc++


2)将oracle11g安装包拷贝到centos,解压到/data/database

[root@cdh02 data]# unzip p13390677_112040_Linux-x86-64_1of7.zip -d /data/database
[root@cdh02 data]# unzip p13390677_112040_Linux-x86-64_2of7.zip -d /data/database
[root@cdh02 data]# chown -R oracle:oinstall /data/database  # 修改所有者

3)开始安装oracle数据库

[root@cdh02 data]# su oracle  #切换到oracle用户安装
[oracle@cdh02 data]$ cd /database/database  #进入解压后的路径
[oracle@cdh02 database]$ ./runInstaller  #执行安装程序

4)解决DISPLAY报错

报错信息如下:

Checking Temp space: must be greater than 120 MB.   Actual 99804 MB    Passed
Checking swap space: must be greater than 150 MB.   Actual 8191 MB    Passed
Checking monitor: must be configured to display at least 256 colors
    >>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set.    Failed <<<<

Some requirement checks failed. You must fulfill these requirements before

continuing with the installation,

解决方法:

[root@cdh02 src]# DISPLAY=:0.0;export DISPLAY
[root@cdh02 src]# echo $DISPLAY
[root@cdh02 src]# find / -name "xhost"
/usr/bin/xhost
[root@cdh02 src]# cd /usr/bin/
[root@cdh02 bin]# ./xhost
[root@cdh02 bin]# ./xhost +
[root@cdh02 bin]# su oracle
[oracle@cdh02 bin]$ DISPLAY=:0.0;export DISPLAY
[oracle@cdh02 bin]$ echo $DISPLAY

5)如执行./runInstaller不报错,但长时间没有弹出Oracle安装页面,则参考:

6)安装具体步骤:

centos的远程桌面 centos远程桌面连接安装包_bc_02


centos的远程桌面 centos远程桌面连接安装包_centos的远程桌面_03


centos的远程桌面 centos远程桌面连接安装包_centos_04


仅安装数据库软件

centos的远程桌面 centos远程桌面连接安装包_centos的远程桌面_05


单实例安装

centos的远程桌面 centos远程桌面连接安装包_centos的远程桌面_06


语言添加Simplified Chinese

centos的远程桌面 centos远程桌面连接安装包_centos_07


centos的远程桌面 centos远程桌面连接安装包_bc_08


centos的远程桌面 centos远程桌面连接安装包_centos的远程桌面_09


centos的远程桌面 centos远程桌面连接安装包_centos_10


centos的远程桌面 centos远程桌面连接安装包_centos_11


这里提示pdksh缺失,手动安装一下即可:

百度云:https://pan.baidu.com/s/1mg2E5AKMy4ELfCzrAGUsdA
提取码:7peq
rpm -ivh pdksh-5.2.14-37.el5_8.1.i386.rpm --nodeps

centos的远程桌面 centos远程桌面连接安装包_libstdc++_12


最后一步,保留安装过程,新开一个xshell窗口,按提示要求用root登录并执行以下脚本,然后回到此界面点击OK。

[root@cdh02 /]# /data/oraInventory/orainstRoot.sh
Changing permissions of /data/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /data/oraInventory to oinstall.
The execution of the script is complete.
[root@cdh02 /]# /data/oracle/product/11.2.0/db_1/root.sh
Performing root user operation for Oracle 11g 

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /data/oracle/product/11.2.0/db_1

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 ...
......

配置Oracle监听

使用oracle用户登录,执行netca 命令进入可视化监听配置界面,一路Next完成

[oracle@cdh02 ~]$ whereis netca
netca: /data/oracle/product/11.2.0/db_1/bin/netca
[oracle@cdh02 ~]$ cd /data/oracle/product/11.2.0/db_1/bin/
[oracle@cdh02 ~]$ netca

centos的远程桌面 centos远程桌面连接安装包_centos_13


centos的远程桌面 centos远程桌面连接安装包_oracle_14


centos的远程桌面 centos远程桌面连接安装包_oracle_15


centos的远程桌面 centos远程桌面连接安装包_oracle_16


centos的远程桌面 centos远程桌面连接安装包_centos的远程桌面_17


centos的远程桌面 centos远程桌面连接安装包_bc_18


监听配置完成。

创建Oracle创建实例:

[oracle@cdh02 bin]$ dbca  #执行配置程序

centos的远程桌面 centos远程桌面连接安装包_centos_19


centos的远程桌面 centos远程桌面连接安装包_oracle_20

据环境变量中设置的 ORACLE_SID 设置数据库名称和SID,这里设置的是:orcl

centos的远程桌面 centos远程桌面连接安装包_centos_21


centos的远程桌面 centos远程桌面连接安装包_centos的远程桌面_22


设置密码

centos的远程桌面 centos远程桌面连接安装包_libstdc++_23


设置中文编码

centos的远程桌面 centos远程桌面连接安装包_centos的远程桌面_24


centos的远程桌面 centos远程桌面连接安装包_bc_25


点击Exit,部署完成。

验证是否安装成功

在centos中用sys用户登录,验证是否正常能正常登陆

[oracle@cdh02 db_1]$ sqlplus sys/password as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Sat Jul 11 14:07:00 2020

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


Connected to:
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> SELECT * FROM v$pwfile_users;

SQL> exit;