原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。
深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/45021171
实验环境: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
--编写关闭服务脚本
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位的相关包:
The following packages (or later versions) must be installed: binutils-2.20.51.0.2-5.11.el6 (x86_64) compat-libcap1-1.10-1 (x86_64) compat-libstdc++-33-3.2.3-69.el6 (x86_64) gcc-4.4.4-13.el6 (x86_64) gcc-c++-4.4.4-13.el6 (x86_64) glibc-2.12-1.7.el6 (x86_64) glibc-devel-2.12-1.7.el6 (x86_64) ksh libgcc-4.4.4-13.el6 (x86_64) libstdc++-4.4.4-13.el6 (i686) libstdc++-devel-4.4.4-13.el6 (x86_64) libaio-0.3.107-10.el6 (x86_64) libaio-devel-0.3.107-10.el6 (x86_64) libXext-1.1 (x86_64) libXtst-1.0.99.2 (x86_64) libX11-1.3 (x86_64) libXau-1.0.5 (x86_64) libxcb-1.5 (x86_64) libXi-1.3 (x86_64) make-3.81-19.el6 sysstat-9.0.4-11.el6 (x86_64)
将找到的包上传到linux系统下,对其进行安装
[root@hyldb package]# vi rpm.sh
rpm -ivh binutils-2.23.52.0.1-16.el7.x86_64.rpm rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpm rpm -ivh gcc-4.8.2-16.el7.x86_64.rpm rpm -ivh gcc-c++-4.8.2-16.el7.x86_64.rpm rpm -ivh glib2-devel-2.36.3-5.el7.x86_64.rpm rpm -ivh glibc-2.17-55.el7.x86_64.rpm rpm -ivh ksh-20120801-19.el7.x86_64.rpm rpm -ivh libaio-0.3.109-12.el7.x86_64.rpm rpm -ivh libaio-devel-0.3.109-12.el7.x86_64.rpm rpm -ivh libgcc-4.8.2-16.el7.x86_64.rpm rpm -ivh libstdc++-4.8.2-16.el7.x86_64.rpm rpm -ivh libstdc++-devel-4.8.2-16.el7.x86_64.rpm rpm -ivh libX11-1.6.0-2.1.el7.x86_64.rpm rpm -ivh libXau-1.0.8-2.1.el7.x86_64.rpm rpm -ivh libxcb-1.9-5.el7.x86_64.rpm rpm -ivh libXext-1.3.2-2.1.el7.x86_64.rpm rpm -ivh libXtst-1.2.2-2.1.el7.x86_64.rpm rpm -ivh make-3.82-21.el7.x86_64.rpm rpm -ivh sysstat-10.1.5-4.el7.x86_64.rpm
[root@hyldb package]# sh rpm.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 配置内核参数
[root@hyldb /]# vi /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). fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 4294967295 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@hyldb /]# sysctl -p
fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 4294967295 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@hyldb ~]# vi /etc/security/limits.conf
# End of file oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536
[root@hyldb ~]# vi /etc/pam.d/login
session required /lib/security/pam_limits.so session required pam_limits.so
[root@hyldb ~]# vi /etc/profile
--添加以下参数
if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi
5.5 切换到oracle用户下,配置环境变量
[root@hyldb /]# su - oracle
[oracle@hyldb ~]$ vi .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 ORACLE_BASE=/u01/app/oracle ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1 ORACLE_SID=shenlan PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH ~ ~ ".bash_profile" 18L, 430C written
[oracle@hyldb ~]$ source .bash_profile
5.6 安装oracle软件
远程调用图形安装oracle软件
此处使用的X-manager软件
以下出现的错误忽略即可!!!
产生这个问题的原因是,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完成。
原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。
深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/45021171