My_diary/Debian12 安装 oracle11g.md

7.9 KiB
Raw Permalink Blame History

Debian12 安装 oracle11g


  1. 查看系统版本

  2. 设置本地时区为上海

    timedatectl
    apt-get install ntpdate
    timedatectl set-timezone Asia/Shanghai
    ntpdate ntp1.aliyun.com
    date
    
  3. 检查当前系统版本号

    root@debianPE:~# lsb_release -a
    No LSB modules are available.
    Distributor ID: Debian
    Description:    Debian GNU/Linux 12 (bookworm)
    Release:        12
    Codename:       bookworm
    
  4. 安装必用软件

    apt-get install -y vim net-tools 
    
  5. 配置虚拟内存

    root@debianPE:~# grep SwapTotal /proc/meminfo
    SwapTotal:        998396 kB
    root@debianPE:~# free -h
                   total        used        free      shared  buff/cache   available
    Mem:           1.9Gi       955Mi       400Mi        13Mi       784Mi       1.0Gi
    Swap:          974Mi          0B       974Mi
    root@debianPE:~# sudo swapoff -a
    root@debianPE:~# sudo dd if=/dev/zero of=/swapfile bs=1G count=4 
    4+0 records in
    4+0 records out
    4294967296 bytes (4.3 GB, 4.0 GiB) copied, 19.3218 s, 222 MB/s
    root@debianPE:~# sudo mkswap /swapfile
    mkswap: /swapfile: insecure permissions 0644, fix with: chmod 0600 /swapfile
    Setting up swapspace version 1, size = 4 GiB (4294963200 bytes)
    no label, UUID=24c39cae-4736-4bfb-90df-a0261c14efbe
    root@debianPE:~# sudo swapon /swapfile
    swapon: /swapfile: insecure permissions 0644, 0600 suggested.
    root@debianPE:~# grep SwapTotal /proc/meminfo
    SwapTotal:       4194300 kB
    
  6. Configuring the static IP address

进入图形界面配置
  1. 验证主机名和用户信息

    root@debianPE:~# hostnamectl
     Static hostname: debianPE
           Icon name: computer-vm
             Chassis: vm 🖴
          Machine ID: 49d85c389b8e4dc99e284730f244dfde
             Boot ID: 4f3ef4e224ba4715add5c52df2e54d67
      Virtualization: kvm
    Operating System: Debian GNU/Linux 12 (bookworm)              
              Kernel: Linux 6.1.0-25-amd64
        Architecture: x86-64
     Hardware Vendor: QEMU
      Hardware Model: Standard PC _i440FX + PIIX, 1996_
    Firmware Version: rel-1.16.2-0-gea1b7a073390-prebuilt.qemu.org
    root@debianPE:~# groupadd oinstall
    root@debianPE:~# groupadd dba
    root@debianPE:~# mkdir -p /home/oracle
    root@debianPE:~# mkdir -p /u01/app/oracle
    root@debianPE:~# useradd -g oinstall -G dba -d /home/oracle -s /bin/bash oracle
    root@debianPE:~# passwd oracle
    New password: 
    Retype new password: 
    passwd: password updated successfully
    root@debianPE:~# chown -R oracle:oinstall /home/oracle
    root@debianPE:~# chown -R oracle:oinstall /u01/app/oracle
    root@debianPE:~# mkdir -p /u01/app/oraInventory
    root@debianPE:~# chown -R oracle:oinstall /u01/app/oraInventory
    
  2. 配置系统参数

    root@debianPE:~# nano /etc/sysctl.conf 
    
    vim /etc/sysctl.conf
    
    Append the lines shown below to the end of this configuration file.
    
    # ============================
    
    # Oracle 11g
    
    # ============================
    
    # semaphores: semmsl, semmns, semopm, semmni
    
    kernel.sem = 250 32000 100 128
    
    kernel.shmall = 2097152
    
    kernel.shmmni = 4096
    
    # Replace kernel.shmmax with the half of your memory size in bytes
    
    # if lower than 4 GB minus 1
    
    # 2147483648 is 2 GigaBytes (4 GB of RAM / 2)
    
    kernel.shmmax=2147483648
    
    #
    
    # Max number of network connections. Use sysctl -a | grep ip_local_port_range to check.
    
    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
    
    #
    
    # The maximum allowed value, set to avoid overhead and input/output errors
    
    fs.aio-max-nr = 1048576
    
    # 512 * Processes
    
    fs.file-max = 6815744
    
    fs.suid_dumpable = 1
    
    #
    
    # To allow dba to allocate hugetlbfs pages
    
    # 1001 is your oinstall group, you can check this id with the grep oinstall /etc/group command
    
    vm.hugetlb_shm_group = 1001
    
    Apply the kernel parameters you have set:
    
    sysctl -p
    
    
    --------------------------
    
    root@debianPE:~# sysctl -p
    net.ipv6.conf.all.disable_ipv6 = 1
    net.ipv6.conf.default.disable_ipv6 = 1
    net.ipv6.conf.lo.disable_ipv6 = 1
    kernel.sem = 250 32000 100 128
    kernel.shmall = 2097152
    kernel.shmmni = 4096
    kernel.shmmax = 2147483648
    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
    fs.aio-max-nr = 1048576
    fs.file-max = 6815744
    fs.suid_dumpable = 1
    vm.hugetlb_shm_group = 1001
    root@debianPE:~#
    
  3. Set up limits.conf

    Edit the /etc/security/limits.conf file:
    
    vim /etc/security/limits.conf
    
    Add the following lines to the end of the configuration file:
    
    # Oracle
    
    oracle           soft    nproc   2047
    
    oracle           hard    nproc   16384
    
    oracle           soft    nofile  1024
    
    oracle           hard    nofile  65536
    
    oracle           soft    stack   10240
    
    The first column specifies the user for whom the limits are set.
    
  4. PAM configration

    root@debianPE:~# cat /etc/pam.d/login | grep pam_limits.so
    session    required   pam_limits.so
    root@debianPE:~#
    
  5. Setting the shell profile

    Edit /etc/profile and set some needed parameters for oracle globally and permanently:
    
    vim /etc/profile
    
    Add the following lines:
    
    if [ $USER = "oracle" ]; then
    
            if [ $SHELL = "/bin/ksh" ]; then
    
                  ulimit -p 16384
    
                  ulimit -n 65536
    
            else
    
                  ulimit -u 16384 -n 65536
    
            fi
    
    fi
    
    Note: It is useful to know when each shell configuration file can be used because later you will need to configure a profile that contains environment variables for the oracle user.
    
  6. Installing the required packages

    按照手册详操作,比较复杂
    
  7. Run commands as root:
    
    mkdir /usr/lib64
    
    ln -s /etc /etc/rc.d
    
    ln -s /usr/bin/awk /bin/awk
    
    ln -s /usr/bin/basename /bin/basename
    
    ln -s /usr/bin/rpm /bin/rpm
    
    ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 /usr/lib64/
    
    ln -s /usr/lib/x86_64-linux-gnu/libc_nonshared.a /usr/lib64/
    
    ln -s /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a /usr/lib64/
    
    ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib64/
    
    ln -s /usr/lib/x86_64-linux-gnu /usr/lib64
    
    ln -sf /bin/bash /bin/sh
    
    ln -s /etc/rc0.d /etc/rc.d/rc0.d
    
    ln -s /etc/rc2.d /etc/rc.d/rc2.d
    
    ln -s /etc/rc3.d /etc/rc.d/rc3.d
    
    ln -s /etc/rc4.d /etc/rc.d/rc4.d
    
    ln -s /etc/rc5.d /etc/rc.d/rc5.d
    
    ln -s /etc/rc6.d /etc/rc.d/rc6.d
    
    ln -s /etc/init.d /etc/rc.d/init.d
    
    The above commands help prevent errors, such as:
    
    genclntsh: Failed to link libclntsh.so.11.1 in make file for rdbms/lib/ins_rdbms.mk because of missing library: /usr/bin/ld: cannot find /usr/lib64/libpthread_nonshared.a inside
    lib//libagtsh.so: undefined reference to `nnfyboot in make: rdbms/lib/dg4odbc] Error 1
    Now lets prevent one more error: /lib64/libgcc_s.so.1: File or directory does not exist, while creating lib/liborasdkbase.so.11.1 in ins_rdbms.mk. Go to the /lib64 directory and execute the command:
    
    cd /lib64
    
    ln -s /lib/x86_64-linux-gnu/libgcc_s.so.1 .
    
    Dont miss the dot at the end of the command.
    
    Set the Linux version as Red Hat Linux release 5 in /etc/redhat-release. Red Hat Linux distributions store their version in that file.
    
    echo 'Red Hat Linux release 5' > /etc/redhat-release