Oracle High Availability Services 19c
Oracle High Availability Services 19c

Oracle High Availability Services 19c

Fala pessoal, nesta postagem iremos configurar OHAS (Oracle High Availability Services 19c), para utilização do ASM.

Requisitos:
- VM Oracle Linux 8 com 2 cpus, 8300 MB de Memória e 16GB de swap (funciona com menos memória, mas tem alguns warnings durante a instalação).
- 1 disco de 50 GB, ou o tamanho preferir (disk01 do diskgroup +DATA), entendo que 50GB é o minimo alguns laboratórios.

Instalador do grid da arquitetura x86_64 (https://www.oracle.com/br/database/technologies/oracle19c-linux-downloads.html)

Primeiro iremos habilitar repositórios para downloads dos pacotes necessários.

[root@dbalab ~]# dnf config-manager --enable ol8_baseos_latest ol8_addons

Com os respositórios ativos bora instalar o pacotes necessários, removi boa parte da saida do comando por ser muito extensa.

[root@dbalab ~]# yum install oracle-database-preinstall-19c oracleasm-support kmod-redhat-oracleasm oracleasm -y
Oracle Linux 8 BaseOS Latest (x86_64)                                                                                                     93 kB/s | 4.3 kB     00:00    
Oracle Linux 8 Application Stream (x86_64)                                                                                               140 kB/s | 4.5 kB     00:00    
Oracle Linux 8 Addons (x86_64)                                                                                                            26 MB/s |  46 MB     00:01    
Latest Unbreakable Enterprise Kernel Release 7 for Oracle Linux 8 (x86_64)                                                               113 kB/s | 3.5 kB     00:00    
Package kernel-uek-core-5.15.0-206.153.7.1.el8uek.x86_64 is already installed.
Dependencies resolved.
=========================================================================================================================================================================
 Package                                          Architecture             Version                                             Repository                           Size
=========================================================================================================================================================================                                                                                                                                   
Installed:
  bc-1.07.1-5.el8.x86_64                                     bind-libs-32:9.11.36-16.el8_10.4.x86_64             bind-libs-lite-32:9.11.36-16.el8_10.4.x86_64            
  bind-license-32:9.11.36-16.el8_10.4.noarch                 bind-utils-32:9.11.36-16.el8_10.4.x86_64            binutils-2.30-125.0.1.el8_10.x86_64                     
  fstrm-0.6.1-3.el8.x86_64                                   geolite2-city-20180605-1.el8.noarch                 geolite2-country-20180605-1.el8.noarch                  
  glibc-devel-2.28-251.0.2.el8.x86_64                        glibc-headers-2.28-251.0.2.el8.x86_64               gssproxy-0.8.0-21.el8.x86_64                            
  kernel-headers-4.18.0-553.74.1.el8_10.x86_64               keyutils-1.5.10-9.el8.x86_64                        kmod-redhat-oracleasm-8:2.0.8-18.2.0.1.el8_10.x86_64    
  ksh-20120801-267.0.1.el8.x86_64                            libICE-1.0.9-15.el8.x86_64                          libSM-1.2.3-1.el8.x86_64                                
  libX11-1.6.8-9.el8_10.x86_64                               libX11-common-1.6.8-9.el8_10.noarch                 libX11-xcb-1.6.8-9.el8_10.x86_64                        
  libXau-1.0.9-3.el8.x86_64                                  libXcomposite-0.4.4-14.el8.x86_64                   libXext-1.3.4-1.el8.x86_64                              
  libXi-1.7.10-1.el8.x86_64                                  libXinerama-1.1.4-1.el8.x86_64                      libXmu-1.1.3-1.el8.x86_64                               
  libXrandr-1.5.2-1.el8.x86_64                               libXrender-0.9.10-7.el8.x86_64                      libXt-1.1.5-12.el8.x86_64                               
  libXtst-1.2.3-7.el8.x86_64                                 libXv-1.0.11-7.el8.x86_64                           libXxf86dga-1.1.5-1.el8.x86_64                          
  libXxf86misc-1.0.4-1.el8.x86_64                            libXxf86vm-1.1.4-9.el8.x86_64                       libaio-devel-0.3.112-1.el8.x86_64                       
  libdmx-1.1.4-3.el8.x86_64                                  libev-4.24-6.el8.x86_64                             libmaxminddb-1.2.0-10.el8_9.1.x86_64                    
  libnsl-2.28-251.0.2.el8.x86_64                             libpkgconf-1.4.2-1.el8.x86_64                       libstdc++-devel-8.5.0-21.0.1.el8.x86_64                 
  libverto-libev-0.3.2-2.el8.x86_64                          libxcb-1.13.1-1.el8.x86_64                          libxcrypt-devel-4.1.1-6.el8.x86_64                      
  lm_sensors-libs-3.4.0-23.20180522git70f7e08.el8.x86_64     make-1:4.2.1-11.el8.x86_64                          net-tools-2.0-0.52.20160912git.el8.x86_64               
  nfs-utils-1:2.3.3-64.0.1.el8_10.x86_64                     oracle-database-preinstall-19c-1.0-2.el8.x86_64     oracleasm-support-3.1.0-10.el8.x86_64                   
  pkgconf-1.4.2-1.el8.x86_64                                 pkgconf-m4-1.4.2-1.el8.noarch                       pkgconf-pkg-config-1.4.2-1.el8.x86_64                   
  protobuf-c-1.3.0-8.el8.x86_64                              python3-bind-32:9.11.36-16.el8_10.4.noarch          python3-pyyaml-5.4.1-1.0.1.el8.x86_64                   
  quota-1:4.04-14.el8.x86_64                                 quota-nls-1:4.04-14.el8.noarch                      rpcbind-1.2.5-10.el8.x86_64                             
  smartmontools-1:7.1-3.el8.x86_64                           sysstat-11.7.3-13.0.2.el8_10.x86_64                 tar-2:1.30-11.el8_10.x86_64                             
  unzip-6.0-48.0.1.el8_10.x86_64                             xorg-x11-utils-7.5-28.el8.x86_64                    xorg-x11-xauth-1:1.0.9-12.el8.x86_64                    

Complete!

Mais atualização e instalação de pacotes, onde também removi boa parte da saída.

[root@dbalab ~]# yum update -y 
Last metadata expiration check: 0:13:40 ago on Sat 13 Sep 2025 01:13:56 PM -03.
Dependencies resolved.
=========================================================================================================================================================================
 Package                                      Architecture           Version                                                     Repository                         Size
=========================================================================================================================================================================                                                       
Installed:
  grub2-tools-efi-1:2.02-167.0.1.el8_10.x86_64               kernel-4.18.0-553.74.1.el8_10.x86_64               kernel-core-4.18.0-553.74.1.el8_10.x86_64              
  kernel-modules-4.18.0-553.74.1.el8_10.x86_64               kernel-uek-5.15.0-312.187.5.1.el8uek.x86_64        kernel-uek-core-5.15.0-312.187.5.1.el8uek.x86_64       
  kernel-uek-modules-5.15.0-312.187.5.1.el8uek.x86_64       

Complete! 

Editar o arquivo /etc/selinux/config, deixando conforme abaixo.

[root@dbalab ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

Ajustar também o /etc/hosts, conforme o seu ip e o nome da sua maquina.

[root@dbalab ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.102 dbalab.localdomain

Alterando kernel padrão de inicialização pois o kernel 5.15 não é suportado pelo asmlib, então aqui vamos configurar o 4.18.0-553.el8_10.x86_64

[root@dbalab ~]# grubby --set-default /boot/vmlinuz-4.18.0-553.el8_10.x86_64
The default is /boot/loader/entries/231010f5ccac463881aee7ace309acd2-4.18.0-553.el8_10.x86_64.conf with index 3 and kernel /boot/vmlinuz-4.18.0-553.el8_10.x86_64

Alerando a senha do usuário oracle.

[root@dbalab ~]# passwd oracle
Changing password for user oracle.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.

Criando grupos.

[root@dbalab ~]# groupadd asmadmin; groupadd asmdba; groupadd asmoper;

Atribuindo grupos criados ao usuário oracle.

[root@dbalab ~]# usermod -g oinstall -G dba,oper,asmadmin,asmdba,asmoper oracle

Criando diretório da instalação e atribuindo diretório /u01 ao usuário oracle e ao grupo oinstall.

[root@dbalab ~]# mkdir -p /u01/app/oracle/19.0.0.0/grid ; chown -R oracle:oinstall /u01

Concedendo as permissões necessárias ao diretório de maneira recursiva

[root@dbalab ~]# chmod -R 775 /u01

Parando e desabilitando serviço do firewall.

[root@dbalab ~]# systemctl stop firewalld ; systemctl disable firewalld
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

Tudo muito similar a uma instalação padrão do database home.

Faça o download da asmlib e transfira para o maquina, no meu caso eu transferi para o /root/
https://www.oracle.com/linux/downloads/linux-asmlib-v8-downloads.html
Aproveitando também irei transferir o instalador do grid.

[rafael@archlinux Downloads]$ scp oracleasmlib-3.1.1-1.el8.x86_64.rpm root@dbalab:/root/
root@dbalab's password: 
oracleasmlib-3.1.1-1.el8.x86_64.rpm                                     100%   52KB  24.2MB/s   00:00
[rafael@archlinux Downloads]$ scp LINUX.X64_193000_grid_home.zip oracle@dbalab:/u01/app/oracle/19.0.0.0/grid/
oracle@dbalab's password: 
LINUX.X64_193000_grid_home.zip                                          100% 2755MB 109.2MB/s   00:25

Agora logamos de oracle e vamos na pasta do instalador

[oracle@dbalab ~]$ cd /u01/app/oracle/19.0.0.0/grid/ ; unzip -q LINUX.X64_193000_grid_home.zip

Após ser descompactado de oracle, logaremos novamente de root para instalar a asmlib 3.1.

[root@dbalab ~]# rpm -ivh /root/oracleasmlib-3.1.1-1.el8.x86_64.rpm
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:oracleasmlib-3.1.1-1.el8         ################################# [100%]

Feito isso vamos reiniciar para que as alterações feitas no arquivo /etc/selinux/config, as alterações do kernel 4.18.0-553.el8_10.x86_64 seja carregada ao startup do sistema operacional

[root@dbalab ~]# reboot
Connection to dbalab closed by remote host.
Connection to dbalab closed.

Confirmando o kernel correto.

[root@dbalab ~]# uname -r
4.18.0-553.el8_10.x86_64

Agora iremos configurar o oracleasm.

[root@dbalab ~]# oracleasm configure -i
Configuring the Oracle ASM system service.

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

Default user to own the ASM disk devices []: oracle
Default group to own the ASM disk devices []: asmadmin
Start Oracle ASM system service on boot (y/n) [y]: y
Scan for Oracle ASM disks when starting the oracleasm service (y/n) [y]: y
Maximum number of ASM disks that can be used on system [2048]: <ENTER>
Enable iofilter if kernel supports it (y/n) [y]: y
Writing Oracle ASM system service configuration: done

Configuration changes only come into effect after the Oracle ASM
system service is restarted.  Please run 'systemctl restart oracleasm'
after making changes.

WARNING: All of your Oracle and ASM instances must be stopped prior
to restarting the oracleasm service.

Agora vamos criar uma partição no disco que fara parte do diskgroup DATA do ASM.
Primeiro identificamos o nosso disco

[root@dbalab ~]# lsblk
NAME               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                  8:0    0   40G  0 disk 
├─sda1               8:1    0    1G  0 part /boot
└─sda2               8:2    0   39G  0 part 
  └─ol_dbalab-root 253:0    0   39G  0 lvm  /
sdb                  8:16   0   17G  0 disk 
└─sdb1               8:17   0   17G  0 part [SWAP]
sdc                  8:32   0   50G  0 disk 
sr0                 11:0    1 1024M  0 rom  

Agora criaremos uma partição do modo mais simples possivel, aceitando todas as opções padrões.

[root@dbalab ~]# fdisk /dev/sdc
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x1092a616.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): <ENTER>
First sector (2048-104857599, default 2048): <ENTER>
Last sector, +sectors or +size{K,M,G,T,P} (2048-104857599, default 104857599): <ENTER>

Created a new partition 1 of type 'Linux' and of size 50 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Agora com a partição criada atualizamos a tabela de partições

[root@dbalab ~]# partprobe -s
/dev/sda: msdos partitions 1 2
/dev/sdb: msdos partitions 1
/dev/sdc: msdos partitions 1

Agora vamos marcar a partição criada como disco ASM.

[root@dbalab ~]# oracleasm createdisk DATA01 /dev/sdc1
Writing disk header: done
Instantiating disk: done

Verificando se o disco foi marcado corretamente.

[root@dbalab ~]# oracleasm querydisk -i DATA01
ORCL:DATA01
	Device: /dev/sdc1 (8:33)
	Device UUID: 
	Disk Group: 
	Capabilities: IO | LOGICAL
	Size: 104855552 blocks (53686042624 bytes)
	Logical Block Size: 512 bytes
	Physical Block Size: 512 bytes
	Max I/O Size: 1024 blocks (524288 bytes)
	Data Integrity: unsupported
	Thin Provisioning: unsupported
	Max TP I/O Size: 0 blocks (0 bytes)

Verificando mount point do asm esta correto, o qual utilizei para configurar os parâmetros oracle.install.asm.diskGroup.disks e oracle.install.asm.diskGroup.diskDiscoveryString no ohas.rsp.

[root@dbalab ~]# oracleasm status
Checking if the oracleasm kernel module is loaded: yes
Checking if /dev/oracleasm is mounted: yes
Checking which I/O Interface is in use: oracleasm driver (KABI_V2)
Checking if ASMLIB can be loaded: yes

Verificando se o disco esta com as permissões corretas.

[root@dbalab ~]# ls -la /dev/oracleasm/disks/*
brw-rw----. 1 oracle asmadmin 8, 33 Sep 14 10:44 /dev/oracleasm/disks/DATA01

Pode baixar o ohas.txt para efetuarmos a instalação.
OBS: Eu subi o arquivo como ohas.txt ao inves de ohas.rsp pois o wordpress não me permitiu subir com a extesão .rsp, mas depois vc muda se quiser, a extensão não vai influenciar em nada.

[rafael@archlinux response-files]$ scp ohas.rsp oracle@dbalab:/home/oracle/ohas.rsp
oracle@dbalab's password: 
ohas.rsp                                                                100%   36KB  24.4MB/s   00:00

Agora vamos logar como oracle, definir as variavéis de ambiente, e iniciar a instalação.

[oracle@dbalab grid]$ export CV_ASSUME_DISTID=OEL7.8 ; export ORACLE_BASE=/u01/app/oracle; export GRID_HOME=$ORACLE_BASE/19.0.0.0/grid ; \
export ORACLE_HOME=$GRID_HOME ; export PATH=$ORACLE_HOME/bin:$PATH ; cd $ORACLE_HOME 
[oracle@dbalab grid]$ ./gridSetup.sh -silent -responseFile /home/oracle/ohas.rsp
Launching Oracle Grid Infrastructure Setup Wizard...

The response file for this session can be found at:
 /u01/app/oracle/19.0.0.0/grid/install/response/grid_2025-09-14_11-35-54AM.rsp

You can find the log of this install session at:
 /tmp/GridSetupActions2025-09-14_11-35-54AM/gridSetupActions2025-09-14_11-35-54AM.log

As a root user, execute the following script(s):
	1. /u01/app/oraInventory/orainstRoot.sh
	2. /u01/app/oracle/19.0.0.0/grid/root.sh

Execute /u01/app/oracle/19.0.0.0/grid/root.sh on the following nodes: 
[dbalab]



Successfully Setup Software.
As install user, execute the following command to complete the configuration.
	/u01/app/oracle/19.0.0.0/grid/gridSetup.sh -executeConfigTools -responseFile /home/oracle/ohas.rsp [-silent]


Moved the install session logs to:
 /u01/app/oraInventory/logs/GridSetupActions2025-09-14_11-35-54AM

Agora vamos abrir uma nova sessão como root, rodar o scripts de pós instalação.

[root@dbalab ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.

Executando segundo script ainda como root, e verificando log após a execução.

[root@dbalab ~]# /u01/app/oracle/19.0.0.0/grid/root.sh
Check /u01/app/oracle/19.0.0.0/grid/install/root_dbalab.localdomain_2025-09-14_11-38-45-998125316.log for the output of root script
[root@dbalab ~]# cat /u01/app/oracle/19.0.0.0/grid/install/root_dbalab.localdomain_2025-09-14_11-38-45-998125316.log
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/19.0.0.0/grid
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /u01/app/oracle/19.0.0.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/oracle/crsdata/dbalab/crsconfig/roothas_2025-09-14_11-38-46AM.log
LOCAL ADD MODE 
Creating OCR keys for user 'oracle', 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 dbalab successfully pinned.
2025/09/14 11:38:53 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'

dbalab     2025/09/14 11:39:25     /u01/app/oracle/crsdata/dbalab/olr/backup_20250914_113925.olr     724960844     
2025/09/14 11:39:26 CLSRSC-327: Successfully configured Oracle Restart for a standalone server

Agora como oracle vamos executar a última etapa para finalizar a instalação.

[oracle@dbalab grid]$ /u01/app/oracle/19.0.0.0/grid/gridSetup.sh -executeConfigTools -responseFile /home/oracle/ohas.rsp -silent
Launching Oracle Grid Infrastructure Setup Wizard...

You can find the logs of this session at:
/u01/app/oraInventory/logs/GridSetupActions2025-09-14_11-43-12AM

You can find the log of this install session at:
 /u01/app/oraInventory/logs/UpdateNodeList2025-09-14_11-43-12AM.log
Successfully Configured Software.

Instalação concluída com sucesso, só setar as varivavéis de ambiente do ASM.

[oracle@dbalab grid]$ . oraenv
ORACLE_SID = [+ASM] ? +ASM
The Oracle base remains unchanged with value /u01/app/oracle

E validar os resources do cluster.

[oracle@dbalab grid]$ crsctl status res -t ; asmcmd -p lsdg
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       dbalab                   STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       dbalab                   STABLE
ora.asm
               ONLINE  ONLINE       dbalab                   Started,STABLE
ora.ons
               OFFLINE OFFLINE      dbalab                   STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       dbalab                   STABLE
ora.diskmon
      1        OFFLINE OFFLINE                               STABLE
ora.evmd
      1        ONLINE  ONLINE       dbalab                   STABLE
--------------------------------------------------------------------------------
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512             512   4096  4194304     51196    51096                0           51096              0             N  DATA/

Ta pronto.

Um comentário

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *