修改hostname
hostnamectl set-hostname oracle
安装过程
配置yum源:
cd /etc
mv yum.repos.d yum.repos.d.bak
mkdir yum.repos.d
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
安装依赖包
yum -y 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
检查依赖是否安装完整:
rpm -q \
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 | grep "not installed"
添加oracle用户组和用户
groupadd oinstall
groupadd dba
groupadd asmadmin
groupadd asmdba
useradd -g oinstall -G dba,asmdba oracle -d /home/oracle
添加完成后,查看oracle用户
id oracle
初始化密码
passwd oracle
配置hostname(本机IP映射)
vi /etc/hosts
1.1.2.130 oracle
# 测试hostname
ping -c 3 oracle
优化OS内核参数
# kernel.shmmax 参数设置为物理内存的一半
vi /etc/sysctl.conf
## 内容如下:
fs.aio-max-nr=1048576
fs.file-max=6815744
kernel.shmall=2097152
kernel.shmmni=4096
kernel.shmmax = 536870912
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
使参数生效:
sysctl -p
限制oracle用户的shell权限:
···
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
oracle hard stack 10240
vi /etc/pam.d/login
session required /lib64/security/pam_limits.so
session required pam_limits.so
vi /etc/profile
if [ SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
使之生效:
source /etc/profile
···
创建oracle安装目录
···
mkdir -p /db/app/oracle/product/11.2.0
mkdir /db/app/oracle/oradata
mkdir /db/app/oracle/oraInventory
mkdir /db/app/oracle/fast_recovery_area
chown -R oracle:oinstall /db/app/oracle
chmod -R 775 /db/app/oracle
···
创建 vi /etc/oraInst.loc
···
inventory_loc=/db/app/oracle/oraInventory
inst_group=oinstall
···
授权
···
chown oracle:oinstall /etc/oraInst.loc
chmod 664 /etc/oraInst.loc
···
配置oracle用户环境变量
vi .bash_profile
export ORACLE_HOSTNAME=oracle
export ORACLE_BASE=/db/app/oracle
export ORACLE_SID=ORCL
export LC_ALL="en_US"
export LANG="en_US"
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
## 以上配置完成后,建议重启系统 或分别执行以下命令:
source /home/oracle/.bash_profile
env
解压oracle压缩文件到 /db
# 上传linux.x64_11gR2_database_*of2.zip文件至/db/目录;
cd /db/
ls
unzip linux.x64_11gR2_database_1of2.zip -d /db
unzip linux.x64_11gR2_database_2of2.zip -d /db