一、修改配置文件
1.1、修改/etc/security/limits.conf文件,修改用户的SHELL的限制。
输入命令:vi /etc/security/limits.conf,将下列内容加入该文件
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
1.2、修改/etc/pam.d/login 文件。
输入命令:vi /etc/pam.d/login,将下列内容加入该文件
session required /lib64/security/pam_limits.so
session required pam_limits.so
1.3、修改linux内核,修改/etc/sysctl.conf文件。
输入命令: vi /etc/sysctl.conf ,将下列内容加入该文件。
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
并用#符号注释掉原有的配置。
# Controls the maximum shared segment size, in bytes
#kernel.shmmax = 68719476736
# Controls the maximum number of shared memory segments, in pages
#kernel.shmall = 4294967296
输入命令:sysctl -p,使/etc/sysctl.conf配置文件立即生效。
1.4、修改/etc/profile。
输入命令: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
1.5、创建用户和组。
创建用户组oinstall、dba
创建oracle用户,主组为oinstall,副组dba,输入命令:
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba -m oracle
副组的参数是大写G,别弄错,否则安装时会出现错误:
[FATAL] [INS-35341] User is not a member of the following chosen OS groups
设置用户oracle密码,输入两次密码,输入命令:
passwd oracle
1.6、创建数据库软件目录和数据文件存放目录。
mkdir /home/oracle/app
mkdir /home/oracle/app/oracle
mkdir /home/oracle/app/oradata
mkdir /home/oracle/app/oraInventory
mkdir /home/oracle/app/fast_recovery_area
mkdir /home/oracle/app/oracle/product
修改目录权限,更改目录属主为Oracle用户所有,输入命令:
chown -R oracle:oinstall /home/oracle/app
1.7、配置oracle用户的环境变量。
用命令su – oracle切换到oracle用户下。
su - oracle
输入命令:vi .bash_profile,将下列内容加入该文件。
umask 022
export ORACLE_BASE=/home/oracle/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
1.8、上传Oracle安装文件
上传Oracle安装文件到Linux服务器。
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
上传到/tmp目录下面。
1.9、解压安装文件
进入tmp目录,使用unzip命令解压文件。
[root@localhost /]# cd /tmp
[root@localhost tmp]# unzip linux.x64_11gR2_database_1of2.zip
[root@localhost tmp]# unzip linux.x64_11gR2_database_2of2.zip
解压完成后,在tmp目录下会有一个database的文件夹。
1.10、创建/etc/oraInst.loc文件,否则安装时会报错:
SEVERE: [FATAL] [INS-32038] The operating system group specified for central inventory (oraInventory) ownership is invalid.
vi /etc/oraInst.loc
inventory_loc=/home/oracle/app/oraInventory
inst_group=oinstall
1.11、安装未安装的package
yum install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make pdksh sysstat unixODBC unixODBC-devel
二、安装Oracle 11.2产品
Oracle支持静默安装。在我看来,它主要有两方面的好处:一、极大地提升了效率,尤其是批量安装。二、很多时候,只有终端环境可供使用。
2.0、准备responseFile文件
从Oracle软件中获取文件模板
[root@localhost tmp]# cd database/response/
[root@localhost response]# ls
dbca.rsp db_install.rsp netca.rsp
其中database是Oracle软件解压后生成的目录。可见在response目录下有三个模板,其中dbca.rsp是用来创建数据库的。db_install.rsp是用来安装Oracle软件的。netca.rsp是用来创建监听器的。当然也可在db_install.rsp中直接创建数据库。在这里,为求方便,我们选择db_install.rsp模板一并安装软件,创建数据库。
2.1、编辑responseFile文件
[root@localhost response]# vi db_install.rsp
[root@localhost response]# grep -Ev "^$|^#" db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_AND_CONFIG
ORACLE_HOSTNAME=oracle
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/home/oracle/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/home/oracle/app
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.CLUSTER_NODES=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=400
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=1Password
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.dbcontrol.emailAddress=xxxx@xxxx.com
oracle.install.db.config.starterdb.dbcontrol.SMTPServer=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/home/oracle/app/oradata
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/home/oracle/app/fast_recovery_area
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=
DECLINE_SECURITY_UPDATES=true
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
2.3 改用oracle用户登录,静默安装
cd /tmp/database
./runInstaller -silent -ignorePrereq -responseFile /tmp/database/response/db_install.rsp
可以通过查看日志文件,来知晓安装进度。
如果是测试环境的VM可能会出现tmpfs比MEMORY_TARGET小,导致oracle没办法起来。ORA-00845: MEMORY_TARGET not supported on this system。
mount -o remount,size=4G /dev/shm
2.4、启动数据库:
[oracle@oracle ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 6 09:14:24 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> start
SP2-1506: START, @ or @@ command has no arguments
SQL> startup
查看监听器状态:
lsnrctl status
2.5、修改Oracle启动配置文件:
[root@oracle admin]# vi /etc/oratab
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/home/oracle/app/oracle/product/11.2.0/dbhome_1:Y
为了让oracle在系统启动时服务自动启动,修改/etc/rc/loacl文件:
[root@oracle admin]# vi /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
su - oracle -c "/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart"
2.6、打开防火墙端口:
输入命令:vi /etc/sysconfig/iptables编辑防火墙配置:
2.7、创建表空间:
创建临时表空间:
create temporary tablespace user_temp tempfile '/home/oracle/app/oradata/orcl/user_temp.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local;
创建数据表空间:
create tablespace user_data logging datafile '/home/oracle/app/oradata/orcl/user_data.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local;
创建用户并指定表空间:
1
2
3
4
5
6
7
|
SQL> create user mydbuser identified by myDbuser1 default tablespace user_data temporary tablespace user_temp;
User created.
SQL> grant connect ,resource to mydbuser;
Grant succeeded.
|
- •VMware Workstation Pro 16安装CentOS7超详细图文步骤
- •CentOS7下配置使用JumpServer 堡垒机 (图文教程)
- •CentOS安装jdk的几种方法及配置环境变量方式
- •CentOS忘记密码修改方案以及centos卡在开机登录界面,命令失效的解决方法
- •解决笔记本安装centos7后无法调节屏幕亮度
- •VMware安装CentOS 8.1(CentOS 8系列可参考)的图文详细教程
- •CentOS7 minimal 最小化安装网络设置过程
- •CentOS7下搭建JumpServer
- •CentOS安装rpm包出现冲突时的解决办法
- •Vmware下CentOS7最小化安装方式