Databases 5 min read

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.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Step‑by‑Step Guide to Installing Oracle 12c Database on Linux

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</code>
<code>下载链接: http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html?ssSourceSiteId=ocomen</code>
<code>linuxamd64_12102_database_1of2.zip</code>
<code>linuxamd64_12102_database_2of2.zip</code>
<code># 上传到 /tmp 目录并解压后删除压缩包</code>
<code># 修改主机名和 /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</code>
<code># 添加组和用户
groupadd oinstall   # 添加组 oinstall
groupadd dba        # 添加组 dba
useradd -g oinstall -G dba oracle   # 添加 oracle 用户并加入 dba 组</code>
<code>echo "oracle" | passwd --stdin oracle   # 设置 oracle 用户密码

3. Modify Kernel Parameters

fs.aio-max-nr = 1048576</code>
<code>fs.file-max = 6815744</code>
<code>kernel.shmall = 1717986918</code>
<code>kernel.shmmax = 2147483648   # 根据错误提示可调整,RHEL7.2 约为 4xxxxxx</code>
<code>kernel.shmmni = 4096</code>
<code>kernel.sem = 250 32000 100 128</code>
<code>net.ipv4.ip_local_port_range = 9000 65500</code>
<code>net.core.rmem_default = 262144</code>
<code>net.core.rmem_max = 4194304</code>
<code>net.core.wmem_default = 262144</code>
<code>net.core.wmem_max = 1048586</code>
<code># 参数报错时根据提示修改即可</code>
<code>sysctl -p   # 使参数生效</code>
<code>sysctl -a   # 查看所有参数

4. Modify limits File

oracle soft nproc 2047</code>
<code>oracle hard nproc 16384</code>
<code>oracle soft nofile 1024</code>
<code>oracle hard nofile 65536

5. Modify pam.d/login

session required /lib/security/pam_limits.so</code>
<code>session required pam_limits.so

6. Oracle User Environment Configuration

# 设置环境变量
vi .bash_profile</code>
<code>umask 022</code>
<code>export ORACLE_BASE=/u01/app/oracle</code>
<code>export ORACLE_SID=oracle12c</code>
<code>export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"</code>
<code>echo "PATH=\$PATH:\$HOME/bin:\$ORACLE_HOME/bin:\$ORACLE_HOME/lib:\$ORACLE_HOME/lib64" >> .bash_profile</code>
<code>echo -e "LD_LIBRARY_PATH=\$ORACLE_HOME/bin:/usr/bin" >> .bash_profile</code>
<code>echo -e "export ORACLE_HOME=\$ORACLE_BASE/product/12c" >> .bash_profile</code>
<code># 添加登录时的 if 语句
if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/ksh" ]; then
    ulimit -p 16384
    ulimit -n 65536
  else
    ulimit -u 16384 -n 65536
  fi
fi</code>
<code>source ~/.bash_profile   # 立即生效

7. Install Oracle

# 确认所需软件包已安装(同第 2 步的 rpm -q 列表)</code>
<code># 重启机器后,以 oracle 用户登录,语言选择 English

进入解压后的 database 目录,执行 ./runInstaller 开始安装。

安装完成后,使用以下命令启动监听并登录数据库:

lsnrctl start   # 启动监听程序</code>
<code>sqlplus / as sysdba   # 以 sysdba 身份连接数据库

The screenshots in the original article illustrate the graphical installer steps and successful connection screens.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

sqlLinuxSysadminOracleDatabase Installation
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.