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</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 655365. Modify pam.d/login
session required /lib/security/pam_limits.so</code>
<code>session required pam_limits.so6. 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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
