Step‑by‑Step Guide to Installing Oracle 12c Database on Linux
This article provides a comprehensive, ordered tutorial for preparing the environment, configuring the root and oracle users, adjusting kernel and system limits, and finally installing and initializing Oracle 12c on a Linux server using detailed command‑line instructions.
This guide walks through the complete process of installing Oracle 12c (version 12.1.0.2) on a Linux host.
1. Preparation
版本: oracle12c-12.1.0.2
下载链接: http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html?ssSourceSiteId=ocomen
linuxamd64_12102_database_1of2.zip
linuxamd64_12102_database_2of2.zip
# 上传到 /tmp 目录并解压后删除压缩包
# 修改主机名和 /etc/hosts 文件2. root User Configuration
# 检查所需的软件包
rpm -q binutils compat-libcap1 compat-libstdc++ gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
# 添加组和用户
groupadd oinstall # 添加组 oinstall
groupadd dba # 添加组 dba
useradd -g oinstall -G dba oracle # 添加 oracle 用户并加入 dba 组
echo "oracle" | passwd --stdin oracle # 设置 oracle 用户密码3. Modify Kernel Parameters
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 1717986918
kernel.shmmax = 2147483648 # 根据错误提示可调整,RHEL7.2 约为 4xxxxxx
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 = 1048586
# 参数报错时根据提示修改即可
sysctl -p # 使参数生效
sysctl -a # 查看所有参数4. Modify limits File
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 655365. Modify pam.d/login
session required /lib/security/pam_limits.so
session required pam_limits.so6. Oracle User Environment Configuration
# 设置环境变量
vi .bash_profile
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=oracle12c
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
echo "PATH=\$PATH:\$HOME/bin:\$ORACLE_HOME/bin:\$ORACLE_HOME/lib:\$ORACLE_HOME/lib64" >> .bash_profile
echo -e "LD_LIBRARY_PATH=\$ORACLE_HOME/bin:/usr/bin" >> .bash_profile
echo -e "export ORACLE_HOME=\$ORACLE_BASE/product/12c" >> .bash_profile
# 添加登录时的 if 语句
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
source ~/.bash_profile # 立即生效7. Install Oracle
# 确认所需软件包已安装(同第 2 步的 rpm -q 列表)
# 重启机器后,以 oracle 用户登录,语言选择 English进入解压后的 database 目录,执行 ./runInstaller 开始安装。
安装完成后,使用以下命令启动监听并登录数据库:
lsnrctl start # 启动监听程序
sqlplus / as sysdba # 以 sysdba 身份连接数据库The screenshots in the original article illustrate the graphical installer steps and successful connection screens.
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.