Centos7安装Oracle11gR2各种问题

安装乱码:

安装前设置一下环境变量,用英文安装就不会乱码了

export LC_ALL=en_US.UTF-8

不能使用Backspace:

vim .zshrc
    stty erase ^h

xhost: unable to open display:

oracle user $

vim .zshrc 

    export DISPLAY=:0.0

root user #

xhost +

弹回Oracle安装图形界面:

linux root user #

yum -y groupinstall "GNOME Desktop" "Graphical Administration Tools"

本机windows

ipconfig,查看地址

开启Xmanager - Passive

linux oracle user $

vim .zshrc 

    export DISPLAY=windowsIPAddress:0.0 

source .zshrc 

cd /u01/soft/database

./runInstaller

内核参数配置/etc/sysctl.conf:

kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
fs.aio-max-nr = 1048576
fs.file-max = 6815744
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

Hard limits for "maximum open file descriptors":

vim /etc/security/limits.conf

    * hard nofile 65536

ulimit -a

Error in invoking target 'agent nmhs' of makefile:

vim /u01/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk

大概176行

$(MK_EMAGENT_NMECTL)更改为$(MK_EMAGENT_NMECTL) -lnnz11
Retry

iptables设置

systemctl stop firewald.service
systemctl disable firewald.service
yum install iptables-services iptables-devel
vim /etc/sysconfig/iptables
    在:INPUT ACCEPT [0:0]下面添加
    # Oracle 11G R2 configure
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 1158 -j ACCEPT
    -A INPUT -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT
vim /etc/sysctl.conf
    net.ipv4.ip_forward=1
sysctl -p
systemctl enable iptables.service
systemctl start iptables.service

关闭selinux

vim /etc/selinux/config
    将SELINUX=enforcing改为
    SELINUX=disabled

reboot

Oracle EM问题

检查监听器是否开启
    lsnrctl status

检查em
    emctl status dbconsole

检查数据库是否开启
    sqlplus / as sysdba
    select instance_name, status from v$instance;

检查iptables设置
    iptables -L -n

检查selinux是否关闭
    getenforce
    sestatus

浏览器打开https://oracle服务器IP:1158/em
    用户名:sys
    口令:
    连接身份:SYSDBA

sqlplus初始化配置

vim /u01/app/oracle/product/11.2.0/dbhome_1/sqlplus/admin/glogin.sql
    set linesize 148;
    set pagesize 39;
    col tablespace_name for a15;
    col file_name for a50;
    col bytes for 999,999,999;
    col owner for a15;
    col segment_name for a30;
    col segment_type for a20;

开机自动启动问题(最好不要用这个,Oracle有个组件好像能实现这个功能,具体忘了)

oracle user$

自行在root下使用visudo添加oracle用户

sudo vim /etc/oratab
    将orcl:/u01/app/oracle/product/11.2.0/dbhome_1:N改为(否则dbstart无效)
    orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y

vim /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
    将ORACLE_HOME_LISTNER=$1改为
    ORACLE_HOME_LISTNER=$ORACLE_HOME

vim /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbshut
    将ORACLE_HOME_LISTNER=$1改为
    ORACLE_HOME_LISTNER=$ORACLE_HOME


参考文档:https://oracle-base.com/articles/linux/linux-services-systemd

mkdir ~/scripts/

vim ~/scripts/setEnv.sh
    export ORACLE_HOSTNAME=oracle-11g-r2.test.com
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_SID=orcl
    export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
    export PATH=$ORACLE_HOME/bin:$PATH

vim ~/scripts/start_all.sh
    #!/bin/bash
    . /home/oracle/scripts/setEnv.sh
    export ORAENV_ASK=NO
    . oraenv
    export ORAENV_ASK=YES
    /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart 

vim ~/scripts/stop_all.sh
    #!/bin/bash
    . /home/oracle/scripts/setEnv.sh
    export ORAENV_ASK=NO
    . oraenv
    export ORAENV_ASK=YES
    /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbshut

chmod u+x ~/scripts/*.sh


参考文档:https://oracle-base.com/articles/linux/linux-services-systemd

sudo vim /lib/systemd/system/dbora.service
    [Unit]
    Description=The Oracle Database Service
    After=network.target

    [Service]
    # systemd ignores PAM limits, so set any necessary limits in the service.
    # Not really a bug, but a feature.
    # https://bugzilla.redhat.com/show_bug.cgi?id=754285
    LimitMEMLOCK=infinity
    LimitNOFILE=65535

    #Type=simple
    # idle: similar to simple, the actual execution of the service binary is delayed
    #       until all jobs are finished, which avoids mixing the status output with shell output of services.
    RemainAfterExit=yes
    User=oracle
    Group=oinstall
    Restart=no
    ExecStart=/home/oracle/scripts/start_all.sh
    ExecStop=/home/oracle/scripts/stop_all.sh

    [Install]
    WantedBy=multi-user.target


参考文档:https://linux.cn/article-5926-1.html

systemctl enable dbora.service
systemctl start dbora.service

使用公私钥登录方式

本机

ssh-keygen -t rsa
scp ~/.ssh/id_rsa.pub oracle@服务器地址:/home/oracle

服务器

cd
mkdir .ssh
touch .ssh/authorized_keys
cat id_rsa.pub >> .ssh/authorized_keys

 

你可能感兴趣的:(Centos7安装Oracle11gR2各种问题)