<返回更多

Oracle单机实例+ASM

2022-01-05    乐维IT君
加入收藏

本环境centos7.4使用的主要软件包:

 

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

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/sdb1Writing disk header: doneInstantiating 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 : http://X.Org X11 X server utilities
Repo : base
Matched from:
Filename : /usr/bin/xhost

[root@rac31 ~]#yum -y install xorg-x11-server-utils-*

需要打开Xmanager工具

Oracle单机实例+ASM

 

[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

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

需要确保软件包均已安装(pdksh软件包可忽略),版本不同亦可,由于使用的是虚拟机 虚拟内存问题与OS问题可忽略

 

Oracle单机实例+ASM

 

确保无误后,忽略所有进行下一步

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

需要执行
/u01/app/oraInventory/orainstRoot.sh与/u01/app/11.2.0/grid/root.sh

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

执行
/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

Oracle单机实例+ASM

 

注:由于我们使用的是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

错误截图

 

Oracle单机实例+ASM

 

正确截图

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

点击ok,完成安装

Oracle单机实例+ASM

 

使用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

Oracle单机实例+ASM

 

点击Specify Disk Gruop 制定磁盘组

Oracle单机实例+ASM

 

点击右下角“CREATE ASM” ,提示输入的密码过于简单,点击YES继续

弹出窗口,提示

ASM created and started successfully.
DiskGroup DATA created successfully.

点击“ok”

 

三、安装oracle软件

[oracle@rac32 ~]$ cd /tmp/oracle/

database/ linux.x64_11gR2_database_1of2.zip linux.x64_11gR2_database_2of2.zip

[oracle@rac32 ~]$ cd /tmp/oracle/database/

[oracle@rac32 database]$ export DISPLAY=172.16.1.124:0.0

[oracle@rac32 database]$ ./runInstaller

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

由于oracle默认指识别固定版本,在安装ASM时已经把对应的软件包安装完成,该步骤可以忽略全部,点击“Next”

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

点击“Finish”,进行安装

Oracle单机实例+ASM

 

这一步其中2个问题可以忽略直接点击继续,到94%会比较慢,不是出错

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

点击“Finish”,完成安装oracle软件安装

 

四、DBCA建库

切换oracle用户进行安装库

[root@rac32 ~]# su - oracle

[oracle@rac32 ~]$ export DISPLAY=172.16.1.124:0.0

[oracle@rac32 ~]$ /u01/app/oracle/product/11.2.0/db_1/bin/dbca

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

选择创建数据库

Oracle单机实例+ASM

 

自定义全局数据库名称

Oracle单机实例+ASM

 

取消“configure enterprise manager”前面的勾(配置企业管理器)

取消“enable automatic maintenance tasks”前面的勾(自动维护任务)

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

数据库身份证明, 所有账户使用同一口令

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

选择存储类型ASM

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

初始化参数 内存:选择典型,百分比为40% ,使用自动内存管理

Oracle单机实例+ASM

 

设置存储块大小,设置后无法更改

设置最大进程数量,可更改

Oracle单机实例+ASM

 

字符集 数据库字符集选择ZHS16GBK 国家数据库字符集选择UTF8

Oracle单机实例+ASM

 

连接模式,选择专用服务器模式

Oracle单机实例+ASM

 

查看前面步骤的配置,直接点击“Next”

Oracle单机实例+ASM

 

创建数据库

生成数据库创建脚本

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

安装脚本生成成功,点击“OK”

Oracle单机实例+ASM

 


Oracle单机实例+ASM

 

部署oracle单机实例+ASM完成

声明:本站部分内容来自互联网,如有版权侵犯或其他问题请与我们联系,我们将立即删除或处理。
▍相关推荐
更多资讯 >>>