Oracle单机实例+ASM配置

目录

一、安装GI

二、启动has服务

三、配置OracleASM

四、创建ASM磁盘 

五、创建ASM磁盘组

六、OCR备份及恢复 

七、安装DATABASE

问题一:如果提示找不到盘,重启oracleasm服务,并请确认路径是否正确 

问题二: Centos7 无法启动has

相关命令:


一、安装GI

su – grid

cd /software/oracle11G/grid

export LANG=en

./runInstall

二、启动has服务

在root用户下面跑一下 roothas.pl脚本

三、配置OracleASM

[root@centos610 ~]# echo -e "grid\nasmadmin\ny\ny\n"| 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 []: Default group to own the driver interface []: Start Oracle ASM library driver on boot (y/n) [n]: Scan for Oracle ASM disks on boot (y/n) [y]: Writing Oracle ASM library driver configuration: done

[root@centos610 ~]# oracleasm configure

ORACLEASM_ENABLED=true

ORACLEASM_UID=grid

ORACLEASM_GID=asmadmin

ORACLEASM_SCANBOOT=true

ORACLEASM_SCANORDER=""

ORACLEASM_SCANEXCLUDE=""

ORACLEASM_USE_LOGICAL_BLOCK_SIZE="false"

[root@centos610 ~]# 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

[root@centos610 ~]# oracleasm status

Checking if ASM is loaded: yes

Checking if /dev/oracleasm is mounted: yes

[root@centos610 ~]# oracleasm scandisks

Reloading disk partitions: done

Cleaning any stale ASM disks...

Scanning system for ASM disks...

四、创建ASM磁盘 

[root@centos610 ~]# fdisk -l|grep /dev/sd

Disk /dev/sda: 107.4 GB, 107374182400 bytes

/dev/sda1   *           1         131     1048576   83  Linux

/dev/sda2             131       13055   103808000   8e  Linux LVM

Disk /dev/sdb: 53.7 GB, 53687091200 bytes

Disk /dev/sdc: 53.7 GB, 53687091200 bytes

[root@centos610 ~]# echo -e "n\np\n1\n\n\nw" | fdisk /dev/sdb



WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

         switch off the mode (command 'c') and change display units to

         sectors (command 'u').



Command (m for help): Command action

   e   extended

   p   primary partition (1-4)

Partition number (1-4): First cylinder (1-6527, default 1): Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-6527, default 6527): Using default value 6527



Command (m for help): The partition table has been altered!



Calling ioctl() to re-read partition table.

Syncing disks.

[root@centos610 ~]# echo -e "n\np\n1\n\n\nw" | fdisk /dev/sdc



WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

         switch off the mode (command 'c') and change display units to

         sectors (command 'u').



Command (m for help): Command action

   e   extended

   p   primary partition (1-4)

Partition number (1-4): First cylinder (1-6527, default 1): Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-6527, default 6527): Using default value 6527



Command (m for help): The partition table has been altered!



Calling ioctl() to re-read partition table.

Syncing disks.

[root@centos610 ~]# fdisk -l|grep /dev/sd

Disk /dev/sda: 107.4 GB, 107374182400 bytes

/dev/sda1   *           1         131     1048576   83  Linux

/dev/sda2             131       13055   103808000   8e  Linux LVM

Disk /dev/sdb: 53.7 GB, 53687091200 bytes

/dev/sdb1               1        6527    52428096   83  Linux

Disk /dev/sdc: 53.7 GB, 53687091200 bytes

/dev/sdc1               1        6527    52428096   83  Linux

[root@centos610 ~]# oracleasm createdisk DATA01 /dev/sdb1

Writing disk header: done

Instantiating disk: done

[root@centos610 ~]# oracleasm createdisk DATA02 /dev/sdc1

Writing disk header: done

Instantiating disk: done

[root@centos610 ~]# oracleasm listdisks

DATA01

DATA02

五、创建ASM磁盘组

单实例可以不用建CRS磁盘组,直接建DATA磁盘组,只是AU无法指定,需要建完后删除,再重建才会有AU的选项。

 点击Specify Disk Gruop 制定磁盘组

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

 弹出窗口,提示

 点击“ok”

 

 跟据需求修改AU(Allocation units)大小

 

 

 

六、OCR备份及恢复 

#备份

[root@centos610 ~]# ocrconfig -export /home/grid/ocr.bak

[root@centos610 ~]# ll /home/grid/

total 4

-rw------- 1 root root 2414 Jun  6 15:58 ocr.bak

[root@centos610 ~]# crsctl stop has

CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'centos610'

CRS-2673: Attempting to stop 'ora.CRS.dg' on 'centos610'

CRS-2673: Attempting to stop 'ora.DATA.dg' on 'centos610'

CRS-2677: Stop of 'ora.DATA.dg' on 'centos610' succeeded

CRS-2677: Stop of 'ora.CRS.dg' on 'centos610' succeeded

CRS-2679: Attempting to clean 'ora.CRS.dg' on 'centos610'

CRS-2681: Clean of 'ora.CRS.dg' on 'centos610' succeeded

CRS-2673: Attempting to stop 'ora.asm' on 'centos610'

CRS-2677: Stop of 'ora.asm' on 'centos610' succeeded

CRS-2673: Attempting to stop 'ora.cssd' on 'centos610'

CRS-2677: Stop of 'ora.cssd' on 'centos610' succeeded

CRS-2673: Attempting to stop 'ora.evmd' on 'centos610'

CRS-2677: Stop of 'ora.evmd' on 'centos610' succeeded

CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'centos610' has completed

CRS-4133: Oracle High Availability Services has been stopped.



#恢复

[root@centos610 ~]# ocrconfig -import /home/grid/ocr.bak

[root@centos610 ~]# crsctl start has

CRS-4123: Oracle High Availability Services has been started.

 

七、安装DATABASE

su – oracle

cd /software/oracle11G/database

export LANG=en

./runInstall

 

问题一:如果提示找不到盘,重启oracleasm服务,并请确认路径是否正确 

问题二: Centos7 无法启动has

[root@centos79 ~]# /app/11.2.0/grid/crs/install/roothas.pl 
Using configuration parameter file: /app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
LOCAL ADD MODE 
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE 
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node centos79 successfully pinned.
Adding Clusterware entries to inittab
ohasd failed to start
Failed to start the Clusterware. Last 20 lines of the alert log follow: 
2022-06-09 15:37:38.344: 
[client(16736)]CRS-2101:The OLR was formatted using version 3.
2022-06-09 15:37:39.277: 
[client(16760)]CRS-1001:The OCR was formatted using version 3.

ohasd failed to start at /app/11.2.0/grid/crs/install/roothas.pl line 377, <ALERTLOG> line 4.

 主要要因为 centos 7使用 systemd 而不是 initd 运行进程和重启进程,而 root.sh 是通过传统的 initd 运行ohasd进程。
需要做一些简单修改

root用户创建服务文件

# touch /usr/lib/systemd/system/ohas.service;
chmod 777 /usr/lib/systemd/system/ohas.service;

# vi /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;

 删除并重新配置has

[root@centos79 install]# roothas.pl -deconfig -force -verbose
Using configuration parameter file: ./crsconfig_params
PRKO-2573 : ONS daemon is already stopped.
CRS-2673: Attempting to stop 'ora.cssd' on 'centos79'
CRS-2675: Stop of 'ora.cssd' on 'centos79' failed
CRS-2679: Attempting to clean 'ora.cssd' on 'centos79'
CRS-2681: Clean of 'ora.cssd' on 'centos79' succeeded
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'centos79'
CRS-2673: Attempting to stop 'ora.evmd' on 'centos79'
CRS-2677: Stop of 'ora.evmd' on 'centos79' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'centos79' has completed
CRS-4133: Oracle High Availability Services has been stopped.
Successfully deconfigured Oracle Restart stack

[root@centos79 install]# /app/11.2.0/grid/crs/install/roothas.pl 
Using configuration parameter file: /app/11.2.0/grid/crs/install/crsconfig_params
User ignored Prerequisites during installation
LOCAL ADD MODE 
Creating OCR keys for user 'grid', privgrp 'oinstall'..
Operation successful.
LOCAL ONLY MODE 
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4664: Node centos79 successfully pinned.
Adding Clusterware entries to inittab

centos79     2022/06/10 09:15:16     /app/11.2.0/grid/cdata/centos79/backup_20220610_091516.olr
Successfully configured Oracle Grid Infrastructure for a Standalone Server

      1        ONLINE  ONLINE       centos79                                     
[root@centos79 install]# su - grid -c "crsctl status res -t -init" 
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ons
               OFFLINE OFFLINE      centos79                                     
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        OFFLINE OFFLINE                                                   
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       centos79  
                                 

相关命令:

oracleasm configure    
oracleasm init         
oracleasm exit         
oracleasm scandisks    
oracleasm status       
oracleasm listdisks    
oracleasm querydisk    
oracleasm createdisk   
oracleasm deletedisk   
oracleasm renamedisk   
oracleasm update-driver

查看HAS服务
crsctl status res -t -init 
crsctl start has
crsctl stop has

删除磁盘组
alter diskgroup diskgroup_name dismount force;
drop diskgroup diskgroup_name FORCE INCLUDING CONTENTS;

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

楚枫默寒

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值