RHEL7.3 安装11G grid和Rdbms

##安装桌面
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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/28572479/viewspace-2147299/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值