有志者事竟成 破釜沉舟百二秦关终属楚 苦心人天不负 卧薪尝胆三千越甲可吞吴
这次安装oracle可谓是一路坎坷...再此记录一下,以后按照这个来,少走弯路吧
- 系统环境与安装介质说明
系统环境
[root@oracledb admin]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.6 (Santiago)
Release: 6.6
Codename: Santiago
安装介质 oracle
Release 11.2.0.3.0 Production on Tue Jan 16 06:17:30 2018
Copyright (c) 1982, 2011, Oracle. All rights reserved. - 准备工作
1 修改hosts 文件
[root@oracledb oraclesoft]# vi /etc/hosts
127.0.0.1 oracledb
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.254.104 oracledb
2 修改主机名
[root@oracledb oraclesoft]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=oracledb
或使用hostname命令来修改(重启服务器后将失效)
3 修改内核参数
[root@oracledb ]# vi /etc/sysctl.conf
文件末尾添加如下内容以下
fs.suid_dumpable = 1
fs.aio-max-nr = 1048576 --文件系统最大异步io
fs.file-max = 6815744 --文件系统中最大文件个数
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096 --最小共享内存大小 bytes
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
修改完成后执行: /sbin/sysctl -p 命令
4 修改 /etc/security/limits.conf 文件
[root@oracledb ]# vi /etc/security/limits.conf
在文件末尾添加
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
5 添加oracle用户组
[root@oracledb ]# groupadd oinstall
[root@oracledb ]# groupadd dba
[root@oracledb ]# useradd -g oinstall -G dba oracle
修改oracle用户密码
passwd oracle
6 创建目录与授权
[root@oracledb ]# mkdir -p /u01/app/oracle/product/11.2.0/db_1
[root@oracledb ]# chown -R oracle:oinstall /u01/app/oracle
[root@oracledb ]# chmod -R 775 /u01
7 添加oracle 环境变量
切换用户
[root@oracledb ]# su - oracle
[oracle@oracledb ~] vi .bash_profile
在文件末尾添加以下内容
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin
export TMP=/tmp
export TMPDIR=$TMP
umask 022 - 安装oracle
1 检查依赖(root用户执行)
[root@oracledb oraclesoft]# rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel
binutils-2.20.51.0.2-5.42.el6.x86_64
compat-libstdc++-33-3.2.3-69.el6.x86_64
elfutils-libelf-0.158-3.2.el6.x86_64
elfutils-libelf-devel-0.164-2.el6.x86_64
gcc-4.4.7-11.el6.x86_64
gcc-c++-4.4.7-11.el6.x86_64
glibc-2.12-1.149.el6.x86_64
glibc-common-2.12-1.149.el6.x86_64
glibc-devel-2.12-1.149.el6.x86_64
glibc-headers-2.12-1.149.el6.x86_64
kernel-headers-2.6.32-504.el6.x86_64
package ksh is not installed
libaio-0.3.107-10.el6.x86_64
libaio-devel-0.3.107-10.el6.x86_64
libgcc-4.4.7-11.el6.x86_64
libgomp-4.4.7-11.el6.x86_64
libstdc++-4.4.7-11.el6.x86_64
libstdc++-devel-4.4.7-11.el6.x86_64
make-3.81-20.el6.x86_64
package numactl-devel is not installed
sysstat-9.0.4-20.el6.x86_64
package unixODBC is not installed
package unixODBC-devel is not installed
xxxxxxx-------is not installed 说明此包未安装
可通过yum -y xxxx(包名)来安装
或者去其他网站下载rpm包,使用rpm -ivh xxxx(包名)来安装
2 修改响应文件模板
找到软件包,解压
解压后进入database---》response 目录下有三个文件(这里注意,一定是database目录下的response,而不是其他目录)
修改db_install.rsp文件(参照以下文件进行修改)
https://pan.baidu.com/s/1eTwZ80E
3 修改完成后执行
[oracle@oracledb database]$ ./runInstaller -ignorePrereq -silent -responseFile /opt/oraclesoft/database/response/db_install.rsp
database/response/
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 344984 MB Passed
Checking swap space: must be greater than 150 MB. Actual 15999 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-01-11_09-02-41PM. Please wait ...[oracle@localhost database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
CAUSE: The Central Inventory is located in the Oracle base.
ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
You can find the log of this install session at:
/u01/app/oracle/oraInventory/logs/installActions2018-01-11_09-02-41PM.log
The installation of Oracle Database 11g was successful.
Please check '/u01/app/oracle/oraInventory/logs/silentInstall2018-01-11_09-02-41PM.log' for more details.
As a root user, execute the following script(s):
1./u01/app/oracle/oraInventory/orainstRoot.sh
2./u01/app/oracle/product/11.2.0/db_1/root.sh
Successfully Setup Software.
切换root用户,执行上一步骤1.2 两个脚本,执行完成后,及安装成功
测试
[oracle@oracledb database]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Jan 16 08:06:09 2018
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
SQL> - 创建oracle 实例
1 .修改安装介质 database---》response目录下dbca.rsp 文件
可参照以下文件进行修改
https://pan.baidu.com/s/1kVXgVwN
2 .修改完成后执行
[oracle@oracledb ~]$ dbca -silent -responseFile /opt/oraclesoft/database/response/dbca.rsp
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
至此,数据库实例创建完成,在此步骤中,由于主机名问题,导致了一堆问题,在此标记 问题诸多,安装过程中未作记录,如有按本教程操作的同学遇到问题请咨询QQ844357411 - 配置监听
1 创建监听文件,
[oracle@oracledb admin]$ cd /u01/app/oracle/product/11.2.0/db_1/network/admin/
在samples文件夹下有个listener.ora文件,将其复制到/u01/app/oracle/product/11.2.0/db_1/network/admin/目录下
[oracle@oracledb admin]$ cp listener.ora /u01/app/oracle/product/11.2.0/db_1/network/admin/
- 修改文件内容
[oracle@oracledb admin]$ vi /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
LISTENER =
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
#BEQUEATH CONFIG
(GLOBAL_DBNAME=orcl)
(SID_NAME=orcl)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
#PRESPAWN CONFIG
(PRESPAWN_MAX=20)
(PRESPAWN_LIST=
(PRESPAWN_DESC=(PROTOCOL=tcp)(POOL_SIZE=2)(TIMEOUT=1))
)
)
)
3.修改完成后执行命令: netca -silent -responsefile /opt/oraclesoft/database/response/netca.rsp - 启动监听
[oracle@oracledb bin]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 16-JAN-2018 05:25:28
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 16-JAN-2018 05:25:28
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oracledb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracledb)(PORT=1521)))
The listener supports no services
The command completed successfully
至此,所有工作已完成
若有疑问,请加QQ844357411进行咨询