如何在Linux 上安装Oracle 12c

it2026-03-14  4

文章目录

一、安装条件二、安装环境三、安装过程3.1、更改主机名Oracle并挂载新增磁盘3.2、安装软件环境包3.3、调整内核参数3.4、用户环境配置3.5、oracle用户资源限制3.6、oracle安装3.7、测试Oracle数据库

一、安装条件

系统及配置要求 物理内存,不少于1GB

交换分区 物理内存为1-2GB时,设置为物理内存的1.5-2倍 物理内存为2-16GB时,设置为物理内存大小相同 不能少于4G

磁盘空间,创建xfs文件系统并且进行挂载不少于15G

拥有固定的FQDN名称,安装后不建议再更改

软件要求 GNOME中文桌面环境 中文JAva支持 安装所需软件包

二、安装环境

虚拟机VMware Centos 7.6版本 内核版本为 3.10.0-957.el7.x86_64 swap交换分区为16GB 新增磁盘为50GB 防火墙,核心防护均为关闭状态 yum仓库为线网源

三、安装过程

3.1、更改主机名Oracle并挂载新增磁盘

[root@localhost ~]# hostnamectl set-hostname oracle [root@localhost ~]# su [root@oracle ~]# vim /etc/hosts 20.0.0.25 oracle [root@oracle ~]# fdisk /dev/sdb [root@oracle ~]# mkfs -t xfs /dev/sdb1 [root@oracle ~]# mkdir /orc/ [root@oracle ~]# vi /etc/fstab /dev/sdb1 /orc xfs defaults 0 0 ##新增 [root@oracle ~]# mount -a

3.2、安装软件环境包

[root@oracle ~]# yum -y install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel

3.3、调整内核参数

[root@oracle ~]# vim /etc/sysctl.conf # sysctl settings are defined through files in # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/. # # Vendors settings live in /usr/lib/sysctl.d/. # To override a whole file, create a new file with the same in # /etc/sysctl.d/ and put new settings there. To override # only specific settings, add a file with a lexically later # name in /etc/sysctl.d/ and put new settings there. # # For more information, see sysctl.conf(5) and sysctl.d(5). fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 4294967295 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 = 1048576 [root@oracle ~]# sysctl -p

3.4、用户环境配置

[root@oracle ~]# groupadd oinstall [root@oracle ~]# groupadd dba [root@oracle ~]# useradd -g oinstall -G dba oracle [root@oracle ~]# passwd oracle #密码自设 [root@oracle ~]# mkdir -p /orc/app/oracle [root@oracle ~]# chown -R oracle:oinstall /orc/app/ [root@oracle ~]# chmod -R 755 /orc/app/oracle/ [root@oracle ~]# vim /home/oracle/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs umask 022 ORACLE_BASE=/orc/app/oracle ORACLE_HOME=/orc/app/oracle/product/12.2.0/dbhome_1/ ORACLE_SID=orcl NLS_LANG="SIMPLIFIED CHINESE_CHINA".UTF8 PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin LANG=zh_CN.UTF-8 export PATH LANG NLS_LANG ORACLE_BASE ORACLE_HOME ORACLE_SID

3.5、oracle用户资源限制

使用pam_limits认证模块

[root@oracle ~]# vim /etc/pam.d/login #%PAM-1.0 auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so auth substack system-auth auth include postlogin account required pam_nologin.so account include system-auth password include system-auth session required /lib/security/pam_limits.so 新增下面两行添加资源限制模块 session required pam_limits.so ...省略下面内容 [root@oracle ~]# vim /etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 [root@oracle ~]# vim /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 [root@oracle ~]# source /etc/profile

3.6、oracle安装

[root@oracle ~]# mkdir /abc [root@oracle ~]# cd /abc

此时用xshell把安装包放入abc目录中 进行解压

[root@oracle abc]# unzip linuxx64_12201_database.zip

图形化界面操作

[root@oracle ~]# xhost + [root@oracle ~]# su - oracle [oracle@oracle ~]$ cd abc [oracle@oracle abc]$ export DISPLAY=:0.0 [oracle@oracle abc]$ cd database/ [oracle@oracle database]$ ./runInstaller

执行完会出现图形界面安装 安装中弹窗处理

在 root 用户下输入下面两条命令

[root@oracle ~]# /orc/app/oraInventory/orainstRoot.sh [root@oracle ~]# /orc/app/oracle/product/12.2.0/dbhome_1/root.sh

注意要等脚本都加载完成,在继续选择进行安装 安装成功

3.7、测试Oracle数据库

[oracle@oracle database]$ sqlplus / as sysdba 连接到: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production SQL> ## 已连接 SQL> show user ## 查看下当前用户 USER 为 "SYS"
最新回复(0)