RHEL7.3 安裝11G grid和Rdbms

raysuen發表於2017-11-15
##安裝桌面
yum -y groupinstall "Server with GUI"
#啟動桌面
startx

#設定啟動模式
[root@localhost ~]# systemctl get-default
multi-user.target
[root@localhost ~]# cat /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3    #多使用者模式
# graphical.target: analogous to runlevel 5     #圖形化模式
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target
#
[root@localhost ~]# systemctl set-default graphical.target   
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.
[root@localhost ~]# systemctl get-default
graphical.target

##建立使用者和組
groupadd -g 500 oinstall
groupadd -g 501 dba
groupadd -g 502 oper
groupadd -g 600 asmadmin
groupadd -g 601 asmdba
groupadd -g 602 asmoper
useradd -u 1000 -g oinstall -G dba,oper,asmdba oracle
useradd -u 1001 -g oinstall -G dba,asmdba,asmadmin,asmoper grid


##安裝包
yum -y install binutils compat-libstdc++ compat-libcap1 gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio*.i686 libaio libaio-devel*.i686 libaio-devel libgcc*.i686 libgcc libstdc++*.i686 libstdc++ libstdc++-devel*.i686 libstdc++-devel libXi*.i686 libXi libXtst*.i686 libXtst make sysstat unixODBC*.i686 unixODBC unixODBC-devel

yum -y localinstall compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
yum -y localinstall elfutils-libelf-devel-0.166-2.el7.x86_64.rpm

rpm -qa | grep binutils-2.23.52.0.1-12.el7.x86_64
rpm -qa | grep compat-libcap1-1.10-3.el7.x86_64
rpm -qa | grep gcc-4.8.2-3.el7.x86_64
rpm -qa | grep gcc-c++-4.8.2-3.el7.x86_64
rpm -qa | grep glibc-2.17-36.el7.i686
rpm -qa | grep glibc-2.17-36.el7.x86_64
rpm -qa | grep glibc-devel-2.17-36.el7.i686
rpm -qa | grep glibc-devel-2.17-36.el7.x86_64
rpm -qa | grep ksh
rpm -qa | grep libaio-0.3.109-9.el7.i686
rpm -qa | grep libaio-0.3.109-9.el7.x86_64
rpm -qa | grep libaio-devel-0.3.109-9.el7.i686
rpm -qa | grep libaio-devel-0.3.109-9.el7.x86_64
rpm -qa | grep libgcc-4.8.2-3.el7.i686
rpm -qa | grep libgcc-4.8.2-3.el7.x86_64
rpm -qa | grep libstdc++-4.8.2-3.el7.i686
rpm -qa | grep libstdc++-4.8.2-3.el7.x86_64
rpm -qa | grep libstdc++-devel-4.8.2-3.el7.i686
rpm -qa | grep libstdc++-devel-4.8.2-3.el7.x86_64
rpm -qa | grep libXi-1.7.2-1.el7.i686
rpm -qa | grep libXi-1.7.2-1.el7.x86_64
rpm -qa | grep libXtst-1.2.2-1.el7.i686
rpm -qa | grep libXtst-1.2.2-1.el7.x86_64
rpm -qa | grep make-3.82-19.el7.x86_64
rpm -qa | grep sysstat-10.1.5-1.el7.x86_64

binutils-2.23.52.0.1-12.el7.x86_64
compat-libcap1-1.10-3.el7.x86_64
compat-libstdc++-33-3.2.3-71.el7.i686
compat-libstdc++-33-3.2.3-71.el7.x86_64
gcc-4.8.2-3.el7.x86_64
gcc-c++-4.8.2-3.el7.x86_64
glibc-2.17-36.el7.i686
glibc-2.17-36.el7.x86_64
glibc-devel-2.17-36.el7.i686
glibc-devel-2.17-36.el7.x86_64
ksh
libaio-0.3.109-9.el7.i686
libaio-0.3.109-9.el7.x86_64
libaio-devel-0.3.109-9.el7.i686
libaio-devel-0.3.109-9.el7.x86_64
libgcc-4.8.2-3.el7.i686
libgcc-4.8.2-3.el7.x86_64
libstdc++-4.8.2-3.el7.i686
libstdc++-4.8.2-3.el7.x86_64
libstdc++-devel-4.8.2-3.el7.i686
libstdc++-devel-4.8.2-3.el7.x86_64
libXi-1.7.2-1.el7.i686
libXi-1.7.2-1.el7.x86_64
libXtst-1.2.2-1.el7.i686
libXtst-1.2.2-1.el7.x86_64
make-3.82-19.el7.x86_64
sysstat-10.1.5-1.el7.x86_64




##關閉防火牆和selinux
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld  
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@rhel7ora11 ~]# getenforce
Enforcing
[root@rhel7ora11 ~]# setenforce 0
[root@rhel7ora11 ~]# getenforce
Permissive
[root@rhel7ora11 ~]# vi /etc/selinux/config
SELINUX=disabled
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

##記憶體引數配置
vi /etc/sysctl.conf

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.shmmax = 964507648
kernel.sem = 250 32000 100 128
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

##(英文為官檔建議),/sbin/sysctl -a | grep shm
kernel.shmall = 2097152 #共享記憶體的總量,8G記憶體設定:2097152*4k/1024/1024
40 percent of the size of physical memory in pages
Note: If the server supports multiple databases, or uses a large SGA, then set this parameter to a value that is equal to the total amount of shared memory, in 4K pages, that the system can use at one time.
kernel.shmmax = 4294967295 #最大共享記憶體的段大小
Half the size of physical memory in bytes
See My Oracle Support Note 567506.1 for additional information about configuring shmmax.

##查詢配置
/sbin/sysctl -a | grep ""

#vi /etc/security/limits.conf
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

##建立安裝目錄和賦權
mkdir -p /u01/grid
mkdir -p /u01/gridhome
mkdir -p /u01/oracle

chown -R grid:oinstall /u01/grid
chmod -R 755 /u01/grid
chown -R grid:oinstall /u01/gridhome
chmod -R 755 /u01/gridhome
chown -R oracle:oinstall /u01/oracle
chmod -R 755 /u01/oracle


#udev繫結裸裝置,這裡只繫結許可權
[root@rhel7ora11 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdb1
1ATA_VBOX_HARDDISK_VBfa21baba-d14e1c11
[root@rhel7ora11 ~]# /usr/lib/udev/scsi_id -g -u /dev/sdb2
1ATA_VBOX_HARDDISK_VBfa21baba-d14e1c11
[root@rhel7ora11 ~]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd?1", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id -g -u -d /dev/$parent",
RESULT=="1ATA_VBOX_HARDDISK_VBfa21baba-d14e1c11",  OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd?2", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id -g -u -d /dev/$parent",
RESULT=="1ATA_VBOX_HARDDISK_VBfa21baba-d14e1c11",  OWNER="grid", GROUP="asmadmin", MODE="0660"

[root@rhel7ora11 ~]# systemctl restart systemd-udev-trigger.service
[root@rhel7ora11 ~]# ls -l /dev/sdb*
brw-rw---- 1 root disk     8, 16 Aug  7 14:02 /dev/sdb
brw-rw---- 1 grid asmadmin 8, 17 Aug  7 14:02 /dev/sdb1
brw-rw---- 1 grid asmadmin 8, 18 Aug  7 14:02 /dev/sdb2


#設定使用者引數檔案
su - grid
export ORACLE_BASE=/u01/grid
export ORACLE_HOME=/u01/gridhome/11g
export ORACLE_SID=+ASM1
PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

su - oracle
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/11g
export ORACLE_SID=orcl
PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib


##安裝grid
./runInstaller

#注意,在執行root指令碼前,要執行下面的步驟,否則會報錯無法啟動ohas服務
touch /usr/lib/systemd/system/ohas.service
chmod 777 /usr/lib/systemd/system/ohas.service
[Unit]
Description=Oracle High Availability Services
After=syslog.target

[Service]
ExecStart=/etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple
Restart=always

[Install]
WantedBy=multi-user.target


systemctl daemon-reload
systemctl enable ohas.service
systemctl start ohas.service
systemctl status ohas.service

[root@rhel7ora11 ~]# systemctl daemon-reload
[root@rhel7ora11 ~]# systemctl enable ohas.service
Created symlink from /etc/systemd/system/multi-user.target.wants/ohas.service to /usr/lib/systemd/system/ohas.service.
[root@rhel7ora11 ~]# systemctl start ohas.service
[root@rhel7ora11 ~]# systemctl status ohas.service
[0m ohas.service - Oracle High Availability Services
   Loaded: loaded (/usr/lib/systemd/system/ohas.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Sun 2017-08-06 00:10:44 CST; 3s ago
  Process: 20405 ExecStart=/etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple (code=exited, status=203/EXEC)
Main PID: 20405 (code=exited, status=203/EXEC)

Aug 06 00:10:44 rhel7ora11 systemd[1]: ohas.service: main process exited, code=exited, status=203/EXEC
Aug 06 00:10:44 rhel7ora11 systemd[1]: Unit ohas.service entered failed state.
Aug 06 00:10:44 rhel7ora11 systemd[1]: ohas.service failed.
Aug 06 00:10:44 rhel7ora11 systemd[1]: ohas.service holdoff time over, scheduling restart.
Aug 06 00:10:44 rhel7ora11 systemd[1]: start request repeated too quickly for ohas.service
Aug 06 00:10:44 rhel7ora11 systemd[1]: Failed to start Oracle High Availability Services.
Aug 06 00:10:44 rhel7ora11 systemd[1]: Unit ohas.service entered failed state.
Aug 06 00:10:44 rhel7ora11 systemd[1]: ohas.service failed.

##如果一直不能正常啟動,一直檢查下面的檔案是否存在,當檔案存在馬上手動啟動oha,推介
[root@rhel7ora11 ~]# ls /etc/init.d/init.ohasd
ls: cannot access /etc/init.d/init.ohasd: No such file or directory
[root@rhel7ora11 ~]# ls /etc/init.d/init.ohasd
/etc/init.d/init.ohasd
[root@rhel7ora11 ~]# systemctl start ohas.service
[root@rhel7ora11 ~]# systemctl status ohas.service
[0m ohas.service - Oracle High Availability Services
   Loaded: loaded (/usr/lib/systemd/system/ohas.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2017-08-06 00:12:18 CST; 2s ago
Main PID: 23278 (init.ohasd)
   CGroup: /system.slice/ohas.service
           23278 /bin/sh /etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple

Aug 06 00:12:18 rhel7ora11 systemd[1]: Started Oracle High Availability Services.
Aug 06 00:12:18 rhel7ora11 systemd[1]: Starting Oracle High Availability Services...
Aug 06 00:12:18 rhel7ora11 su[23298]: (to grid) root on none
[root@rhel7ora11 ~]# systemctl status ohas.service
[0m ohas.service - Oracle High Availability Services
   Loaded: loaded (/usr/lib/systemd/system/ohas.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2017-08-06 00:12:18 CST; 13s ago
Main PID: 23278 (init.ohasd)
   CGroup: /system.slice/ohas.service
           23278 /bin/sh /etc/init.d/init.ohasd run >/dev/null 2>&1 Type=simple

Aug 06 00:12:18 rhel7ora11 systemd[1]: Started Oracle High Availability Services.
Aug 06 00:12:18 rhel7ora11 systemd[1]: Starting Oracle High Availability Services...
Aug 06 00:12:18 rhel7ora11 su[23298]: (to grid) root on none

##安裝rdbms
cd database/
./runInstaller

注意:如果報告錯誤Error in invoking target ‘agent nmhs‘ of makefile
解決方法:  
cd $ORACLE_HOME/sysman/lib
vi ins_emagent.mk   
修改此處如下:  
#===========================

#  emdctl

#===========================
$(SYSMANBIN)emdctl:
        $(MK_EMAGENT_NMECTL)
替換為:
$(SYSMANBIN)emdctl:
        $(MK_EMAGENT_NMECTL)-lnnz11

然後retry

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28572479/viewspace-2147299/,如需轉載,請註明出處,否則將追究法律責任。

相關文章