CentOS7安装Oracle 11gR2
二、安装Oracle前准备
1.创建运行oracle数据库的系统用户和用户组
[sonny@localhost ~]$ su root #切换到root Password: [root@localhost sonny]# groupadd oinstall #创建用户组oinstall [root@localhost sonny]# groupadd dba #创建用户组dba [root@localhost sonny]# useradd -g oinstall -g dba -m oracle #创建oracle用户,并加入到oinstall和dba用户组 [root@localhost sonny]# passwd oracle #设置用户oracle的登陆密码,不设置密码,在CentOS的图形登陆界面没法登陆 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 sonny]# id oracle # 查看新建的oracle用户 uid=1001(oracle) gid=1002(dba) groups=1002(dba) [root@localhost sonny]#
为啥要创建oinstall用户组及dba组? 参考:http://www.oracle.com/technetwork/cn/articles/hunter-rac11gr2-iscsi-2-092412-zhs.html#13
理论上单例按照需要3种用户组,实际只建两个oinstall和dba,后面再安装oracle数据库的时候把OSOPER组也设置是dba组。
a.oracle 清单组(一般为oinstall):OINSTALL 组的成员被视为 Oracle 软件的“所有者”,拥有对 Oracle 中央清单 (oraInventory) 的写入权限。在一个 Linux 系统上首次安装 Oracle 软件时,OUI 会创建 /etc/oraInst.loc 文件。该文件指定 Oracle 清单组的名称(默认为 oinstall)以及 Oracle 中央清单目录的路径。 b.数据库管理员(OSDBA,一般为 dba):OSDBA 组的成员可通过操作系统身份验证使用 SQL 以 SYSDBA 身份连接到一个 Oracle 实例。该组的成员可执行关键的数据库管理任务,如创建数据库、启动和关闭实例。该组的默认名称为dba。SYSDBA 系统权限甚至在数据库未打开时也允许访问数据库实例。对此权限的控制完全超出了数据库本身的范围。不要混淆 SYSDBA 系统权限与数据库角色 DBA。DBA 角色不包括 SYSDBA 或 SYSOPER 系统权限。 c.数据库操作员组(OSOPER,一般为 oper):OSOPER 组的成员可通过操作系统身份验证使用 SQL 以 SYSOPER 身份连接到一个 Oracle 实例。这个可选组的成员拥有一组有限的数据库管理权限,如管理和运行备份。该组的默认名称为oper。SYSOPER 系统权限甚至在数据库未打开时也允许访问数据库实例。对此权限的控制完全超出了数据库本身的范围。要使用该组,选择 Advanced 安装类型来安装 Oracle 数据库软件。
2.创建oracle数据库安装目录
[sonny@localhost ~]$ su root Password: [root@localhost sonny]# mkdir -p /data/oracle #oracle数据库安装目录 [root@localhost sonny]# mkdir -p /data/oraInventory #oracle数据库配置文件目录 [root@localhost sonny]# mkdir -p /data/database #oracle数据库软件包解压目录 [root@localhost sonny]# cd /data [root@localhost data]# ls #创建完毕检查一下(强迫症) database oracle oraInventory [root@localhost data]# chown -R oracle:oinstall /data/oracle #设置目录所有者为oinstall用户组的oracle用户 [root@localhost data]# chown -R oracle:oinstall /data/oraInventory [root@localhost data]# chown -R oracle:oinstall /data/database [root@localhost data]#
3.修改OS系统标识
oracle默认不支持CentOS系统安装,Oracle Database 11g Release 2 的 OS要求参考: https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#LADBI1106
我安装是64位数据库,On Linux x86-64:Red Hat Enterprise linux 7 (RHEL 7)
另外,CentOS7.0.1511 基于 RHEL7.2 参考:http://www.linuxidc.com/Linux/2015-12/126283.htm
修改文件 /etc/RedHat-release
[sonny@localhost data]$ su root Password: [root@localhost data]# cat /proc/version Linux version 3.10.0-327.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Nov 19 22:10:57 UTC 2015 [root@localhost data]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core) [root@localhost data]# vi /etc/redhat-release [root@localhost data]# cat /etc/redhat-release redhat-7 [root@localhost data]#
4.安装oracle数据库所需要的软件包
重复一遍,我安装时Oracle Database 11g Release 2 64位数据库。
Oracle Database Package Requirements for Linux x86-64 如下:(参考:https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#BABCFJFG)
rpm -qa binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers glibc-static kernel-headers pdksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel libstdc++-static make numactl-devel sysstat unixODBC unixODBC-devel // 验证命令26个包
- kernel-headers-3.10.0-123.el7.x86_64
- gcc-c++-4.8.2-16.el7.x86_64
- numactl-devel-2.0.9-2.el7.x86_64
- glibc-headers-2.17-55.el7.x86_64
- glibc-common-2.17-55.el7.x86_64
- binutils-2.23.52.0.1-16.el7.x86_64
- unixODBC-devel-2.3.1-10.el7.x86_64
- libaio-0.3.109-12.el7.x86_64
- make-3.82-21.el7.x86_64
- elfutils-libelf-0.158-3.el7.x86_64
- elfutils-libelf-devel-0.158-3.el7.x86_64
- sysstat-10.1.5-4.el7.x86_64
- glibc-static-2.17-55.el7.x86_64
- glibc-devel-2.17-55.el7.x86_64
- glibc-2.17-55.el7.x86_64
- elfutils-libelf-devel-static-0.158-3.el7.x86_64
- libaio-0.3.109-12.el7.i686
- gcc-4.8.2-16.el7.x86_64
- libgcc-4.8.2-16.el7.i686
- libstdc++-static-4.8.2-16.el7.x86_64
- libaio-devel-0.3.109-12.el7.x86_64
- libstdc++-4.8.2-16.el7.x86_64
- libaio-devel-0.3.109-12.el7.i686
- unixODBC-2.3.1-10.el7.x86_64
- libstdc++-devel-4.8.2-16.el7.x86_64
- compat-libstdc++-33-3.2.3-71.el7.x86_64
- libgcc-4.8.2-16.el7.x86_64
- libgomp-4.8.2-16.el7.x86_64
老实人,第一次搞,一个一个的安装,命令也很简单,反正文档要求高版本也可以:
[sonny@localhost data]$ su root Password: [root@localhost data]# yum install binutils 省略...
5.关闭防火墙 CentOS 7.2默认使用的是firewall作为防火墙
[sonny@localhost /]$ su root Password: [root@localhost /]# systemctl status firewalld.service #查看防火墙状态,运行中 ● firewalld.service - firewalld - dynamic firewall daemonLoaded: 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 agoMain PID: 802 (firewalld)CGroup: /system.slice/firewalld.service└─802 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopidApr 07 18:54:25 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon... Apr 07 18:54:29 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon. [root@localhost /]# systemctl stop firewalld.service #关闭防火墙 [root@localhost /]# systemctl status firewalld.service #再次查看防火墙状态,发现已关闭 ● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: inactive (dead) since Thu 2016-04-07 21:15:34 PDT; 9s agoMain PID: 802 (code=exited, status=0/SUCCESS)Apr 07 18:54:25 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon... Apr 07 18:54:29 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon. Apr 07 21:15:33 localhost systemd[1]: Stopping firewalld - dynamic firewall daemon... Apr 07 21:15:34 localhost systemd[1]: Stopped firewalld - dynamic firewall daemon. [root@localhost /]# systemctl disable firewalld.service #禁止使用防火墙(重启也是禁止的) Removed symlink /etc/systemd/system/dbus-org.Fedoraproject.FirewallD1.service. Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service. [root@localhost /]#
防火墙先禁用,搞好之后再配置,个人虚拟机,要毛线防火墙~~
6.关闭selinux(需重启生效)
[root@localhost /]# vi /etc/selinux/config [root@localhost /]# 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 [root@localhost /]#
为啥要关闭selinux?因为selinux太高深,非专业人士搞不懂~~
7.修改内核参数
红色部分为添加代码
[sonny@localhost /]$ su root Password: [root@localhost /]# vi /etc/sysctl.conf [root@localhost /]# cat /etc/sysct.conf cat: /etc/sysct.conf: No such file or directory [root@localhost /]# 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 kernel.shmall = 2097152 #共享内存的总量,8G内存设置:2097152*4k/1024/1024 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 /]#
使配置参数生效
[root@localhost /]# sysctl -p net.ipv4.icmp_echo_ignore_broadcasts = 1 net.ipv4.conf.all.rp_filter = 1 sysctl: setting key "fs.file-max": Invalid argument fs.file-max = 6815744 #设置最大打开文件数 fs.aio-max-nr = 1048576 sysctl: setting key "kernel.shmall": Invalid argument kernel.shmall = 2097152 #共享内存的总量,8G内存设置:2097152*4k/1024/1024 sysctl: setting key "kernel.shmmax": Invalid argument kernel.shmmax = 2147483648 #最大共享内存的段大小 sysctl: setting key "kernel.shmmni": Invalid argument kernel.shmmni = 4096 #整个系统共享内存端的最大数 kernel.sem = 250 32000 100 128 sysctl: setting key "net.ipv4.ip_local_port_range": Invalid argument 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 /]#
8.对oracle用户设置限制,提高软件运行性能(红色为添加部分)
[sonny@localhost /]$ su root Password: [root@localhost /]# vi /etc/security/limits.conf [root@localhost /]# cat /etc/security/limits.conf # /etc/security/limits.conf # #This file sets the resource limits for the users logged in via PAM. #It does not affect resource limits of the system services. # #Also note that configuration files in /etc/security/limits.d directory, #which are read in alphabetical order, override the settings in this #file in case the domain is the same or more specific. #That means for example that setting a limit for wildcard domain here #can be overriden with a wildcard setting in a config file in the #subdirectory, but a user specific setting here can be overriden only #with a user specific setting in the subdirectory. # #Each line describes a limit for a user in the form: # #<domain> <type> <item> <value> # #Where: #<domain> can be: # - a user name # - a group name, with @group syntax # - the wildcard *, for default entry # - the wildcard %, can be also used with %group syntax, # for maxlogin limit # #<type> can have the two values: # - "soft" for enforcing the soft limits # - "hard" for enforcing hard limits # #<item> can be one of the following: # - core - limits the core file size (KB) # - data - max data size (KB) # - fsize - maximum filesize (KB) # - memlock - max locked-in-memory address space (KB) # - nofile - max number of open file descriptors # - rss - max resident set size (KB) # - stack - max stack size (KB) # - cpu - max CPU time (MIN) # - nproc - max number of processes # - as - address space limit (KB) # - maxlogins - max number of logins for this user # - maxsyslogins - max number of logins on the system # - priority - the priority to run user process with # - locks - max number of file locks the user can hold # - sigpending - max number of pending signals # - msgqueue - max memory used by POSIX message queues (bytes) # - nice - max nice priority allowed to raise to values: [-20, 19] # - rtprio - max realtime priority # #<domain> <type> <item> <value> ##* soft core 0 #* hard rss 10000 #@student hard nproc 20 #@faculty soft nproc 20 #@faculty hard nproc 50 #ftp hard nproc 0 #@student - maxlogins 4 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536# End of file [root@localhost /]#
9.配置用户的环境变量(红色部分为添加代码)
[root@localhost /]# vi /home/oracle/.bash_profile [root@localhost /]# cat /home/oracle/.bash_profile # .bash_profile# Get the aliases and functions if [ -f ~/.bashrc ]; then. ~/.bashrc fi# User specific environment and startup programsPATH=$PATH:$HOME/.local/bin:$HOME/binexport PATHexport ORACLE_BASE=/data/oracle #oracle数据库安装目录 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安装时设置的字符集保持一致,如:ZHS16GBK,否则出现数据导入导出中文乱码问题 [root@localhost /]#
使上述配置立即生效:
[oracle@localhost /]$ su root Password: [root@localhost /]# source /home/oracle/.bash_profile [root@localhost /]#
10.上述都搞定了,上传安装包我喜欢xftp,将oracle安装包上传到/usr/local/src
11.解压安装包
[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/ #解压 (省略...) [oracle@localhost src]$ unzip linux.x64_11gR2_database_2of2.zip -d /data/database/ #解压 (省略...) [oracle@localhost src]$ su root Password: [root@localhost src]# chown -R oracle:oinstall /data/database/database/ [root@localhost src]#
三、oracle安装
0. 安装图形界面GNOME
yum groupinstall "GNOME Desktop"
startx
如果启动失败,新建用户文件来配置,并重启
1.图形界面登陆oracle用户:
2.启动oralce安装,到/data/database/database/目录下,执行runInstaller
3.去掉勾,懒得填,个人使用环境不需要自动接收Oracle的安全更新。
4.下一步,只安装数据库软件,这一步貌似是有点问题的,重装了几遍都有问题,建议选第一个!!!
5.选择DESKTOP安装
6.添加语言
7.默认安装版本企业版-Enterprise Edition --图没了。
8.确定数据软件的安装路径,自动读取前面Oracle环境变量中配置的值。
9.理论上要创建Database Operation(OSOPER)Group:oper ,个人用,懒得建,就使用dba用户组
10.安装检查,按照提示信息一个一个解决。
swap空间不足解决 :(要求2.67G 实际2G)
[root@localhost oracle]# free -m #查看当前虚拟内存total used free shared buff/cache available Mem: 1824 1369 93 10 361 250 Swap: 2048 20 2028 [root@localhost oracle]# dd if=/dev/zero of=/home/swap bs=1024 count=1024000 #将当前swap空间由2048M 增加到 3048M 新增一个2014的swap文件 1024000+0 records in 1024000+0 records out 1048576000 bytes (1.0 GB) copied, 29.4051 s, 35.7 MB/s [root@localhost oracle]# mkswap /home/swap Setting up swapspace version 1, size = 1023996 KiB no label, UUID=5e3d39d7-285e-4c74-b321-1e2b3ffabf83 [root@localhost oracle]# free -mtotal used free shared buff/cache available Mem: 1824 1275 95 10 454 342 Swap: 2048 141 1907 [root@localhost oracle]# swapon /home/swap #增加并启用虚拟内容 swapon: /home/swap: insecure permissions 0644, 0600 suggested. [root@localhost oracle]# free -m #再次查看total used free shared buff/cache available Mem: 1824 1275 94 10 454 342 Swap: 3048 141 2907
11.一个一个检查package,在准备阶段中漏掉的,此处再安装,有些系统报错是因为现有的包的版本比检测要高,最后忽略即可。(点击Check_Again 多检查几次)
12.准备完毕,点击 “Finish”开始安装。
四、Oracle的启动
若是通过root su 到oracle的
需要刷一下用户文件
source ~/.bash_profile
lsnrctl start
sqlplus / as sysdba
startup
CentOS7安装Oracle 11gR2相关推荐
- CentOS7安装Oracle 11gR2 图文详解
第一次玩CentOS7虚拟机上安装Oracle11gR2,在网上找的教程觉得还不错,就分享一下 原文地址:http://www.linuxidc.com/Linux/2016-04/130559.ht ...
- Linux环境搭建:CentOS7安装Oracle
CentOS7 安装Oracle 11.2.0 材料 [root@bogon yum.repos.d]# rpm -qi centos-release Name : centos-release Ve ...
- CentOS7.4下安装Oracle 11gR2
安装环境: 系统:CentOS7.4 4核4G 磁盘50G Oracle软件版本:linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_databas ...
- centOS6.5中静默安装oracle 11gR2
近日公司租用虚机,需要在虚机上安装oracle11gR2,由于先前从未使用过linux系统,在网上查了一些方法进行安装最后都安装失败,最后经多次试验才发现安装不成功的多数问题都是集中在包或者是权限上, ...
- CentOS7安装Oracle数据库的全流程
一.准备工作 1.下载Oracle的安装介质 Oracle 11g R2 Linux版本有两个压缩文件包,都需下载安装才会完整. linux.x64_11gR2_database_1of2.zip l ...
- VMware Linux 下安装 Oracle 11gR2 RAC
文本: 文本 VMware Linnux 下安装 Oracle 11g R2 RAC 虚拟机VMware下安装Linux下载wmware server 2.0http://download.pcho ...
- RHEL5 Silent方式安装Oracle 11gR2指南
Oracle单实例的安装文档网上比比皆是,其中也不乏很好的文章,其实oracle最好的安装文档莫过于联机手册,但是手册的安装步骤太过详细,所以很多大侠为了方便就整理了许多不同版本的安装文档,本人自学o ...
- 安装oracle 11gR2单实例+ASM
安装oracle11gR2单实例+ASM,让新手走向数据库管理员 一.介绍 因业务需要,最近在主系统的基础上搭建一套mini系统,本文只讲ORACLE数据库+ASM磁盘管理工具的安装: 1.服务器系统 ...
- RHEL 5.4 安装Oracle 11gR2, 准备篇...
所谓Rhel 就是Redhat enterprise Linux, Redhat 的服务器操作系统. 我本来想将Oracle 装在opensuse 上, 可是由于缺少指定版本的包,失败了. 还是选 ...
最新文章
- Linux系统中的软件管理
- 低代码缺少的五大组件
- 集群四 mysql-5.7.16一键安装
- Segment Routing — SRv6 — 转发原理
- Android移动开发之【Android实战项目】通过Java代码设置TextView
- 输入对话框基于PyQt4的输入对话框
- yolo loss 将图像标注的真实事坐标转换到anchor坐标
- Interview:算法岗位面试—11.02早上上海某银行(上海分行,四大行之一)信息技术岗笔试记录
- django 函数装饰器 变为 类装饰器
- powerdesigner奇淫技
- ASP.NET Core 实战:Linux 小白的 .NET Core 部署之路
- Learning Shape Priors for Single-View 3D Completion and Reconstruction
- linux ip地址本地缓存,ip-address – 如何解析组织的IP地址(使用缓存)
- POJ NOI MATH-7655 回文数个数
- Node.js 学习笔记--- (2)创建一个简单的博客工程
- java 小总结,以后复习看以看
- 如何实现 java 接口中的部分方法
- 用WebBrowser实现HTML界面的应用
- 计算机无法安装蓝牙驱动,windows10系统安装蓝牙驱动图文教程|windows10系统如何安装蓝牙驱动...
- k3修改服务器,金蝶k3客户端修改服务器地址