一 软件环境
- VirtualBox 5.2
- Oracle Linux 6.5
- Oracle 12.2.0.1
二 安装Oracle软件
1 内存要求
安装Oracle 12c,内存至少是1GB,建议在2GB以上。
2 SWAP和内存关系
- 1G~2G:1.5倍内存
- 2G~16G:等于内存
- >16G:16G
3 磁盘空间要求
企业版:至少7.5GB
标准版2:至少7.5GB
4 设置主机名称
[root@strong ~]# vim /etc/hosts --添加下面一行记录
192.168.56.102 strong.oracle.com
5 配置网络地址(已配置则不须配置)
[root@strong ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
HWADDR=08:00:27:57:D5:37
TYPE=Ethernet
BOOTPROTO=none
IPADDR=192.168.56.102
PREFIX=24
GATEWAY=192.168.56.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=eth0
UUID=8cba21ce-4059-4d18-a766-022194011e41
ONBOOT=yes
LAST_CONNECT=1531314941
6 配置本地YUM源(安装Linux时已配置,这里不必配置)
配置本地YUM源,为安装Oracle 12c所需的rpm做准备
[root@strong ~]# mount /dev/cdrom /mnt/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@strong ~]# cd /etc/yum.repos.d/
[root@strong yum.repos.d]# ll
total 8
-rw-r--r--. 1 root root 109 Jul 11 21:22 packagekit-media.repo
-rw-r--r--. 1 root root 2545 May 4 08:24 public-yum-ol6.repo
[root@strong yum.repos.d]# mv packagekit-media.repo packagekit-media.repo.bak
[root@strong yum.repos.d]# mv public-yum-ol6.repo public-yum-ol6.repo.bak
[root@strong yum.repos.d]# vim server.repo
[server]
name=Oracle Linux
baseurl=file:///mnt/
gpgcheck=0
enabled=1
[root@strong yum.repos.d]# yum clean all
Loaded plugins: refresh-packagekit, security
Cleaning repos: server
Cleaning up Everything
[root@strong yum.repos.d]# yum list
7 安装Oracle 12c所需的Package
下面的Packages时安装Oracle 12c所需的,利用yum install 进行安装。
bc
binutils-2.20.51.0.2-5.36.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (i686)
e2fsprogs-1.41.12-14.el6 (x86_64)
e2fsprogs-libs-1.41.12-14.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (i686)
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (i686)
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6 (i686)
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6 (i686)
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6 (i686)
libXtst-1.0.99.2 (x86_64)
libXtst-1.0.99.2 (i686)
libX11-1.5.0-4.el6 (i686)
libX11-1.5.0-4.el6 (x86_64)
libXau-1.0.6-4.el6 (i686)
libXau-1.0.6-4.el6 (x86_64)
libxcb-1.8.1-1.el6 (i686)
libxcb-1.8.1-1.el6 (x86_64)
libXi-1.3 (x86_64)
libXi-1.3 (i686)
make-3.81-19.el6
net-tools-1.60-110.el6_2.x86_64 (for Oracle RAC and Oracle Clusterware)
nfs-utils-1.2.3-15.0.1 (for Oracle ACFS)
sysstat-9.0.4-11.el6 (x86_64)
smartmontools-5.43-1.el6.x86_64
或者利用下面的方式进行安装:
yum -y install binutils compat-libcap1 compat-libstdc* gcc gcc-c++* glibc glibc-devel ksh libgcc libstdc libaio libaio-devel make elfutils-libelf-devel sysstat
8 创建Oracle用户和组
1)安装组
[root@strong ~]# groupadd oinstall
2)标准组
[root@strong ~]# groupadd dba
[root@strong ~]# groupadd oper
3)扩展组
backupdba、dgdba、kmdba、racdba
4)用户
[root@strong ~]# useradd -g oinstall -G dba,oper oracle
[root@strong ~]# passwd oracle
Changing password for user oracle.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
9 配置内核参数
[root@strong ~]# vim /etc/sysctl.conf --增加以下内容
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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 = 1048576
[root@strong ~]# sysctl -p --使参数生效
[root@strong ~]# vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
10 创建目录
[root@strong ~]# mkdir /u01/app
[root@strong ~]# chown -R oracle:oinstall /u01/
[root@strong ~]# chmod -R 775 /u01/
11 配置Oracle用户环境变量
[root@strong ~]# su - oracle --切换至Oracle用户
[oracle@strong ~]$ vim .bash_profile --增加以下内容
ORACLE_BASE=/u01/app/oracle
ORACLE_SID=orcl
export ORACLE_BASE ORACLE_SID
export ORACLE_TERM=xterm
[oracle@strong ~]$ . .bash_profile
[oracle@strong ~]$ echo $ORACLE_SID
orcl
12 准备Oracle数据库软件
1)创建目录存放Oracle软件
[oracle@strong ~]$ mkdir /u01/soft
2)上传Oracle安装软件(略)
3)查看/u01/soft目录
[oracle@strong ~]$ cd /u01/soft/
[oracle@strong soft]$ ll -h
total 3.3G
-rw-r--r--. 1 oracle oinstall 3.3G Jul 11 22:12 linuxx64_12201_database.zip
4)解压缩Oracle数据库软件
[oracle@strong soft]$ unzip linuxx64_12201_database.zip
5)查看解压后的文件
[oracle@strong soft]$ ll -h
total 3.3G
drwxr-xr-x. 7 oracle oinstall 4.0K Jan 27 2017 database
-rw-r--r--. 1 oracle oinstall 3.3G Jul 11 22:12 linuxx64_12201_database.zip
三 Oracle软件安装
1 在root下执行
[root@strong ~]# xhost +
2 切换到下面目录进行安装
[oracle@strong ~]$ cd /u01/soft/database/
[oracle@strong database]$ ll
total 36
drwxr-xr-x. 4 oracle oinstall 4096 Jan 26 2017 install
drwxrwxr-x. 2 oracle oinstall 4096 Jan 26 2017 response
drwxr-xr-x. 2 oracle oinstall 4096 Jan 26 2017 rpm
-rwxr-xr-x. 1 oracle oinstall 8771 Jan 26 2017 runInstaller
drwxrwxr-x. 2 oracle oinstall 4096 Jan 26 2017 sshsetup
drwxr-xr-x. 14 oracle oinstall 4096 Jan 26 2017 stage
-rwxr-xr-x. 1 oracle oinstall 500 Feb 7 2013 welcome.html
[oracle@strong database]$ ./runInstaller
3 安装详细步骤
1)配置安全更新页,输入Email和My Oracle Support Password,在此去掉勾选,点击Next;
2)在选择安装选项页,有三种选项,在此选择Install database software only,并点击Next进入下一页;
3)在数据库安装选项页,选择Single instance database installation,并点击Next进入下一页;
4)在选择数据库版本页,选择Enterprise Edition,点击Next;
5)在指定安装位置页,默认,并点击Next;
6)在创建安装库位置,默认,并点击Next;
7)在授权的操作系统组页,默认,并点击Next;
注:由于没有配置扩展组,故除dba和oper外,其他都默认为dba组。
8)在执行先决条件检查页,检查通过出现概要页,点击Install;
9)在安装产品页,进行软件安装;
安装快结束时出现执行root脚本页面,执行root脚本;
注:务必在root用户下执行,并在执行完毕后点击OK。
[root@strong ~]# /u01/app/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@strong ~]# /u01/app/oracle/product/12.2.0/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.2.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
Finished running generic part of root script.
Now product-specific root actions will be performed.
Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] :
Oracle Trace File Analyzer (TFA - User Mode) is available at :
/u01/app/oracle/product/12.2.0/dbhome_1/suptools/tfa/release/tfa_home/bin/tfactl
OR
Oracle Trace File Analyzer (TFA - Daemon Mode) can be installed by running this script :
/u01/app/oracle/product/12.2.0/dbhome_1/suptools/tfa/release/tfa_home/install/roottfa.sh
10)安装完成,点击Close;
11)完善环境变量配置,完成Oracle 12c软件安装。
[oracle@strong ~]$ vim .bash_profile --增加以下两行内容
export ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
[oracle@strong ~]$ . .bash_profile
[oracle@strong ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/12.2.0/dbhome_1
至此,Oracle数据库软件的安装完成,下面将介绍如何利用Netmgr配置监听和TNS。