CentOS 静默安装Oracle

Oracle 数据库安装:

  1. 安装前依赖验证:
rpm -q binutilscompat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expatgccgcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-develmake pdkshsysstat unixODBC unixODBC-devel | grep "not installed"pdksh 在本系统中安装了ksh,可替代pdksh2、创建运行Oracle数据库的系统用户和用户组创建用户:[root@moke-1 ~]# groupadd oinstall[root@moke-1 ~]# groupadd dba[root@moke-1 ~]# useruseradd     userdel     userhelper  usermod     usernetctl  users[root@moke-1 ~]# useradd -g oinstall -g dba -m oracle[root@moke-1 ~]# passwd oracle设置密码[root@moke-1 ~]# id oracleuid=1000(oracle) gid=1001(dba) 组=1001(dba)[root@moke-1 ~]# su oracle[oracle@moke-1 root]$user =oraclepasswd=111@1222创建Oracle数据库安装目录[root@moke-1 /]# mkdir -p /data/oracle#安装目录[root@moke-1 /]# mkdir -p /data/oraInventory#数据库配置文件[root@moke-1 /]# mkdir -p /data/database#数据库软件包解压目录[root@moke-1 /]# cd /data/[root@moke-1 data]# lsdatabase  oracle  oraInventory[root@moke-1 data]# chown -R oracle:oinstall /data/oracle[root@moke-1 data]# chown -R oracle:oinstall /data/oraInventory[root@moke-1 data]# chown -R oracle:oinstall /data/database[root@moke-1 data]# lsdatabase  oracle  oraInventory[root@moke-1 data]# ll -l总用量 12drwxr-xr-x 2 oracle oinstall 4096 6月  22 15:18 databasedrwxr-xr-x 2 oracle oinstall 4096 6月  22 15:17 oracledrwxr-xr-x 2 oracle oinstall 4096 6月  22 15:18 oraInventory[root@moke-1 data]# chmod -R 775 /data[root@moke-1 data]# ll -l总用量 12drwxrwxr-x 2 oracle oinstall 4096 6月  22 15:18 databasedrwxrwxr-x 2 oracle oinstall 4096 6月  22 15:17 oracledrwxrwxr-x 2 oracle oinstall 4096 6月  22 15:18 oraInventory3、修改OS系统标识Oracle默认不支持centos系统安装,修改文件/etc/Redhat-release
[root@moke-1 home]# cat /proc/versionlinux version 3.10.0-327.28.3.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Aug 18 19:05:49 UTC 2016[root@moke-1 home]#[root@moke-1 home]# cat /etc/redhat-releaseCentOS Linux release 7.2.1511 (Core)[root@moke-1 home]#[root@moke-1 home]# vim /etc/redhat-releaseredhat-7~[root@moke-1 home]# cat /etc/redhat-releaseredhat-7[root@moke-1 home]#4、关闭防火墙5、关闭selinux(重启生效)[root@moke-1 home]# vim /etc/selinux/config# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:#     enforcing - SELinux security policy is enforced.#     permissive - SELinux prints warnings instead of enforcing.#     disabled - No SELinux policy is loaded.SELINUX=disabled#表示已关闭# SELINUXTYPE= can take one of three two values:#     targeted - Targeted processes are protected,#     minimum - Modification of targeted policy. Only selected processes are protected.#     mls - Multi Level Security protection.SELINUXTYPE=targeted6、修改内核参数[root@moke-1 ~]# vim /etc/sysctl.conf# System default settings live in /usr/lib/sysctl.d/00-system.conf.# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file## For more information, see sysctl.conf(5) and sysctl.d(5).net.ipv4.conf.all.accept_redirects=0#oracle database install confignet.ipv4.conf.all.rp_filter=1net.ipv4.icmp_echo_ignore_broadcasts=1fs.file-max = 6815744 #设置最大打开文件数fs.aio-max-nr = 1048576kernel.shmall  = 2097152 #共享内存的总量kernel.shmmax = 2147483648 #最大共享内存的段大小kernel.shmmni  = 4096 #整个系统共享内存端的最大数kernel.sem     = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500 #可使用的IPV4端口范围net.core.rmem_default = 262144net.core.rmem_max     = 4194304net.core.wmem_default = 262144net.core.wmen_max     = 1048576//使生效 sysctl -p7、对oracle用户设置限制,提高软件运行性能(结尾增加)oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 655368、配置用户环境变量[root@moke-1 database]# vim /home/oracle/.bash_profile# .bash_profile# Get the aliases and functionscd /daif [ -f ~/.bashrc ]; then. ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:$HOME/.local/bin:$HOME/binexport PATH# oracle database profileexport ORACLE_BASE=/data/oracleexport ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1export ORACLE_SID=orclexport PATH=$ORACLE_HOME/bin:/usr/sbin:$PATHexport LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/libexport LC_ALL=en_USexport LANG=en_USexport NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
环境变量开机生效
vim /etc/bashrc# oracle profilesource /home/oracle/.bash_profile#source /etc/profile


推荐阅读