CentOS7安装Oracle 12C

分类:CentOS运维 阅读:2644 次

实验环境:Oracle VM VirtualBox 4.2.12

操作系统:CentOS 7(LINUX7)64bit

数据库:Oracle 12C 64bit

实验目标:熟悉LINUX7下安装Oracle12C

操作演示:

(1)、安装Linux7操作系统

(2)、官网下载oracle软件包

(3)、下载oracle12C官方文档

(4)、上传oracle软件包至linux操作系统下

(5)、安装oracle

5.1主机配置

--根据经验,关闭一些无用的服务,否则安装时可能会出现某些错误

#vi serverstop.sh

--编写关闭服务脚本

  1. chkconfigiptablesoff
  2. chkconfigip6tablesoff
  3. chkconfigcupsoff
  4. chkconfigfirstbootoff
  5. chkconfigwpa_supplicantoff
  6. chkconfigpostfixoff
  7. sed-i's/SELINUX=enforcing/SELINUX=disabled/'/etc/selinux/config
  8. sed-i's/^GSSAPIAuthenticationyes$/GSSAPIAuthenticationno/'/etc/ssh/sshd_config
  9. sed-i's/#UseDNSyes/UseDNSno/'/etc/ssh/sshd_config
#sh serverstop.sh

--执行关闭服务脚本

5.2安装包

解压安装包

[root@hyldb /]# cd /software

[root@hyldb software]# ls

linuxamd64_12c_database_1of2.zip linuxamd64_12c_database_2of2.zip

[root@hyldb software]# unzip linuxamd64_12c_database_1of2.zip

[root@hyldb software]# unzip linuxamd64_12c_database_2of2.zip

查看官方文档,没有找到LINUX7需安装包的文档,找到了LINUX6需要安装的包,以LINUX6作为参考,步骤如下:

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

在系统光盘中,按要求找到需要的包,下面是文档中要求安装的64位的相关包:

  1. Thefollowingpackages(orlaterversions)mustbeinstalled:
  2. binutils-2.20.51.0.2-5.11.el6(x86_64)
  3. compat-libcap1-1.10-1(x86_64)
  4. compat-libstdc++-33-3.2.3-69.el6(x86_64)
  5. gcc-4.4.4-13.el6(x86_64)
  6. gcc-c++-4.4.4-13.el6(x86_64)
  7. glibc-2.12-1.7.el6(x86_64)
  8. glibc-devel-2.12-1.7.el6(x86_64)
  9. ksh
  10. libgcc-4.4.4-13.el6(x86_64)
  11. libstdc++-4.4.4-13.el6(i686)
  12. libstdc++-devel-4.4.4-13.el6(x86_64)
  13. libaio-0.3.107-10.el6(x86_64)
  14. libaio-devel-0.3.107-10.el6(x86_64)
  15. libXext-1.1(x86_64)
  16. libXtst-1.0.99.2(x86_64)
  17. libX11-1.3(x86_64)
  18. libXau-1.0.5(x86_64)
  19. libxcb-1.5(x86_64)
  20. libXi-1.3(x86_64)
  21. make-3.81-19.el6
  22. sysstat-9.0.4-11.el6(x86_64)

将找到的包上传到linux系统下,对其进行安装

[root@hyldb package]# vi rpm.sh

  1. rpm-ivhbinutils-2.23.52.0.1-16.el7.x86_64.rpm
  2. rpm-ivhcompat-libcap1-1.10-7.el7.x86_64.rpm
  3. rpm-ivhgcc-4.8.2-16.el7.x86_64.rpm
  4. rpm-ivhgcc-c++-4.8.2-16.el7.x86_64.rpm
  5. rpm-ivhglib2-devel-2.36.3-5.el7.x86_64.rpm
  6. rpm-ivhglibc-2.17-55.el7.x86_64.rpm
  7. rpm-ivhksh-20120801-19.el7.x86_64.rpm
  8. rpm-ivhlibaio-0.3.109-12.el7.x86_64.rpm
  9. rpm-ivhlibaio-devel-0.3.109-12.el7.x86_64.rpm
  10. rpm-ivhlibgcc-4.8.2-16.el7.x86_64.rpm
  11. rpm-ivhlibstdc++-4.8.2-16.el7.x86_64.rpm
  12. rpm-ivhlibstdc++-devel-4.8.2-16.el7.x86_64.rpm
  13. rpm-ivhlibX11-1.6.0-2.1.el7.x86_64.rpm
  14. rpm-ivhlibXau-1.0.8-2.1.el7.x86_64.rpm
  15. rpm-ivhlibxcb-1.9-5.el7.x86_64.rpm
  16. rpm-ivhlibXext-1.3.2-2.1.el7.x86_64.rpm
  17. rpm-ivhlibXtst-1.2.2-2.1.el7.x86_64.rpm
  18. rpm-ivhmake-3.82-21.el7.x86_64.rpm
  19. rpm-ivhsysstat-10.1.5-4.el7.x86_64.rpm

[root@hyldb package]#shrpm.sh

安装调用图形化需要的包,使用yum安装下面的包

[root@hyldb yum.repos.d]# yum -y install unixODBC

[root@hyldb yum.repos.d]# yum -y install unixODBC-devel

[root@hyldb scripts]# yum install -y xterm

--xterm这是调用图形化用的包

5.3添加用户及相关目录

[root@hyldb /]# groupadd oinstall

[root@hyldb /]# groupadd dba

[root@hyldb /]# useradd -g oinstall -G dba oracle

[root@hyldb /]# 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.

[root@hyldb /]# id oracle

uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba)

[root@hyldb /]# mkdir -p /u01/app/oracle/product/12.1.0/db_1

[root@hyldb /]# mkdir -p /u01/app/oraInventory

[root@hyldb /]# chown -R oracle:oinstall /u01/app

[root@hyldb /]# chmod -R 775 /u01/app

5.4配置内核参数

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

[root@hyldb /]# vi /etc/sysctl.conf

  1. #Systemdefaultsettingslivein/usr/lib/sysctl.d/00-system.conf.
  2. #Tooverridethosesettings,enternewsettingshere,orinan/etc/sysctl.d/<name>.conffile
  3. #
  4. #Formoreinformation,seesysctl.conf(5)andsysctl.d(5).
  5. fs.aio-max-nr=1048576
  6. fs.file-max=6815744
  7. kernel.shmall=2097152
  8. kernel.shmmax=4294967295
  9. kernel.shmmni=4096
  10. kernel.sem=25032000100128
  11. net.ipv4.ip_local_port_range=900065500
  12. net.core.rmem_default=262144
  13. net.core.rmem_max=4194304
  14. net.core.wmem_default=262144
  15. net.core.wmem_max=1048576
  16. ~

[root@hyldb /]# sysctl -p

  1. fs.aio-max-nr=1048576
  2. fs.file-max=6815744
  3. kernel.shmall=2097152
  4. kernel.shmmax=4294967295
  5. kernel.shmmni=4096
  6. kernel.sem=25032000100128
  7. net.ipv4.ip_local_port_range=900065500
  8. net.core.rmem_default=262144
  9. net.core.rmem_max=4194304
  10. net.core.wmem_default=262144
  11. net.core.wmem_max=1048576

--修改系统限制

[root@hyldb ~]# vi /etc/security/limits.conf

  1. #Endoffile
  2. oraclesoftnproc2047
  3. oraclehardnproc16384
  4. oraclesoftnofile1024
  5. oraclehardnofile65536

[root@hyldb ~]# vi /etc/pam.d/login

  1. sessionrequired/lib/security/pam_limits.so
  2. sessionrequiredpam_limits.so

[root@hyldb ~]# vi /etc/profile

--添加以下参数

  1. if[$USER="oracle"];then
  2. if[$SHELL="/bin/ksh"];then
  3. ulimit-p16384
  4. ulimit-n65536
  5. else
  6. ulimit-u16384-n65536
  7. fi
  8. fi

5.5切换到oracle用户下,配置环境变量

[root@hyldb /]# su - oracle

[oracle@hyldb ~]$ vi .bash_profile

  1. #.bash_profile
  2. #Getthealiasesandfunctions
  3. if[-f~/.bashrc];then
  4. .~/.bashrc
  5. fi
  6. #Userspecificenvironmentandstartupprograms
  7. #PATH=$PATH:$HOME/.local/bin:$HOME/bin
  8. #exportPATH
  9. ORACLE_BASE=/u01/app/oracle
  10. ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
  11. ORACLE_SID=shenlan
  12. PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
  13. LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
  14. exportORACLE_BASEORACLE_HOMEORACLE_SIDPATHLD_LIBRARY_PATH
  15. ~
  16. ~
  17. ".bash_profile"18L,430Cwritten

[oracle@hyldb ~]$ source .bash_profile

5.6安装oracle软件

远程调用图形安装oracle软件

此处使用的X-manager软件

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

以下出现的错误忽略即可!!!

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

产生这个问题的原因是,12c的第一版本,还不支持linux7,因此需要手工解决这个问题。

[root@hyldb stubs]# cd /u01/app/oracle/product/12.1.0/db_1/lib/stubs

[root@hyldb stubs]# cp * /bak

[root@hyldb bak]# rm -rf /u01/app/oracle/product/12.1.0/db_1/lib/stubs/*

[root@hyldb bak]# cp /u01/app/oracle/product/12.1.0/db_1/rdbms/lib/env_rdbms.mk /u01/app/oracle/product/12.1.0/db_1/rdbms/lib/env_rdbms.mk.orig

[root@hyldb bak]# vi /u01/app/oracle/product/12.1.0/db_1/rdbms/lib/env_rdbms.mk

176行

修改前:

LINKTTLIBS=$(LLIBCLNTSH) $(ORACLETTLIBS) $(LINKLDLIBS)

修改后:

LINKTTLIBS=$(LLIBCLNTSH) $(ORACLETTLIBS) $(LINKLDLIBS) -lons

279-280行

修改前:

LINK=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS) $(COMPSOBJS)

LINK32=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS32) $(COMPSOBJS)

修改后:

LINK=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS) $(COMPSOBJS) -Wl,--no-as-needed

LINK32=$(FORT_CMD) $(PURECMDS) $(ORALD) $(LDFLAGS32) $(COMPSOBJS) -Wl,--no-as-needed

3041-3042行

修改前:

TG4PWD_LINKLINE= $(LINK) $(OPT) $(TG4PWDMAI) \

$(LLIBTHREAD) $(LLIBCLNTSH) $(LINKLDLIBS)

修改后:

TG4PWD_LINKLINE= $(LINK) $(OPT) $(TG4PWDMAI) \

$(LLIBTHREAD) $(LLIBCLNTSH) $(LINKLDLIBS) -lnnz12

修改后,点击Retry,如下:

CentOS7安装Oracle 12C

手工修正后,继续安装。

CentOS7安装Oracle 12C

[root@hyldb bak]# /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@hyldb bak]# /u01/app/oracle/product/12.1.0/db_1/root.sh

Performing root user operation for Oracle 12c

The following environment variables are set as:

ORACLE_OWNER= oracle

ORACLE_HOME= /u01/app/oracle/product/12.1.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 ...

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.

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

至此,oracle软件安装完成。

5.7 dbca建库

使用X-manager调用图形化界面。

[oracle@hyldb ~]$ xhost +

access control disabled, clients can connect from any host

[oracle@hyldb ~]$ dbca

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

5.8配置监听

[oracle@hyldb ~]$ netca

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

验证监听状态,如下:

[oracle@hyldb ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 12-APR-2015 17:12:03

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hyldb)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production

Start Date 12-APR-2015 17:03:10

Uptime 0 days 0 hr. 8 min. 54 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora

Listener Log File /u01/app/oracle/diag/tnslsnr/hyldb/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hyldb)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=hyldb)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/shenlan/xdb_wallet))(Presentation=HTTP)(Session=RAW))

Services Summary...

Service "shenlan" has 1 instance(s).

Instance "shenlan", status READY, has 1 handler(s) for this service...

Service "shenlanXDB" has 1 instance(s).

Instance "shenlan", status READY, has 1 handler(s) for this service...

The command completed successfully

5.9配置Net Configuration Assistant

[oracle@hyldb ~]$ netca

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

CentOS7安装Oracle 12C

简单演示:

[oracle@hyldb ~]$ sqlplus scott/tiger@localdb

SQL*Plus: Release 12.1.0.1.0 Production on Sun Apr 12 17:14:44 2015

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

Last Successful login time: Sun Apr 12 2015 17:10:20 +08:00

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>

关于Net Configuration Assistant的配置一般是在客户端进行配置,此处只作为一种演示。

至此,在LINUX7下安装Oracle12C完成。

原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。

深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/45021171