The Musings of CrashSensei

Random thoughts caught by the InterWeb

Preparing OL7 for Oracle Software

By crashsensei | October 27, 2017 | 0 Comment

Intro

This article is a continuation of the “Installing Oracle Linux 7”.

Configure the OS

  1. Create directories
    Note: This directory structure differs from the standard Oracle recommended setup but falls more in-line with Linux directory standards

    • Oracle DB
      mkdir -p /opt/oracle/app
      mkdir /opt/oracle/dump
    • Oracle EM
      mkdir -p /opt/oracle/app
      mkdir /opt/oracle/dump
      mkdir /opt/oracle/dbstore
      mkdir /opt/oracle/emrepo
      
  2. Setup accounts
    1. Create groups and users
      groupadd -g 501 oinstall
      groupadd -g 502 dba
      groupadd -g 503 oper
      groupadd -g 504 backupdba
      groupadd -g 505 dgdba
      groupadd -g 506 kmdba
      groupadd -g 507 racdba
      groupadd -g 508 asmadmin
      groupadd -g 509 asmdba
      groupadd -g 510 asmoper
      
      useradd -u 501 -g oinstall -G dba,oper,backupdba,dgdba,kmdba,racdba,asmdba -d /opt/oracle/home -r -m oracle
      useradd -u 502 -g oinstall -G dba,asmadmin,asmdba,asmoper -d /opt/oracle/ghome -r -m grid
      
      passwd oracle
      passwd grid
    2. Set permissions
      • Oracle DB
        chown root:oinstall /opt/oracle/
        chmod 775 /opt/oracle/
        chown root:oinstall /opt/oracle/app
        chmod 775 /opt/oracle/app
        chown oracle:oinstall /opt/oracle/dump
        chmod 775 /opt/oracle/dump
      • Oracle EM
        chown root:oinstall /opt/oracle/
        chmod 775 /opt/oracle/
        chown root:oinstall /opt/oracle/app
        chmod 775 /opt/oracle/app
        chown oracle:oinstall /opt/oracle/dump
        chmod 775 /opt/oracle/dump
        chown -R oracle:oinstall /opt/oracle/dbstore
        chmod -R 775 /opt/oracle/dbstore
        chown oracle:oinstall /opt/oracle/emrepo
        chmod 775 /opt/oracle/emrepo
  3. Add fully qualified name to hosts file
    echo "
    10.1.1.100  oracle12c.washco.org oracle12c" >> /etc/hosts
    
  4. Add firewall holes
    • Oracle DB and Oracle EM
      firewall-cmd --permanent --zone=public --add-port=1521/tcp  #Oracle TNS Listener port
      firewall-cmd --permanent --zone=public --add-port=5500/tcp  #EM Express 12c port (5500-5503 => 4 instances)
      firewall-cmd --permanent --zone=public --add-port=5501/tcp
      firewall-cmd --permanent --zone=public --add-port=5502/tcp
      firewall-cmd --permanent --zone=public --add-port=5503/tcp
      firewall-cmd --permanent --zone=public --add-port=3872/tcp  #EM Agent
    • Oracle EM
      firewall-cmd --permanent --zone=public --add-port=4889/tcp  #EM OHS Upload HTTP
      firewall-cmd --permanent --zone=public --add-port=1159/tcp  #EM OHS Upload HTTPS
      firewall-cmd --permanent --zone=public --add-port=7788/tcp  #EM Console HTTP
      firewall-cmd --permanent --zone=public --add-port=7799/tcp  #EM Console HTTPS
      firewall-cmd --permanent --zone=public --add-port=7101/tcp  #EM WebLogic Admin
  5. Set Secure Linux to permissive mode
    sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
    setenforce Permissive
  6. Install required packages, configure kernel, & set user limits
    • Option 1 : Automatic (not recommended)
      1. Install Oracle 12c pre-install package to perform the majority of the prerequisite setup
        yum install oracle-rdbms-server-12cR1-preinstall -y
      2. Modify kernel virtual memory parameters
        1. Create conf file
          echo "vm.swappiness = 1
          vm.dirty_background_ratio = 3
          vm.dirty_ratio = 60
          vm.dirty_expire_centisecs = 500
          vm.dirty_writeback_centisecs = 100" > /etc/sysctl.d/99-oracle-vm.conf
        2. Apply changes sysctl --system
      3. Create profile script
        echo "
        if [ $USER = "oracle" ]; then
         if [ $SHELL = "/bin/ksh" ]; then
         ulimit -u 16384
         ulimit -n 65536
         else
         ulimit -u 16384 -n 65536
         fi
        fi
        if [ $USER = "grid" ]; then
         if [ $SHELL = "/bin/ksh" ]; then
         ulimit -u 16384
         ulimit -n 65536
         else
         ulimit -u 16384 -n 65536
         fi
        fi
        " > /etc/profile.d/oracle-rdms-limits.sh
    • Option 2: Manual (recommended)
      1. Modify kernel parameters
        1. Create conf files
          echo "fs.file-max = 6815744
          fs.aio-max-nr = 1048576
          
          kernel.shmmax = 4398046511104
          kernel.shmall = 1073741824
          kernel.shmmni = 4096
          
          kernel.sem = 250 32000 100 128
          
          net.core.rmem_default = 262144
          net.core.rmem_max = 4194304
          net.core.wmem_default = 262144
          net.core.wmem_max = 1048576
          net.ipv4.conf.all.rp_filter = 2
          net.ipv4.conf.default.rp_filter = 2
          net.ipv4.ip_local_port_range = 9000 65500
          
          kernel.panic_on_oops = 1" > /etc/sysctl.d/99-oracle-rdbms.conf
          
          echo "vm.swappiness = 1
          vm.dirty_background_ratio = 3
          vm.dirty_ratio = 60
          vm.dirty_expire_centisecs = 500
          vm.dirty_writeback_centisecs = 100" > /etc/sysctl.d/99-oracle-rdbms-vm.conf
        2. Apply changes sysctl --system
      2. Modify shell limits
        1. Create security limits file
          echo "oracle   soft   nofile    1024
          oracle   hard   nofile    65536
          # nproc limit (refer to orabug15971421 for more info)
          oracle   soft   nproc    16384
          oracle   hard   nproc    16384
          oracle   soft   stack    10240
          oracle   hard   stack    32768
          # memlock limit is maximum of 128GB on x86_64 or 3GB on x86 OR 90% of RAM
          oracle   soft   memlock  134217728
          oracle   hard   memlock  134217728
          
          
          grid     soft   nofile   1024
          grid     hard   nofile   65536
          grid     soft   nproc    16384
          grid     hard   nproc    16384
          grid     soft   stack    10240
          grid     hard   stack    32768" > /etc/security/limits.d/oracle-rdbms.conf
        2. Create profile script
          echo "
          if [ $USER = "oracle" ]; then
           if [ $SHELL = "/bin/ksh" ]; then
           ulimit -u 16384
           ulimit -n 65536
           else
           ulimit -u 16384 -n 65536
           fi
          fi
          if [ $USER = "grid" ]; then
           if [ $SHELL = "/bin/ksh" ]; then
           ulimit -u 16384
           ulimit -n 65536
           else
           ulimit -u 16384 -n 65536
           fi
          fi
          " > /etc/profile.d/oracle-rdms-limits.sh
          
      3. Install required packages
        yum install \
        binutils.x86_64 \
        compat-libcap1.x86_64 \
        compat-libstdc++-33.i686 \
        compat-libstdc++-33.x86_64 \
        gcc.x86_64 \
        gcc-c++.x86_64 \
        glibc.i686 \
        glibc.x86_64 \
        glibc-devel.i686 \
        glibc-devel.x86_64 \
        ksh \
        libaio.i686 \
        libaio.x86_64 \
        libaio-devel.i686 \
        libaio-devel.x86_64 \
        libgcc.i686 \
        libgcc.x86_64 \
        libstdc++.i686 \
        libstdc++.x86_64 \
        libstdc++-devel.i686 \
        libstdc++-devel.x86_64 \
        libXi.i686 \
        libXi.x86_64 \
        libXtst.i686 \
        libXtst.x86_64 \
        make.x86_64 \
        sysstat.x86_64 \
        unixODBC \
        unixODBC-devel \
        unzip \
        util-linux-ng \
        xorg-x11-utils \
        xorg-x11-xauth -y
  7. Deploy the LinearSoft linux-toolbag from GitHub
    1. Install the package
      wget https://raw.githubusercontent.com/LinearSoft/linux-toolbag/master/package/install.sh -O /tmp/lsoft-lt-install.sh
      chmod +x /tmp/lsoft-lt-install.sh
      /tmp/lsoft-lt-install.sh
      rm /tmp/lsoft-lt-install.sh
    2. Link user profile scripts
      #bash_profile
      for HOMEDIR in /opt/oracle/home /opt/oracle/ghome /root; do
        echo "
      if [ -f /etc/linearsoft/toolbag.conf ]; then
        source /etc/linearsoft/toolbag.conf
        source ${LSOFT_TOOLBAG_BASE}/oracle/profile/bash_profile.sh
      fi
      " >> \
        ${HOMEDIR}/.bash_profile
      done
      
      #bashrc
      for HOMEDIR in /opt/oracle/home /opt/oracle/ghome /root; do
        echo "
      if [ -f /etc/linearsoft/toolbag.conf ]; then
        source /etc/linearsoft/toolbag.conf
        source ${LSOFT_TOOLBAG_BASE}/oracle/profile/bashrc.sh
      fi
      " >> \
        ${HOMEDIR}/.bashrc
      done
    3. Stage SystemD service files
      cp /opt/linearsoft/toolbag/oracle/systemd/*.service /etc/systemd/system/
  8. Setup Partitions
    1. Format partitions
      DOUBLE CHECK YOU’RE FORMATTING THE CORRECT DEVICES

      • Oracle DB
        mkfs.xfs -f -L oradb_soft   /dev/sdc   #Oracle Software 500GB
        mkfs.xfs -f -L oradb_dump   /dev/sdf   #Oracle Export/Dump location 120GB
        #DB Files will be stored in ASM
      • Oracle EM
        mkfs.xfs -f -L oradb_soft   /dev/sdc   #Oracle Software 250GB
        mkfs.xfs -f -L oradb_store  /dev/sdd   #Oracle DB files 128GB
        mkfs.xfs -f -L oradb_dump   /dev/sde   #Oracle Export/Dump location 60GB
        mkfs.xfs -f -L oraem_repo   /dev/sdf   #Oracle EM repo 72GB
    2. Modify fstab & mount partitions
      • Oracle DB
        echo "
        LABEL=oradb_soft  /opt/oracle/app         xfs     defaults                      0      0
        LABEL=oradb_dump  /opt/oracle/dump        xfs     defaults                      0      0" >> /etc/fstab
        
        mount /opt/oracle/app
        mount /opt/oracle/dump
      • Oracle EM
        echo "
        LABEL=oradb_soft  /opt/oracle/app         xfs     defaults                      0      0
        LABEL=oradb_store /opt/oracle/dbstore     xfs     defaults                      0      0
        LABEL=oradb_dump  /opt/oracle/dump        xfs     defaults                      0      0
        LABEL=oraem_repo  /opt/oracle/emrepo      xfs     defaults                      0      0" >> /etc/fstab
        
        mount /opt/oracle/app
        mount /opt/oracle/dbstore
        mount /opt/oracle/dump
        mount /opt/oracle/emrepo
    3. Create directories & apply permissions
      • Oracle DB
        #Re-apply permissions to mount points
        chown root:oinstall /opt/oracle/app
        chmod 775 /opt/oracle/app
        chown oracle:oinstall /opt/oracle/dump
        chmod 775 /opt/oracle/dump
        
        #Create Subdirectories
        mkdir /opt/oracle/app/oracle
        chown oracle:oinstall /opt/oracle/app/oracle
        chmod 775 /opt/oracle/app/oracle
        mkdir /opt/oracle/app/grid
        chown grid:oinstall /opt/oracle/app/grid
        chmod 775 /opt/oracle/app/grid
        mkdir /opt/oracle/app/oraInventory
        chown grid:oinstall /opt/oracle/app/oraInventory
        chmod 775 /opt/oracle/app/oraInventory
      • Oracle EM
        #Re-apply permissions to mount points
        chown root:oinstall /opt/oracle/app
        chmod 775 /opt/oracle/app
        chown oracle:oinstall /opt/oracle/dump
        chmod 775 /opt/oracle/dump
        chown oracle:oinstall /opt/oracle/dbstore
        chmod 775 /opt/oracle/dbstore
        chown oracle:oinstall /opt/oracle/emrepo
        chmod 775 /opt/oracle/emrepo
        
        #Create Subdirectories
        mkdir /opt/oracle/app/grid
        chown grid:oinstall /opt/oracle/app/grid
        chmod 775 /opt/oracle/app/grid
        mkdir /opt/oracle/app/oracle
        mkdir /opt/oracle/dbstore/oradata
        mkdir /opt/oracle/dbstore/fast_recovery_area
        ln -s /opt/oracle/dbstore/oradata /opt/oracle/app/oracle/oradata
        ln -s /opt/oracle/dbstore/flash_recovery_area /opt/oracle/app/oracle/fast_recovery_area
        chown -R oracle:oinstall /opt/oracle/app/oracle
        chmod -R 775 /opt/oracle/app/oracle
        chown -R oracle:oinstall /opt/oracle/dbstore
        chmod -R 775 /opt/oracle/dbstore
  9. Stage install files
    1. Download the software
      • Oracle DB
        1. Browse to the Oracle 12c Release 2 download page and click on See All for Linux x86-64

        2. On the new page click Accept License Agreement then proceed to download
          • Oracle Database 12c Release 2 (12.2.0.1.0) for Linux x86-64 (linuxx64_12201_database.zip)
          • Oracle Database 12c Release 2 Grid Infrastructure (12.2.0.1.0) for Linux x86-64 (linuxx64_12201_grid_home.zip)
      • Oracle EM
        • Database Software
          1. Download Oracle Database 12c Release 2 (12.2.0.1.0) for Linux x86-64 (linuxx64_12201_database.zip)
            See above for directions
        • Enterprise Manager Software
          1. Browse to the Oracle Enterprise Manager download page and click on for Linux x86-64
          2. On the new page click Accept License Agreement then proceed to download
            • Oracle Enterprise Manager Cloud Control 13c Release 2 Plug-in Update 1 (13.2.0.0)
              for Linux x86-64 (All seven files)
    2. Upload all files to /opt/oracle/dump
    3. Unzip the files
      • Oracle DB
        unzip /opt/oracle/dump/linuxx64_12201_database.zip -d /opt/oracle/dump/
        chown -R oracle:oinstall /opt/oracle/dump/database
      • Oracle EM
        unzip /opt/oracle/dump/linuxx64_12201_database.zip -d /opt/oracle/dump/
        rm /opt/oracle/dump/linuxx64_12201_database.zip
        mkdir /opt/oracle/dump/emtmp
        chmod +x /opt/oracle/dump/em13200p1_linux64.bin
        chown -R oracle:oinstall /opt/oracle/dump

         

Now choose Install Oracle Grid Infra (Restart) or Oracle EM

TAGS

0 Comments