设置主机名:
[root@db12c ~]# hostnamectl set-hostname db12c --static [root@db12c ~]# cat /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.34.189 db12c[root@db12c ~]# hostnamectl Static hostname: db12c Icon name: computer Chassis: n/a Machine ID: 5e84ad7084be4550be7929df16f31ea7 Boot ID: 4793b89804f849bd86464594eb107e22 Virtualization: vmware Operating System: Oracle Linux Server 7.1 CPE OS Name: cpe:/o:oracle:linux:7:1 Kernel: Linux 3.8.13-55.1.6.el7uek.x86_64 Architecture: x86_64
添加组和用户:
[root@db12c ~]# groupadd -g 54321 oinstall [root@db12c ~]# groupadd -g 54322 dba [root@db12c ~]# groupadd -g 54323 oper [root@db12c ~]# groupadd -g 54324 backupdba [root@db12c ~]# groupadd -g 54325 dgdba [root@db12c ~]# groupadd -g 54326 kmdba [root@db12c ~]# groupadd -g 54327 asmdba [root@db12c ~]# groupadd -g 54328 asmoper [root@db12c ~]# groupadd -g 54329 asmadmin [root@db12c ~]# useradd -u 54321 -g oinstall -G dba,oper,backupdba,dgdba,kmdba oracle
设置密码:
[root@db12c ~]# passwd oracle Changing password for user oracle. New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: passwd: all authentication tokens updated successfully.
安装软件包:
[root@db12c Packages]# yum install oracle-rdbms-server-12cR1-preinstall-1.0-3.el7.x86_64.rpm -yLoaded plugins: langpacksExamining oracle-rdbms-server-12cR1-preinstall-1.0-3.el7.x86_64.rpm: oracle-rdbms-server-12cR1-preinstall-1.0-3.el7.x86_64Marking oracle-rdbms-server-12cR1-preinstall-1.0-3.el7.x86_64.rpm to be installedResolving Dependencies--> Running transaction check---> Package oracle-rdbms-server-12cR1-preinstall.x86_64 0:1.0-3.el7 will be installed--> Processing Dependency: compat-libcap1 for package: oracle-rdbms-server-12cR1-preinstall-1.0-3.el7.x86_64--> Processing Dependency: compat-libstdc++-33 for package: oracle-rdbms-server-12cR1-preinstall-1.0-3.el7.x86_64--> Processing Dependency: gcc-c++ for package: oracle-rdbms-server-12cR1-preinstall-1.0-3.el7.x86_64--> Processing Dependency: ksh for package: oracle-rdbms-server-12cR1-preinstall-1.0-3.el7.x86_64--> Processing Dependency: libaio-devel for package: oracle-rdbms-server-12cR1-preinstall-1.0-3.el7.x86_64--> Processing Dependency: libstdc++-devel for package: oracle-rdbms-server-12cR1-preinstall-1.0-3.el7.x86_64--> Running transaction check---> Package compat-libcap1.x86_64 0:1.10-7.el7 will be installed---> Package compat-libstdc++-33.x86_64 0:3.2.3-72.el7 will be installed---> Package gcc-c++.x86_64 0:4.8.3-9.el7 will be installed---> Package ksh.x86_64 0:20120801-22.el7 will be installed---> Package libaio-devel.x86_64 0:0.3.109-12.el7 will be installed---> Package libstdc++-devel.x86_64 0:4.8.3-9.el7 will be installed--> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================== Package Arch Version Repository Size=====================================================================================================================================Installing: oracle-rdbms-server-12cR1-preinstall x86_64 1.0-3.el7 /oracle-rdbms-server-12cR1-preinstall-1.0-3.el7.x86_64 43 kInstalling for dependencies: compat-libcap1 x86_64 1.10-7.el7 ol7_latest 17 k compat-libstdc++-33 x86_64 3.2.3-72.el7 ol7_latest 190 k gcc-c++ x86_64 4.8.3-9.el7 ol7_latest 7.2 M ksh x86_64 20120801-22.el7 ol7_latest 879 k libaio-devel x86_64 0.3.109-12.el7 ol7_latest 12 k libstdc++-devel x86_64 4.8.3-9.el7 ol7_latest 1.5 M Transaction Summary=====================================================================================================================================Install 1 Package (+6 Dependent packages) Total size: 9.8 MTotal download size: 9.7 MInstalled size: 29 MDownloading packages:-------------------------------------------------------------------------------------------------------------------------------------Total 42 MB/s | 9.7 MB 00:00:00 Running transaction checkRunning transaction testTransaction test succeededRunning transaction Installing : libstdc++-devel-4.8.3-9.el7.x86_64 1/7 Installing : gcc-c++-4.8.3-9.el7.x86_64 2/7 Installing : libaio-devel-0.3.109-12.el7.x86_64 3/7 Installing : compat-libcap1-1.10-7.el7.x86_64 4/7 Installing : compat-libstdc++-33-3.2.3-72.el7.x86_64 5/7 Installing : ksh-20120801-22.el7.x86_64 6/7 Installing : oracle-rdbms-server-12cR1-preinstall-1.0-3.el7.x86_64 7/7 Verifying : ksh-20120801-22.el7.x86_64 1/7 Verifying : gcc-c++-4.8.3-9.el7.x86_64 2/7 Verifying : compat-libstdc++-33-3.2.3-72.el7.x86_64 3/7 Verifying : compat-libcap1-1.10-7.el7.x86_64 4/7 Verifying : libaio-devel-0.3.109-12.el7.x86_64 5/7 Verifying : oracle-rdbms-server-12cR1-preinstall-1.0-3.el7.x86_64 6/7 Verifying : libstdc++-devel-4.8.3-9.el7.x86_64 7/7 Installed: oracle-rdbms-server-12cR1-preinstall.x86_64 0:1.0-3.el7 Dependency Installed: compat-libcap1.x86_64 0:1.10-7.el7 compat-libstdc++-33.x86_64 0:3.2.3-72.el7 gcc-c++.x86_64 0:4.8.3-9.el7 ksh.x86_64 0:20120801-22.el7 libaio-devel.x86_64 0:0.3.109-12.el7 libstdc++-devel.x86_64 0:4.8.3-9.el7 Complete!
禁用selinux和防火墙:
[root@db12c Packages]# vim /etc/selinux/config [root@db12c Packages]# systemctl start firewalld.service [root@db12c Packages]# systemctl stop firewalld.service [root@db12c Packages]# systemctl disable firewalld.service rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service' rm '/etc/systemd/system/basic.target.wants/firewalld.service' [root@db12c Packages]# setenforce
修改系统内核参数:
[root@db12c Packages]# sysctl -p fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel.shmmni = 4096 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104 kernel.panic_on_oops = 1 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500
修改oracle用户资源限制:
[root@db12c Packages]# tail -10 /etc/security/limits.conf #@faculty hard nproc 50 #ftp hard nproc 0 #@student - maxlogins 4 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 32768
配置环境变量:
export TMP=/tmp export ORACLE_HOSTNAME=db12c export ORACLE_UNQNAME=ORA12C export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1 export ORACLE_SID=ORA12C PATH=/usr/sbin:$PATH:$ORACLE_HOME/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; alias cdob='cd $ORACLE_BASE' alias cdoh='cd $ORACLE_HOME' alias tns='cd $ORACLE_HOME/network/admin' alias envo='env | grep ORACLE' umask 022 envo
建立安装目录:
[root@db12c ~]# mkdir -p /u01/app/oracle/product/12.1.0/db_1 [root@db12c ~]# chown oracle:oinstall -R /u01/ [root@db12c ~]# systemctl mask tmp.mount ln -s '/dev/null' '/etc/systemd/system/tmp.mount' [root@db12c ~]# chmod 775 -R /u01/