CentOS7安装Oracle 12C

这篇文章是转载的,讲的很全面了

CentOS7安装Oracle 12C

实验环境: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.

编写关闭服务脚本

chkconfig iptables off  
chkconfig ip6tables off  
chkconfig cups off  
chkconfig firstboot off  
chkconfig wpa_supplicant off  
chkconfig postfix off  
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config  
sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config  
sed -i 's/#UseDNS yes/UseDNS no/' /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作为参考,步骤如下: 官方安装文档说明

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

1. The following packages (or later versions) must be installed:  
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系统下,对其进行安装^footnote.

[root@hyldb package]# vi  rpm.sh
1. rpm -ivh binutils-2.23.52.0.1-16.el7.x86_64.rpm  
2. rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpm  
3. rpm -ivh gcc-4.8.2-16.el7.x86_64.rpm  
4. rpm -ivh gcc-c++-4.8.2-16.el7.x86_64.rpm  
5. rpm -ivh glib2-devel-2.36.3-5.el7.x86_64.rpm  
6. rpm -ivh glibc-2.17-55.el7.x86_64.rpm  
7. rpm -ivh ksh-20120801-19.el7.x86_64.rpm  
8. rpm -ivh libaio-0.3.109-12.el7.x86_64.rpm  
9. rpm -ivh libaio-devel-0.3.109-12.el7.x86_64.rpm  
10. rpm -ivh libgcc-4.8.2-16.el7.x86_64.rpm  
11. rpm -ivh libstdc++-4.8.2-16.el7.x86_64.rpm  
12. rpm -ivh libstdc++-devel-4.8.2-16.el7.x86_64.rpm  
13. rpm -ivh libX11-1.6.0-2.1.el7.x86_64.rpm  
14. rpm -ivh libXau-1.0.8-2.1.el7.x86_64.rpm  
15. rpm -ivh libxcb-1.9-5.el7.x86_64.rpm  
16. rpm -ivh libXext-1.3.2-2.1.el7.x86_64.rpm  
17. rpm -ivh libXtst-1.2.2-2.1.el7.x86_64.rpm  
18. rpm -ivh make-3.82-21.el7.x86_64.rpm  
19. rpm -ivh sysstat-10.1.5-4.el7.x86_64.rpm
[root@hyldb package]# sh  rpm.sh

安装调用图形化需要的包[^footnote2], [^footnote2]:图像化工具千千万,我是用的anydesk

[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 添加用户及相关目录

这个步骤是比较重要的,Oracle的安装不允许在root用户下安装

[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 配置内核参数^footnote3

[root@hyldb /]# vi /etc/sysctl.conf
1. # System default settings live in /usr/lib/sysctl.d/00-system.conf.  
2. # To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file  
3. #  
4. # For more information, see sysctl.conf(5) and sysctl.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 = 250 32000 100 128  
11. net.ipv4.ip_local_port_range = 9000 65500  
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 = 250 32000 100 128  
  7. net.ipv4.ip_local_port_range = 9000 65500  
  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. # End of file  
  2. oracle              soft    nproc   2047  
  3. oracle              hard    nproc   16384  
  4. oracle              soft    nofile  1024  
  5. oracle              hard    nofile  65536
[root@hyldb ~]# vi /etc/pam.d/login
 
  1. session    required     /lib/security/pam_limits.so  
  2. session    required     pam_limits.so  
[root@hyldb ~]# vi /etc/profile

添加以下参数

  1. if [ $USER = "oracle" ]; then  
  2.         if [ $SHELL = "/bin/ksh" ]; then  
  3.               ulimit -p 16384  
  4.               ulimit -n 65536  
  5.         else  
  6.               ulimit -u 16384 -n 65536  
  7.         fi  
  8. fi  

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

环境变量必须要配置,否则安装完Oracle数据库后,好多命令会使用不方便

[root@hyldb /]# su - oracle
[oracle@hyldb ~]$ vi .bash_profile
  1. # .bash_profile  
  2. # Get the aliases and functions  
  3. if [ -f ~/.bashrc ]; then  
  4.         . ~/.bashrc  
  5. fi  
  6. # User specific environment and startup programs  
  7. #PATH=$PATH:$HOME/.local/bin:$HOME/bin  
  8. #export PATH  
  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. export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH  
  15. ~  
  16. ~  
  17. ".bash_profile" 18L, 430C written 
[oracle@hyldb ~]$ source .bash_profile

5.6 安装oracle软件

远程调用图形安装oracle软件 此处使用的X-manager软件

以下出现的错误忽略即可!!![^footnote4] [^footnote4]:我觉得还是尽量把问题都解决掉比较好,根据提示所有的错误和警告都可以完美处理掉

产生这个问题的原因是,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,如下:

手工修正后,继续安装。

[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.

至此,oracle软件安装完成。

5.7 dbca建库

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

[oracle@hyldb ~]$ xhost +
access control disabled, clients can connect from any host
[oracle@hyldb ~]$ dbca

5.8 配置监听

[oracle@hyldb ~]$ netca

验证监听状态,如下:

[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

简单演示:

[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完成。

转载于:https://my.oschina.net/junehappylove/blog/853852

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值