Tive uma necessidade de montar um laboratório, e para não ter que instalar tudo de novo (S.O, pré-requisitos, ASM, software do Oracle database e o banco de dados em si), preferi clonar a VM que eu tenho no VirtualBox, mas também precisei alterar o hostname e IP, e para poder documentar as etapas, decidir deixar aqui.
Clone:
![](https://swiv.com.br/wp-content/uploads/2022/07/image-296.png)
Definindo local:
![](https://swiv.com.br/wp-content/uploads/2022/07/image-297.png)
Completo:
![](https://swiv.com.br/wp-content/uploads/2022/07/image-298.png)
Estado atual:
![](https://swiv.com.br/wp-content/uploads/2022/07/image-299.png)
![](https://swiv.com.br/wp-content/uploads/2022/07/image-300.png)
Coletando o MAC da máquina e a iniciando:
![](https://swiv.com.br/wp-content/uploads/2022/07/image-301.png)
![](https://swiv.com.br/wp-content/uploads/2022/07/image-302.png)
Logado como root, alterar o script “/etc/udev/rules.d/70-persistent-ipoib.rules” com o MAC coletado acima. Valor antigo:
![](https://swiv.com.br/wp-content/uploads/2022/07/image-303.png)
Valor novo:
![](https://swiv.com.br/wp-content/uploads/2022/07/image-304.png)
Fazendo o mesmo processo no arquivo “/etc/sysconfig/network-scripts/ifcfg-enp0s3”:
![](https://swiv.com.br/wp-content/uploads/2022/07/image-305.png)
Setando o IP (logado como root):
![](https://swiv.com.br/wp-content/uploads/2022/07/image-306.png)
Após o reboot, a configuração do IP já está pronta:
[root@oel7 ~]# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.109 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::69f6:50aa:6546:8819 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:d6:e2:fc txqueuelen 1000 (Ethernet)
RX packets 184051 bytes 277061058 (264.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 50975 bytes 3414287 (3.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Editando o /etc/hosts com o novo IP e realizando o teste de ping:
[root@oel7 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.109 fornix1.localdomain fornix1
[root@oel7 ~]# ping fornix1
PING fornix1.localdomain (192.168.0.109) 56(84) bytes of data.
64 bytes from fornix1.localdomain (192.168.0.109): icmp_seq=1 ttl=64 time=0.076 ms
64 bytes from fornix1.localdomain (192.168.0.109): icmp_seq=2 ttl=64 time=0.283 ms
64 bytes from fornix1.localdomain (192.168.0.109): icmp_seq=3 ttl=64 time=0.133 ms
Configuração do hostname:
[root@oel7 ~]# cat /etc/sysconfig/network
# Created by anaconda
# oracle-database-preinstall-19c : Add NOZEROCONF=yes
NOZEROCONF=yes
NETWORKING=yes
HOSTNAME=fornix1.localdomain
GATEWAY=192.168.0.1
Comando para alterar o hostname:
[root@oel7 ~]# hostnamectl set-hostname fornix1
[root@oel7 ~]#
Após isso, vou ajustar o hostname referenciado no arquivo do listener:
[grid@fornix1 admin]$ cd $ORACLE_HOME/network/admin
[grid@fornix1 admin]$ cat listener.ora
# listener.ora Network Configuration File: /grid/19.3.0/product/network/admin/listener.ora
# Generated by Oracle configuration tools.
#Backup file is /grid/19.3.0/base/crsdata/oel7/output/listener.ora.bak.oel7.grid line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER = ON
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = fornix1.localdomain)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
[grid@fornix1 admin]$
Reboot:
[grid@fornix1 admin]$ su - root
Password:
Last login: Wed Mar 3 20:56:19 -03 2021 from 192.168.0.104 on pts/0
'abrt-cli status' timed out
[root@fornix1 ~]# reboot
Agora vamos reconfigurar o Oracle Restart, devido a alteração de hostname. Executando o script abaixo como root:
[root@fornix1 install]# ./roothas.sh -deconfig -force
Using configuration parameter file: /grid/19.3.0/product/crs/install/crsconfig_params
The log of current session can be found at:
/grid/19.3.0/base/crsdata/fornix1/crsconfig/hadeconfig.log
PRCR-1070 : Failed to check if resource ora.asm is registered
CRS-5168 : unable to communicate with ohasd
2021/03/04 05:37:00 CLSRSC-180: An error occurred while executing the command '/grid/19.3.0/product/bin/srvctl remove asm -force'
PRCR-1070 : Failed to check if resource ora.ons is registered
CRS-5168 : unable to communicate with ohasd
2021/03/04 05:37:01 CLSRSC-180: An error occurred while executing the command '/grid/19.3.0/product/bin/srvctl config ons'
CLSU-00107: operating system function: opendir; failed with error data: 2; at location: scrsearch1
CLSU-00101: operating system error message: No such file or directory
CLSU-00104: additional error information: cant open scr home dir scls_scr_getval
CRS-4639: Could not contact Oracle High Availability Services
CRS-4000: Command Stop failed, or completed with errors.
2021/03/04 05:37:05 CLSRSC-337: Successfully deconfigured Oracle Restart stack
[root@fornix1 install]#
Ao tentar executar o roothas.sh, é possível notar erros sendo mencionados:
[root@fornix1 install]# ./roothas.sh
Using configuration parameter file: /grid/19.3.0/product/crs/install/crsconfig_params
The log of current session can be found at:
/grid/19.3.0/base/crsdata/fornix1/crsconfig/roothas_2021-03-04_05-38-41AM.log
2021/03/04 05:38:45 CLSRSC-363: User ignored prerequisites during installation
Oracle Clusterware infrastructure error in OCRCONFIG (OS PID 28333): CLSD/ADR initialization failed with return value -1
1: clskec:has:CLSU:910 4 args[clsdAdr_CLSK_err][mod=clsdadr.c][loc=(:CLSD00050:)][msg=2021-03-04 05:38:49.533 (:CLSD00050:) dbgc_init_all failed with return code 49802. Detected in function clsdAdrInit at line number 1828. ]
2: clskec:has:CLSU:910 4 args[clsdAdrInit_CLSK_err][mod=clsdadr.c][loc=(:CLSD00281:)][msg=clsdAdrInit: Additional diagnostic data returned by the ADR component for dbgc_init_all failure:
DIA-49802: missing read, write, or execute permission on specified ADR home directory [/grid/19.3.0/base/diag/crs/fornix1/crs/log]
DIA-49801: actual permissions [rwxrwx---], expected minimum permissions [rwxrwxrwx] for effective user [grid]
DIA-48188: user missing read, write, or exec permission on specified directory
Linux-x86_64 Error: 13: Permission denied
Additional information: 2
Additional information: 511
Additional information: 16888
([all diagnostic data retrieved from ADR])]
Oracle Clusterware infrastructure error in CLSCFG (OS PID 28351): CLSD/ADR initialization failed with return value -1
1: clskec:has:CLSU:910 4 args[clsdAdr_CLSK_err][mod=clsdadr.c][loc=(:CLSD00050:)][msg=2021-03-04 05:38:49.855 (:CLSD00050:) dbgc_init_all failed with return code 49802. Detected in function clsdAdrInit at line number 1828. ]
2: clskec:has:CLSU:910 4 args[clsdAdrInit_CLSK_err][mod=clsdadr.c][loc=(:CLSD00281:)][msg=clsdAdrInit: Additional diagnostic data returned by the ADR component for dbgc_init_all failure:
DIA-49802: missing read, write, or execute permission on specified ADR home directory [/grid/19.3.0/base/diag/crs/fornix1/crs/log]
DIA-49801: actual permissions [rwxrwx---], expected minimum permissions [rwxrwxrwx] for effective user [grid]
DIA-48188: user missing read, write, or exec permission on specified directory
Linux-x86_64 Error: 13: Permission denied
Additional information: 2
Additional information: 511
Additional information: 16888
([all diagnostic data retrieved from ADR])]
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 fornix1 successfully pinned.
2021/03/04 05:38:56 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
2021/03/04 05:41:15 CLSRSC-214: Failed to start the resource 'ohasd'
Failed to start the Clusterware. Last 20 lines of the alert log follow:
2021-03-04 05:37:03.548 [CLSECHO(27719)]ACFS-9294: updating file /etc/sysconfig/oracledrivers.conf
2021-03-04 05:38:52.851 [CLSCFG(28420)]CRS-1001: The OCR was formatted using version 4.
2021/03/04 05:41:15 CLSRSC-318: Failed to start Oracle OHASD service
Died at /grid/19.3.0/product/crs/install/crsinstall.pm line 3209.
The command '/grid/19.3.0/product/perl/bin/perl -I/grid/19.3.0/product/perl/lib -I/grid/19.3.0/product/crs/install -I/grid/19.3.0/product/xag /grid/19.3.0/product/crs/install/roothas.pl ' execution failed
[root@fornix1 install]#
Percebi que a falha ocorria devido falta de privilégio na camada de S.O. Fazendo os ajustes:
[root@fornix1 crs]# chown -R grid:oinstall fornix1/
[root@fornix1 crs]# chmod 775 -R fornix1/
[root@fornix1 crs]# pwd
/grid/19.3.0/base/diag/crs
Reexecutando:
[root@fornix1 ~]# /grid/19.3.0/product/crs/install/roothas.sh
Using configuration parameter file: /grid/19.3.0/product/crs/install/crsconfig_params
The log of current session can be found at:
/grid/19.3.0/base/crsdata/fornix1/crsconfig/roothas_2021-03-04_01-10-23PM.log
2021/03/04 13:10:24 CLSRSC-363: User ignored prerequisites during installation
2021/03/04 13:10:27 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
fornix1 2021/03/04 13:11:13 /grid/19.3.0/base/crsdata/fornix1/olr/backup_20210304_131113.olr 724960844
2021/03/04 13:11:14 CLSRSC-327: Successfully configured Oracle Restart for a standalone server
[root@fornix1 ~]#
Adicionando e iniciando o ASM:
[grid@fornix1 bin]$ srvctl add asm
[grid@fornix1 bin]$ srvctl start asm
Listener:
[grid@fornix1 bin]$ srvctl add listener
[grid@fornix1 bin]$ srvctl start listener
Criando um pfile para a instância ASM:
[grid@fornix1 dbs]$ pwd
/grid/19.3.0/product/dbs
[grid@fornix1 dbs]$ vi init+ASM.ora
[grid@fornix1 dbs]$ cat init+ASM.ora
asm_diskgroups='DG_DATA','DG_FRA','DG_RECO', 'DG_GRID'
instance_type='asm'
large_pool_size=12M
remote_login_passwordfile='EXCLUSIVE'
ASM_DISKSTRING='/dev/oracleasm/disks/*'
[grid@fornix1 dbs]$
Subindo o ASM:
[grid@fornix1 dbs]$ sqlplus / as sysasm
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Mar 4 13:55:26 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup pfile='init+ASM.ora';
ASM instance started
Total System Global Area 1137173320 bytes
Fixed Size 8905544 bytes
Variable Size 1103101952 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL> !asmcmd lsdg
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 30716 27228 0 27228 0 N DG_DATA/
MOUNTED EXTERN N 512 512 4096 4194304 20476 19728 0 19728 0 N DG_FRA/
MOUNTED EXTERN N 512 512 4096 4194304 10236 10136 0 10136 0 N DG_GRID/
MOUNTED EXTERN N 512 512 4096 4194304 10236 9152 0 9152 0 N DG_RECO/
SQL>
Criando SPFILE:
SQL> CREATE SPFILE='+DG_GRID' FROM PFILE='init+ASM.ora';
File created.
Adicionando o database ao HAS:
[oracle@fornix1 ~]$ srvctl add database -db cortex -oraclehome /oracle/19.3.0/product -domain localdomain -spfile +DG_DATA/CORTEX/PARAMETERFILE/spfile.265.1039034301 -role PRIMARY -startoption OPEN -dbname cortex -policy AUTOMATIC -diskgroup "DG_DATA,DG_FRA,DG_RECO"
[oracle@fornix1 ~]$
Fazendo o stop/start do HAS:
[grid@fornix1 bin]$ crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'fornix1'
CRS-2673: Attempting to stop 'ora.evmd' on 'fornix1'
CRS-2673: Attempting to stop 'ora.DG_GRID.dg' on 'fornix1'
CRS-2673: Attempting to stop 'ora.cortex.db' on 'fornix1'
CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'fornix1'
CRS-2677: Stop of 'ora.DG_GRID.dg' on 'fornix1' succeeded
CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'fornix1' succeeded
CRS-2677: Stop of 'ora.evmd' on 'fornix1' succeeded
CRS-2677: Stop of 'ora.cortex.db' on 'fornix1' succeeded
CRS-2673: Attempting to stop 'ora.DG_DATA.dg' on 'fornix1'
CRS-2673: Attempting to stop 'ora.DG_FRA.dg' on 'fornix1'
CRS-2673: Attempting to stop 'ora.DG_RECO.dg' on 'fornix1'
CRS-2677: Stop of 'ora.DG_RECO.dg' on 'fornix1' succeeded
CRS-2677: Stop of 'ora.DG_DATA.dg' on 'fornix1' succeeded
CRS-2677: Stop of 'ora.DG_FRA.dg' on 'fornix1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'fornix1'
CRS-2677: Stop of 'ora.asm' on 'fornix1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'fornix1'
CRS-2677: Stop of 'ora.cssd' on 'fornix1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'fornix1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
[grid@fornix1 bin]$ crsctl start has
CRS-4123: Oracle High Availability Services has been started.
Validando ambiente:
[grid@fornix1 bin]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name Target State Server State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DG_DATA.dg
ONLINE ONLINE fornix1 STABLE
ora.DG_FRA.dg
ONLINE ONLINE fornix1 STABLE
ora.DG_GRID.dg
ONLINE ONLINE fornix1 STABLE
ora.DG_RECO.dg
ONLINE ONLINE fornix1 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE fornix1 STABLE
ora.asm
ONLINE ONLINE fornix1 Started,STABLE
ora.ons
OFFLINE OFFLINE fornix1 STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cortex.db
1 ONLINE ONLINE fornix1 Open,HOME=/oracle/19
.3.0/product,STABLE
ora.cssd
1 ONLINE ONLINE fornix1 STABLE
ora.diskmon
1 OFFLINE OFFLINE STABLE
ora.evmd
1 ONLINE ONLINE fornix1 STABLE
--------------------------------------------------------------------------------
[grid@fornix1 bin]$
Obs: Este procedimento foi criado pelo senhor Ahmed Baraka (www.ahmedbaraka.com) e foi apenas reproduzido por mim em um laboratório pessoal para fins de aprendizado.