Oracle 12c 在OEL7.1上的安装
实施文档
日 期:2015年9月2日
目 录
一、 介质说明 ............................................................................................................................................................ 1 二、 准备工作 ............................................................................................................................................................ 2 2.1 VMWARE WORKSTATION PRO 12.0.0 FOR WINDOWS 安装 .................................................................................................. 2 2.2 ORACLELINUX-R7-U1-SERVER-X86_64 系统安装 ............................................................................................................ 2 2.2.1 创建OEL7.1虚拟机 ........................................................................................................................................... 2 2.2.2 OEL7.1系统安装 ............................................................................................................................................... 11 三、 安装ORACLE 12C ............................................................................................................................................... 23 3.1 基础配置 ................................................................................................................................................................. 23 3.2 配置本地YUM包源 ................................................................................................................................................. 24 3.3 安装软件包 ............................................................................................................................................................. 25 3.4 创建用户和组 ......................................................................................................................................................... 27 3.5 内核参数调整 ......................................................................................................................................................... 27 3.5.1 标准 .................................................................................................................................................................. 27 3.5.2 实际查询值 ...................................................................................................................................................... 28 3.5.3 修改下面文件即可 .......................................................................................................................................... 29 3.6 参数生效 ................................................................................................................................................................. 30 3.7 软件用户资源限制.................................................................................................................................................. 30 3.7.1 联机文档要求 .................................................................................................................................................. 30 3.7.2 实际配置 .......................................................................................................................................................... 30 3.8 修改安装目录权限.................................................................................................................................................. 32 3.9 修改ORACLE环境变量 ............................................................................................................................................. 32 3.10 数据库软件安装.................................................................................................................................................... 32 3.10.1 解压下载的文件 ............................................................................................................................................ 32 3.10.2 安装步骤 ........................................................................................................................................................ 33 3.11 创建数据库 ........................................................................................................................................................... 41 3.11.1 安装监听 ........................................................................................................................................................ 41 3.11.2 安装数据库 .................................................................................................................................................... 44 四、 ORACLE 12C新特性介绍 ................................................................................................................................... 54
a
一、 介质说明
Oracle Database 12c Release 1 for Linux x86-64 oracle 12c 数据库软件
下载地址:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
OracleLinux-R7-U1-Server-x86_64-dvd.iso oracle linux 操作系统 下载地址:
https://edelivery.oracle.com/osdc/faces/Home.jspx?_afrLoop=1944357500338522&_afrWindowMode=0&_adf.ctrl-state=1br89kn0pd_4
VMware Workstation Pro 12.0.0 for Windows 虚拟机软件 下载地址:
https://my.vmware.com/cn/web/vmware/info/slug/desktop_end_user_computing/vmware_workstation_pro/12_0
oracle12cr1 online document oracle12c联机文件
下载地址:http://www.oracle.com/technetwork/database/enterprise-edition/documentation/index.html
1
二、 准备工作
2.1 VMware Workstation Pro 12.0.0 for Windows 安装
标准下一步下一步即可,不做过多讲解。
2.2 OracleLinux-R7-U1-Server-x86_64 系统安装
本系统采用虚拟化软件进行搭建和部署
2.2.1 创建OEL7.1虚拟机
打开虚拟化软件,如下图图标:
界面如下:
Ctrl+N打开创建虚拟机配置界面,选择自定义配置,选择下一步。如下图:
2
选择虚拟化软件的兼容性功能,默认下一步即可。
选择要安装操作系统的镜像,如下图:
3
虚拟机命名和安放位置选择,如下图:
配置虚拟机CPU核心数为4个,可以按照实际进行配置。如下图:
4
配置内存,按照联机文档中对内存的要求,这里配置内存为2G,如下图:
5
选择虚拟机网络配置模式为本地模式,如下
本地模式网络地址段如下:
6
硬盘配置器模式选择,默认即可。
虚拟磁盘类型选择默认即可:
7
创建磁盘,按照联机文档要求,这里配置磁盘大小为15G,如 下图:
8
命名硬盘文件名称,默认如下:
配置完成,点击finish即可。
9
稍等片刻,正在创建。
配置完成后如下:
10
2.2.2 OEL7.1系统安装
虚拟机加电,点击第一项安装,如下图:
11
弹出确认界面,回车即可。
选择语言,默认英语即可。
12
配置时区,分区等信息,如下图:
13
时区配置如下
分区选择自定义,如下图:
14
选择分区类型,为标准即可。
点击左下角加号进行分区,创建引导分区500M,交换分区4G,/剩下所有大小。注意分区格式为EXT4如下图:
15
弹出分区确认信息,单击接受即可。
配置网络和主机名
16
配置总结,进行安装即可。如下图
17
设置root 用户密码,如下图
重启后默认启动是UEK内核,这个内核在虚拟机中无法使用,采用正常的内核方可启动。
18
重启后接受许可,点击确定。如下图:
不启用自动更新软件,如下图:
19
系统初始化,如下图:
20
创建用户:
地区选择:
21
点击完成即可。
22
三、 安装oracle 12c
3.1 基础配置
查看系统中启动的服务
[root@oracle12c selinux]# systemctl list-unit-files|grep enabled 关闭selinux
[root@oracle12c selinux]# vi 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
# 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@oracle12c selinux]# pwd /etc/selinux
关闭防火墙
[root@oracle12c ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: inactive (dead) since Mon 2015-08-31 17:40:13 CST; 4min 54s ago
Process: 794 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS status=0/SUCCESS)
Main PID: 794 (code=exited, status=0/SUCCESS)
Aug 31 16:14:19 oracle12c systemd[1]: Started firewalld - dynamic firewall daemon. Aug 31 17:40:12 oracle12c systemd[1]: Stopping firewalld - dynamic firewall daemon... Aug 31 17:40:13 oracle12c systemd[1]: Stopped firewalld - dynamic firewall daemon. Aug 31 17:42:08 oracle12c systemd[1]: Stopped firewalld - dynamic firewall daemon. [root@oracle12c ~]# systemctl stop firewalld [root@oracle12c ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: inactive (dead) since Mon 2015-08-31 17:40:13 CST; 5min ago
Process: 794 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS status=0/SUCCESS)
23
(code=exited,
(code=exited,
Main PID: 794 (code=exited, status=0/SUCCESS)
Aug 31 16:14:19 oracle12c systemd[1]: Started firewalld - dynamic firewall daemon. Aug 31 17:40:12 oracle12c systemd[1]: Stopping firewalld - dynamic firewall daemon... Aug 31 17:40:13 oracle12c systemd[1]: Stopped firewalld - dynamic firewall daemon. Aug 31 17:42:08 oracle12c systemd[1]: Stopped firewalld - dynamic firewall daemon. Aug 31 17:45:29 oracle12c systemd[1]: Stopped firewalld - dynamic firewall daemon. [root@oracle12c ~]# systemctl disable firewalld
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service' rm '/etc/systemd/system/basic.target.wants/firewalld.service' [root@oracle12c ~]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled) Active: inactive (dead)
Aug 31 16:14:11 oracle12c systemd[1]: Starting firewalld - dynamic firewall daemon... Aug 31 16:14:19 oracle12c systemd[1]: Started firewalld - dynamic firewall daemon. Aug 31 17:40:12 oracle12c systemd[1]: Stopping firewalld - dynamic firewall daemon... Aug 31 17:40:13 oracle12c systemd[1]: Stopped firewalld - dynamic firewall daemon. Aug 31 17:42:08 oracle12c systemd[1]: Stopped firewalld - dynamic firewall daemon. Aug 31 17:45:29 oracle12c systemd[1]: Stopped firewalld - dynamic firewall daemon. 停止NTP服务
[root@oracle12c ~]# systemctl status ntpd ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled) Active: inactive (dead)
3.2 配置本地yum包源
1、插入光盘
2、mkdir /media/disk
3、mount –o loop /dev/cdrom /media/disk 4、cd /etc/yum.repos.d
文件位置/etc/yum.repos.d/,后缀一定是.repo结束.为了使用自己搭建的yum源我这里删除了自带的(rm –f ./*)
编辑自己的repo文件
[root@helomeyum.repos.d]#vim local.repo (repo后缀) [local_server](库名称)
name=Thisis a local repo (名称描述)
baseurl=file:///media/disk(yum源目录,源地址) enabled=1(是否启用该yum源,0为禁用)
gpgcheck=0 (检查GPG-KEY,0为不检查,1为检查)
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6(gpgcheck=0时无需配置) 保存退出!
24
5、测试YUM安装源 [root@node1 ~]#yum list
6、检查安装oracle所需要的包, Yum install binutils* #yum clean all ‘清除yum缓存
#yum makecache ‘缓存本地yum源中的软件包信息 #yum install 软件包名称 (如:yum install httpd)
3.3 安装软件包
按照联机文档要求,需要安装如下软件包:
没有安装的包如下:
glibc-2.17-36.el7.i686 OK
25
glibc-devel-2.17-36.el7.i686 OK ksh
libaio-0.3.109-9.el7.i686 OK
libaio-devel-0.3.109-9.el7.i686 OK libaio-devel-0.3.109-9.el7.x86_64 OK libgcc-4.8.2-3.el7.i686 OK libstdc++-4.8.2-3.el7.i686 OK
libstdc++-devel-4.8.2-3.el7.i686 OK libXi-1.7.2-1.el7.i686 OK libXtst-1.2.2-1.el7.i686 OK
[root@oracle12c ~]# yum install libstdc++*.i686 Loaded plugins: langpacks Resolving Dependencies
--> Running transaction check
---> Package libstdc++.i686 0:4.8.3-9.el7 will be installed
---> Package libstdc++-devel.i686 0:4.8.3-9.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved
====================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================== Installing:
libstdc++ i686 4.8.3-9.el7 local_server 307 k
libstdc++-devel i686 4.8.3-9.el7 local_server 1.5 M Transaction Summary
==================================================================================================================================== Install 2 Packages
Total download size: 1.8 M Installed size: 8.8 M Is this ok [y/d/N]: y Downloading packages:
------------------------------------------------------------------------------------------------------------------------------------
Total 28 MB/s | 1.8 MB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction
26
Installing : libstdc++-4.8.3-9.el7.i686 1/2
Installing : libstdc++-devel-4.8.3-9.el7.i686 2/2
Verifying : libstdc++-4.8.3-9.el7.i686 1/2
Verifying : libstdc++-devel-4.8.3-9.el7.i686 2/2 Installed:
libstdc++.i686 0:4.8.3-9.el7 libstdc++-devel.i686 0:4.8.3-9.el7 Complete!
3.4 创建用户和组
[root@oracle12c ~]# groupadd oinstall [root@oracle12c ~]# groupadd dba [root@oracle12c ~]# groupadd oper
[root@oracle12c ~]# useradd -g oinstall -G dba,oper oracle [root@oracle12c ~]# passwd 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.
3.5 内核参数调整 3.5.1 标准
semmsl semmns semopm semmni shmall
/proc/sys/kernel/sem 250
32000 100 128
/proc/sys/kernel/shmall 40 percent of the size of
physical memory in pages Note: If the server supports
multiple databases, or uses a large SGA, then set this parameter to a value that is equal to the total amount of shared memory, in 4K pages, that the system can use at
27
one time
shmmax /proc/sys/kernel/shmmax Half the size of physical
memory in bytes
See My Oracle Support Note 567506.1 for additional
information about configuring shmmax.
shmmni /proc/sys/kernel/shmmni 4096 panic_on_oops /proc/sys/kernel/panic_on_oops 1
/proc/sys/fs/file-max file-max 6815744
ip_local_port_range /proc/sys/net/ipv4/ip_local_port_range Minimum: 9000
Maximum: 65500
See the \"Setting UDP and TCP Kernel Parameters Manually\" section in Oracle Database Installation Guide for Linux
rmem_default /proc/sys/net/core/rmem_default 262144 rmem_max /proc/sys/net/core/rmem_max 4194304 wmem_default /proc/sys/net/core/wmem_default 262144 wmem_max /proc/sys/net/core/wmem_max 1048576 aio-max-nr /proc/sys/fs 1048576
Note: This value limits concurrent outstanding requests and should be set to avoid I/O subsystem failures.
注意:官方最小值
# /sbin/sysctl -a | grep sem semmsl, semmns, semopm, and
semmni This command displays the value of the semaphore parameters in the
order listed.
shmall, shmmax, and shmmni file-max
ip_local_port_range rmem_default rmem_max wmem_default wmem_max
# /sbin/sysctl -a | grep shm # /sbin/sysctl -a | grep file-max
# /sbin/sysctl -a | grep ip_local_port_range # /sbin/sysctl -a | grep rmem_default # /sbin/sysctl -a | grep rmem_max # /sbin/sysctl -a | grep wmem_default # /sbin/sysctl -a | grep wmem_max
3.5.2 实际查询值
[root@oracle12c ~]# cat /proc/sys/kernel/sem 250 32000 32 128
[root@oracle12c ~]# cat /proc/sys/kernel/shmall
28
268435456
[root@oracle12c ~]# clear
[root@oracle12c ~]# cat /proc/sys/kernel/shmmax 4294967295
[root@oracle12c ~]# cat /proc/sys/kernel/shmmni 4096
[root@oracle12c ~]# cat /proc/sys/kernel/panic_on_oops 1
[root@oracle12c ~]# cat /proc/sys/fs/file-max 200389
[root@oracle12c ~]# cat /proc/sys/net/ipv4/ip_local_port_range 32768 61000
[root@oracle12c ~]# cat /proc/sys/net/core/rmem_default 212992
[root@oracle12c ~]# cat /proc/sys/net/core/rmem_max 212992
[root@oracle12c ~]# cat /proc/sys/net/core/wmem_default 212992
[root@oracle12c ~]# cat /proc/sys/net/core/wmem_max 212992
[root@oracle12c ~]# cat /proc/sys/fs/aio-max-nr 1048576
3.5.3 修改下面文件即可
[root@oracle12c ~]# 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/ # For more information, see sysctl.conf(5) and sysctl.d(5). fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048586 29 3.6 参数生效 [root@oracle12c ~]# sysctl -p fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048586 3.7 软件用户资源限制 3.7.1 联机文档要求 3.7.2 实际配置 [root@oracle12c ~]# 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. 30 #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: # # # # - 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 # # # - \"soft\" for enforcing the soft limits # - \"hard\" for enforcing hard limits # # - 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 # # #* soft core 0 #* hard rss 10000 #@student hard nproc 20 31 #@faculty soft nproc 20 #@faculty hard nproc 50 #ftp hard nproc 0 #@student - maxlogins 4 # End of file oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 32768 [root@oracle12c ~]# 3.8 修改安装目录权限 [root@oracle12c ~]# chown -R oracle:oinstall /u01/oracle [root@oracle12c ~]# chmod -R 775 /u01/oracle/ 3.9 修改oracle环境变量 [oracle@oracle12c ~]$ cat .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/.local/bin:$HOME/bin export PATH umask 022 ORACLE_SID=bril ORACLE_BASE=/u01 ORACLE_HOME=/u01/oracle PATH=$ORACLE_HOME/bin:$PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib/:$LD_LIBRARY_PATH export ORACLE_SID ORACLE_BASE ORACLE_HOME PATH LD_ASSUME_KERNEL LD_LIBRARY_PATH [oracle@oracle12c ~]$ 3.10 数据库软件安装 3.10.1 解压下载的文件 32 [root@oracle12c ~]# ls -l *.zip -rw-r--r-- 1 root root 1673544724 Sep 1 16:10 linuxamd64_12102_database_1of2.zip -rw-r--r-- 1 root root 1014530602 Sep 1 16:10 linuxamd64_12102_database_2of2.zip [root@oracle12c ~]#unzip linuxamd64_12102_database_1of2.zip [root@oracle12c ~]#unzip linuxamd64_12102_database_2of2.zip [root@oracle12c ~]# chown -R oracle:oinstall database/ [root@oracle12c ~]# ls -l total 8 -rw-------. 1 root root 1678 Aug 31 15:13 anaconda-ks.cfg drwxr-xr-x 7 oracle oinstall 110 Jul 7 2014 database drwxr-xr-x. 2 root root 31 Aug 31 16:13 Desktop drwxr-xr-x. 2 root root 6 Aug 31 15:32 Documents drwxr-xr-x. 2 root root 6 Aug 31 15:32 Downloads -rw-r--r--. 1 root root 1726 Aug 31 15:21 initial-setup-ks.cfg drwxr-xr-x. 2 root root 6 Aug 31 15:32 Music drwxr-xr-x. 2 root root 6 Aug 31 15:32 Pictures drwxr-xr-x. 2 root root 6 Aug 31 15:32 Public drwxr-xr-x. 2 root root 6 Aug 31 15:32 Templates drwxr-xr-x. 2 root root 6 Aug 31 15:32 Videos 3.10.2 安装步骤 切换到oracle用户下执行: [oracle@oracle12c database]$ ./runInstaller 报错解决方法,添加主机名和ip对应关系 [root@oracle12c ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.70.2 oracle12c 33 去掉oracle 支持。点击下一步。 选择只安装数据库软件: 选择单实例安装: 34 语言默认即可: 安装企业版,默认即可 35 选择安装目录,这一步在环境变量中设置一致即可。 安装用户所属的组 36 默认选择组即可: 验证报错,忽略即可。 37 安装汇总,点击安装即可: 38 执行如下脚本: 39 执行结果: [root@oracle12c ~]# cd /u01/app/oraInventory/ [root@oracle12c oraInventory]# ./orainstRoot.sh Changing permissions of /u01/app/oraInventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /u01/app/oraInventory to oinstall. The execution of the script is complete. [root@oracle12c oraInventory]# cd .. [root@oracle12c app]# cd oracle/product/12.1.0/dbhome_1/ [root@oracle12c dbhome_1]# ./root.sh Performing root user operation. The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/product/12.1.0/dbhome_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 ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created 40 Finished running generic part of root script. Now product-specific root actions will be performed. 安装完成如下图: 3.11 创建数据库 3.11.1 安装监听 [oracle@oracle12c bin]$ ./netca 41 点击下一步,添加即可 命名默认即可: 42 协议选择TCP: 端口默认1521即可: 43 不创建其他,点击下一步完成即可 3.11.2 安装数据库 [oracle@oracle12c bin]$ ./dbca 44 选择高级模式进行安装: 数据库类型选择默认: 45 填写数据库SID,和勾选容器数据库,并创建一个PDB: EM配置,默认即可 46 设置统一密码: 监听配置,前面已经完成。 47 配置存储方式和归档模式功能 案例数据库配置,默认即可 48 配置内存,如下图: 49 创建数据库 50 总结开始 51 安装完成 3.11.3 登录数据库 52 [oracle@oracle12c ~]$ sqlplus /nolog SQL*Plus: Release 12.1.0.2.0 Production on Wed Sep 2 09:11:41 2015 Copyright (c) 1982, 2014, Oracle. All rights reserved. SQL> conn / as sysdba Connected. SQL> select dbid,name from v$database; DBID NAME ---------- --------- 1209016324 BRIL SQL> 53 四、 ORACLE 12C新特性介绍 54 因篇幅问题不能全部显示,请点此查看更多更全内容