O processo de alteração do hostname e reconfiguração do Grid é relativamente simples e pode ser feito de acordo com os passos abaixo.
Este processo foi validado em um ambiente Oracle Grid 19.3 com Oracle database 19.3 instalados em um Oracle Linux 7.9.
Na alteração em ambientes que esteja ativos (operantes), é necessário que você pare todos os serviços antes de realizar a alteração do hostname. Também é recomendável que seja feito um backup do grid antes do processo.
Parar os serviços:
[root@lamimtst ~]# service ohasd stop
Parados os serviços, efetuado o backup do produto e alterado o hostname da máquina, será necessário remover a configuração existente. Com o usuário root, devem ser exportadas as variáveis do grid ORACLE_HOME e ORACLE_SID e executado o comando abaixo.
[root@lamimtst ~]# $ORACLE_HOME/perl/bin/perl -I $ORACLE_HOME/perl/lib -I $ORACLE_HOME/crs/install $ORACLE_HOME/crs/install/roothas.pl -deconfig -force
Using configuration parameter file: /orabin01/app/19c/grid/crs/install/crsconfig_params
The log of current session can be found at:
/orabin01/app/oracle/crsdata/lamimtst/crsconfig/hadeconfig.log
PRCR-1070 : Failed to check if resource ora.asm is registered
CRS-5168 : unable to communicate with ohasd
2021/09/23 07:53:49 CLSRSC-180: An error occurred while executing the command '/orabin01/app/19c/grid/bin/srvctl remove asm -force'
PRCR-1070 : Failed to check if resource ora.ons is registered
CRS-5168 : unable to communicate with ohasd
2021/09/23 07:53:50 CLSRSC-180: An error occurred while executing the command '/orabin01/app/19c/grid/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/09/23 07:53:53 CLSRSC-337: Successfully deconfigured Oracle Restart stack
[root@lamimtst ~]#
Após remover a configuração do grid, pode ser efetuada a alteração do hostname. Neste exemplo, a maquina havia sido clonada e o hostname já alterado, desta forma a etapa de remoção da configuração do grid foi realizada após a alteração do hostname.
O processo de alteração do hostname a partir do Oracle Linux 7 poder ser ver consultado aqui.
Concluídas as etapas acima, será realizada a reconfiguração do grid, conforme abaixo.
[root@lamimtst ~]#
[root@lamimtst ~]# $ORACLE_HOME/perl/bin/perl -I $ORACLE_HOME/perl/lib -I $ORACLE_HOME/crs/install $ORACLE_HOME/crs/install/roothas.pl
Using configuration parameter file: /orabin01/app/19c/grid/crs/install/crsconfig_params
The log of current session can be found at:
/orabin01/app/oracle/crsdata/lamimtst/crsconfig/roothas_2021-09-23_07-58-56AM.log
2021/09/23 07:59:01 CLSRSC-363: User ignored prerequisites during installation
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 lamimtst successfully pinned.
2021/09/23 07:59:13 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
lamimtst 2021/09/23 08:00:11 /orabin01/app/oracle/crsdata/lamimtst/olr/backup_20210923_080011.olr 724960844
2021/09/23 08:00:12 CLSRSC-327: Successfully configured Oracle Restart for a standalone server
[root@lamimtst ~]#
Ajustar o listener para responder para o novo hostname. O procedimento de reconfiguração do listener pode ser feito também dropando o listener antigo e recriando o mesmo com a ferramenta netca
vi $ORACLE_HOME/network/admin/listener.ora
Adicionar o recurso do listener no Oracle Grid.
[root@lamimtst ~]#
[root@lamimtst ~]# srvctl add listener
[root@lamimtst ~]#
Os discos do ASM não são adicionados automaticamente após a reconfiguração, por isso é necessário adiciona-los novamente.
Para discos criados com o asm lib:
[root@lamimtst ~]# [root@lamimtst ~]# srvctl add asm -d '/dev/oracleasm/*' [root@lamimtst ~]# oracleasm listdisks ASMDISK001 ASMDISK002 ASMDISK003 ASMDISK004 ASMDISK005 [root@lamimtst ~]#
srvctl add asm -d '/dev/sd*'
Iniciar o listener e o ASM.
[root@lamimtst ~]# [root@lamimtst ~]# srvctl start listener [root@lamimtst ~]# srvctl start asm [root@lamimtst ~]# crsctl stat res -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.LISTENER.lsnr ONLINE ONLINE lamimtst STABLE ora.asm ONLINE ONLINE lamimtst Started,STABLE ora.ons OFFLINE OFFLINE lamimtst STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.cssd 1 ONLINE ONLINE lamimtst STABLE ora.diskmon 1 OFFLINE OFFLINE STABLE ora.evmd 1 ONLINE ONLINE lamimtst STABLE -------------------------------------------------------------------------------- [root@lamimtst ~]#
[oracle@lamimtst ~]$ asmcmd
ASMCMD> mount DGDATA
ORA-15032: not all alterations performed
ORA-15017: diskgroup "DGDATA" cannot be mounted
ORA-15040: diskgroup is incomplete (DBD ERROR: OCIStmtExecute)
ASMCMD>
ASMCMD> mount DGDATA
ORA-15032: not all alterations performed
ORA-15017: diskgroup "DGDATA" cannot be mounted
ORA-15040: diskgroup is incomplete (DBD ERROR: OCIStmtExecute)
ASMCMD> exit
[oracle@lamimtst ~]$
[oracle@lamimtst ~]$
[oracle@lamimtst ~]$ kfod asm_diskstring='/dev/oracleasm/disks/*' disks=all
--------------------------------------------------------------------------------
Disk Size Path User Group
================================================================================
1: 10239 MB /dev/oracleasm/disks/ASMDISK001 oracle oinstall
2: 10239 MB /dev/oracleasm/disks/ASMDISK002 oracle oinstall
3: 10239 MB /dev/oracleasm/disks/ASMDISK003 oracle oinstall
4: 10239 MB /dev/oracleasm/disks/ASMDISK004 oracle oinstall
5: 10239 MB /dev/oracleasm/disks/ASMDISK005 oracle oinstall
--------------------------------------------------------------------------------
ORACLE_SID ORACLE_HOME
================================================================================
+ASM /orabin01/app/19c/grid
[oracle@lamimtst ~]$ sqlplus
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Sep 23 08:25:30 2021
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Enter user-name: / as sysasm
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> show parameter asm_diskstring;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
asm_diskstring string
SQL>
SQL> alter system set asm_diskstring='/dev/oracleasm/disks/*' scope=memory;
System altered.
SQL> select name, state from v$asm_diskgroup;
NAME STATE
------------------------------ -----------
DGDATA DISMOUNTED
SQL>
SQL> alter diskgroup DGDATA mount;
Diskgroup altered.
SQL>
[oracle@lamimtst ~]$ srvctl status diskgroup -g DGDATA
Disk Group DGDATA is running on lamimtst
[oracle@lamimtst ~]$
[oracle@lamimtst ~]$ [oracle@lamimtst ~]$ srvctl add database -d lamimtst -o /orabin01/app/oracle/product/19c/dbhome_1 -n lamimtst -p +DGDATA/LAMIMTST/PARAMETERFILE/spfile.270.1083870825 [oracle@lamimtst ~]$
[oracle@lamimtst ~]$ srvctl start database -d lamimtst
[oracle@lamimtst ~]$
[oracle@lamimtst ~]$ srvctl status database -d lamimtst
Database is running.
[oracle@lamimtst ~]$ srvctl config database -d lamimtst -a
Database unique name: lamimtst
Database name: lamimtst
Oracle home: /orabin01/app/oracle/product/19c/dbhome_1
Oracle user: oracle
Spfile: +DGDATA/LAMIMTST/PARAMETERFILE/spfile.270.1083870825
Password file:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Disk Groups: DGDATA
Services:
Database is enabled
OSDBA group:
OSOPER group:
Database instance: lamimtst
[oracle@lamimtst ~]$
How to change Hostname / IP for a Grid Infrastructure Oracle Restart Standalone Configuration (SIHA) 11.2 and Later (Doc ID 1552810.1)
Boa Lamim....salvou meu laboratório!
ResponderExcluir