Centos7部署Oracle11g以及排错
Cenots7部署Oracle11g
先安装好jdk8(https://blog.csdn.net/weixin_44538107/article/details/88683530)这是我在网上找的一个博主的。跟着教程可以很快安装jdk8
- 在确定安装好JDK8后,然后进入安装。
-
Oracle11g安装包
下载地址:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
-
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
-
二、 安装前准备
1、创建oracle数据库的系统用户和用户组
[admin @localhost ~]$ su root
Password:
[[email protected] admin]# groupadd oinstall #创建用户组oinstall
[[email protected] admin]# groupadd dba #创建用户组dba
[[email protected] admin]# useradd -g oinstall -G dba -m oracle #创建oracle用户,并加入到oinstall和dba用户组
[[email protected] 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.
[[email protected] admin]# id oracle #查看新建的oracle用户
uid=1001(oracle) gid=1002(dba) groups=1002(dba)
[[email protected] admin]#
-g:指定用户所属的群组 -G:指定用户所属的附加群组 -m:自动建立用户的登入目录
2、创建oracle数据库安装目录
[[email protected] admin]# mkdir -p /usr/oracle #安装目录
[[email protected] admin]# mkdir -p /usr/oraInventory #配置文件目录
[[email protected] admin]# mkdir -p /usr/orapackage #软件包解压目录
[[email protected] admin]# cd /usr
[[email protected] usr]# ls
orapackage oracle oraInventory ...
[[email protected] usr]# chown -R oracle:oinstall /usr/oracle #设置目录所有者为oinstall用户组的oracle用户
[[email protected] usr]# chown -R oracle:oinstall /usr/oraInventory
[[email protected] usr]# chown -R oracle:oinstall /usr/orapackage
[[email protected] usr]#
3.、安装包准备
[[email protected] admin]# cd /usr [[email protected] admin]# mkdir orapackage #这是用来存放 oracle11g的目录
cd orapackage命令,然后通过连接Xshell。 通过命令rz 就可以选择我们下载的文件
[[email protected] orapackage]# ls linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
解压缩到当前目录
[[email protected] orapackage]# unzip linux_11gR2_database_1of2.zip [[email protected] orapackage]# unzip linux_11gR2_database_2of2.zip [[email protected] orapackage]# ls database linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip
4、修改OS系统标识
oracle默认不支持CentOS系统安装,修改文件 /etc/RedHat-release
[[email protected] admin]# cat /proc/version Linux version 3.10.0-327.el7.x86_64 ([email protected]) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) [[email protected] admin]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [[email protected] admin]# vi /etc/redhat-release #进入编辑界面,将内容更改为redhat-7 [[email protected] admin]# cat /etc/redhat-release redhat-7 [[email protected] admin]#
5、安装oracle数据库所需要的软件包
参考:https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm
Oracle Linux 7 and Red Hat Enterprise Linux 7
The following packages (or later versions) must be installed:
binutils-2.23.52.0.1-12.el7.x86_64 compat-libcap1-1.10-3.el7.x86_64 compat-libstdc++-33-3.2.3-71.el7.i686 compat-libstdc++-33-3.2.3-71.el7.x86_64 gcc-4.8.2-3.el7.x86_64 gcc-c++-4.8.2-3.el7.x86_64 glibc-2.17-36.el7.i686 glibc-2.17-36.el7.x86_64 glibc-devel-2.17-36.el7.i686 glibc-devel-2.17-36.el7.x86_64 ksh libaio-0.3.109-9.el7.i686 libaio-0.3.109-9.el7.x86_64 libaio-devel-0.3.109-9.el7.i686 libaio-devel-0.3.109-9.el7.x86_64 libgcc-4.8.2-3.el7.i686 libgcc-4.8.2-3.el7.x86_64 libstdc++-4.8.2-3.el7.i686 libstdc++-4.8.2-3.el7.x86_64 libstdc++-devel-4.8.2-3.el7.i686 libstdc++-devel-4.8.2-3.el7.x86_64 libXi-1.7.2-1.el7.i686 libXi-1.7.2-1.el7.x86_64 libXtst-1.2.2-1.el7.i686 libXtst-1.2.2-1.el7.x86_64 make-3.82-19.el7.x86_64 sysstat-10.1.5-1.el7.x86_64
To use ODBC on Linux x86-64, the following additional ODBC RPMs are required:
On Oracle Linux 7, and Red Hat Enterprise Linux 7:
unixODBC-2.3.1-6.el7.x86_64 or later unixODBC-2.3.1-6.el7.i686 or later unixODBC-devel-2.3.1-6.el7.x86_64 or later unixODBC-devel-2.3.1-6.el7.i686 or later
安装所需安装包
[[email protected] 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
6、关闭防火墙
CentOS 7默认使用的是firewall作为防火墙
[[email protected] 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 [[email protected] admin]# systemctl stop firewalld.service #关闭防火墙 [[email protected] 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 [[email protected] admin]# systemctl disable firewalld.service #关闭开机制动启动
7、关闭selinux(需重启生效)
[[email protected] /]# vi /etc/selinux/config [[email protected] /]# cat /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
8、修改内核参数
[[email protected] admin]# vi /etc/sysctl.conf
[[email protected] admin]# cat /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 #发送缓冲区最大值
[[email protected] admin]#
9、设置用户限制,提高软件运行性能
[[email protected] admin]# vi /etc/security/limits.conf [[email protected] admin]# cat /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、配置用户的环境变量
[[email protected] /]# vi /home/oracle/.bash_profile [[email protected] /]# cat /home/oracle/.bash_profile … export PATH export ORACLE_BASE=/usr/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,根据需要自行设定。
使配置生效
[[email protected] admin]# source /home/oracle/.bash_profile
[[email protected] admin]# vi /etc/sysctl.conf [[email protected] admin]# cat /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 #发送缓冲区最大值 [[email protected] admin]#
使配置参数生效
[[email protected] admin]# sysctl –p
10、配置用户的环境变量
[[email protected] /]# vi /home/oracle/.bash_profile [[email protected] /]# cat /home/oracle/.bash_profile … export PATH export ORACLE_BASE=/usr/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,根据需要自行设定。
使配置生效
[[email protected] admin]# source /home/oracle/.bash_profile
[[email protected] ~]$ cd /usr/orapackage/database [[email protected] database]$ ls doc install response rpm runInstaller sshsetup stage welcome.html [[email protected] database]$ ./runInstaller –jreLoc /usr/java/jdk1.8
这里会有人报错,如果没错可以跳过这,去看下面运行界面:
解决方案:这样就可以解决了
切换成root用户
先vim /etc/profile
在最后额外增加一行
export DISPLAY=:0.0
xhost +
然后在source /etc/profile 重新加载数据
然后在切换oracle用户 运行../runInstaller
错误2:
有人会出现temp不足 如图解决
,
错误3,还有人会有出现经过我测试 https://jingyan.baidu.com/article/636f38bbbff909d6b9461071.html 可以解决。
以上三种基本上常遇到的问题
打开控制端,以root权限执行所示两个脚本
[[email protected] /]# sh /usr/oraInventory/orainstRoot.sh [[email protected] /]# 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 ...
点击OK,安装完成,关闭界面
4、创建Oracle监听
[[email protected] ~]$ netca
打开控制端,以root权限执行所示两个脚本
[[email protected] /]# sh /usr/oraInventory/orainstRoot.sh [[email protected] /]# 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 ...
点击OK,安装完成,关闭界面
4、创建Oracle监听
[[email protected] ~]$ netca