[技术干货] Oracle单机实例+ASM

[复制链接]
乐维 发表于 2020-3-11 10:51:44 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
本环境CentOS7.4使用的主要软件包:
1.png
2.png
11.2.0.1版本
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
linux.x64_11gR2_grid.zip
需要额外一个磁盘做完ASM挂载磁盘:本实例使用50G

使用x-shell进行远程,通过Xmanager进行图形化显示(需关闭selinux)

一、环境准备
1.创建ORACLE用户和组成员
groupadd oinstall
groupadd dba
groupadd oper
groupadd asmadmin
groupadd asmdba
groupadd asmoper
useradd -g oinstall -G dba,asmdba,oper -d /home/oracle oracle                  (命令自动创建/home/oracle目录)
useradd -g oinstall -G dba,asmadmin,asmdba,asmoper -d /home/grid grid   (命令自动创建/home/grid目录)


2.分别创建oracle、grid用户的密码
passwd oracle
new unix password: oracle
passwd grid
new unix password: grid

3.//创建以下目录
mkdir -p /u01/app/11.2.0/grid
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle/product/11.2.0/db_1
mkdir -p /u02/arch
chown -R grid:oinstall /u01
chown -R oracle:oinstall /u01/app/oracle
chown -R oracle:oinstall /u02
chmod -R 775 /u01
chmod -R 775 /u02

4.使用oracle用户登陆,设置oracle用户的环境变量
//增加以下几行
[oracle@rac31 ~]$ vim .bash_profile
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
ORACLE_SID=orcl
PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH
export NLS_LANG=AMERICAN_AMERICA.UTF8
umask 022

5.使用grid域名登陆,设置grid用户的环境变量
//增加以下几行
[grid@rac31 ~]$ vim .bash_profile
export PATH
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_LANG=American_america.ZHS16GBK
export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin
export ORACLE_SID=+ASM

[root@rac31 ~]# vi /etc/security/limits.conf
*  soft    nproc  2047
*  hard    nproc  16384
*  soft    nofile  1024
*  hard    nofile  65536

[root@rac31 ~]# vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
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
[root@rac31 ~]# sysctl -p

关闭selinux
[root@rac31 ~]#vim /etc/selinux/config
SELINUX=disabled
[root@rac31 ~]#setenforce 0

安装缺失的包
yum -y install compat-libcap1 compat-libstdc++-33-3.2.3 libstdc++-devel-4.4.4 gcc gcc-c++ ksh libaio-devel

fdisk dev/sdb
N新建分区
P创建主分区
1 分区数1个
回车
回车
W保存
[root@rac31 ~]#ls /dev/sdb*
/dev/sdb   /dev/sdb1

安装ASM依赖文件
[root@rac31 ~]#yum install –y oracleasmlib-2.0.12-1.el7.x86_64.rpm  oracleasm-support-2.1.11-2.el7.x86_64.rpm

需要重启主机才能正常挂载oracleasm模块
[root@rac31 ~]#reboot     


挂载oracleasm模块
# oracleasm configure -i
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface []: grid
Default group to own the driver interface []: asmadmin   
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done

oracleasm createdisk OCR_VOTE1 /dev/sdb1
oracleasm module not loaded or /dev/oracleasm not mounted.

解决 方法
linux7需要手动挂载oracleasm模块

#oracleasm status
Checking if ASM is loaded: no
Checking if /dev/oracleasm is mounted: no

#oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Configuring "oracleasm" to use device physical block size
Mounting ASMlib driver filesystem: /dev/oracleasm

#oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes


二、创建ASM磁盘

[root@rac31 ~]# oracleasm createdisk DATA1 /dev/sdb1
Writing disk header: done
Instantiating disk: done
扫描oracleasm scandisks
列出oracleasm listdisks
安装xhost +工具  用于图形化界面
[root@rac31 ~]#yum whatprovides "*/xhost"
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
base/filelists_db                                                               | 3.4 MB     00:00 ...
xorg-x11-server-utils-7.7-2.el6.x86_64 : X.Org X11 X server utilities
Repo        : base
Matched from:
Filename    : /usr/bin/xhost
[root@rac31 ~]#yum -y install xorg-x11-server-utils-*
需要打开Xmanager工具
3.png
[root@rac31 ~]#export DISPLAY=172.16.1.203:0.0   ###该IP为本地ipconfig在使用远程的主机IP
[root@rac31 ~]#xhost +
access control disabled, clients can connect from any host
xhost:  must be on local machine to enable or disable access control.
安装grid组:
[grid@ rac31 grid]$ export DISPLAY=172.16.1.203:0.0
[grid@ rac31 grid]$ xhost +
[grid@ rac31 grid]$ ./runInstaller
4.png
5.png
6.png
7.png
8.png
需要确保软件包均已安装(pdksh软件包可忽略),版本不同亦可,由于使用的是虚拟机 虚拟内存问题与OS问题可忽略
9.png
确保无误后,忽略所有进行下一步
10.png
11.png
12.png
13.png
需要执行/u01/app/oraInventory/orainstRoot.sh与/u01/app/11.2.0/grid/root.sh
14.png
15.png

执行/u01/app/11.2.0/grid/root.sh后需要执行,上述红框内容, 大意是说,配置grid为一个独立的节点(单实例)需要root用户,执行roothas.pl命令
[root@rac31 ~]#/u01/app/11.2.0/grid/perl/bin/perl -I/u01/app/11.2.0/grid/perl/lib -I/u01/app/11.2.0/grid/crs/install /u01/app/11.2.0/grid/crs/install/roothas.pl
16.png
注:由于我们使用的是centos7系统,oracle默认识别的是6版本的系统,在执行该命令时,另开一个窗口切换到oracle用户执行已下命令/bin/dd if=/var/tmp/.oracle/npohasd of=/dev/null bs=1024 count=1,执行完后可ctrl+c停止,否则会报错
[root@rac31 ~]#/bin/dd if=/var/tmp/.oracle/npohasd of=/dev/null bs=1024 count=1
错误截图
17.png
正确截图
18.png
19.png

点击ok,完成安装
20.png
使用ASMCA命令创建ASM磁盘组
[root@rac31 ~]#su grid
[grid@rac32 bin]$ pwd
/u01/app/11.2.0/grid/bin
[grid@rac32 bin]$ export DISPLAY=172.16.1.124:0.0
[grid@rac32 bin]$ ./asmca
21.png
点击Specify Disk Gruop  制定磁盘组
22.png
点击右下角“CREATE ASM” ,提示输入的密码过于简单,点击YES继续
弹出窗口,提示
ASM created and started successfully.
DiskGroup DATA created successfully.
点击“ok”





上一篇:利用zabbix监控mysqldump定时备份数据库是否成功
下一篇:“专家坐诊”第50期问答汇总
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝0

帖子135

发布主题
最新发布

乐维社区

微信公众号

版权所有 © 2016-2019 九一乐维丨粤ICP备17007026号-2