Hola amigos, en la entrada de hoy veremos los pasos para cambiar el nombre de host público para una Standalone Grid Infrastructure. Es muy útil si queremos montar un entorno en paralelo, y después hacer swap a Producción. También nos puede servir para clonar entornos con diferente nombre y propósitos. Es un procedimiento sencillo donde prácticamente todo lo hace el motor, nosotros solo lo vamos guiando.
Los pasos para realizar la operativa son los siguientes:
1. Paramos el has
$GRID_HOME/bin/crsctl stop has
2 . Pasamos la herramienta deconfig (con usuario root)
export GRID_HOME=/app/oracle/product/12.1.0.2/grid $GRID_HOME/crs/install/roothas.pl -deconfig -force [root@oraclehost1 ~]# /app/oracle/product/12.1.0.2/grid/crs/install/roothas.pl -deconfig -force Using configuration parameter file: /app/oracle/product/12.1.0.2/grid/crs/install/crsconfig_params 2019/10/09 13:19:13 CLSRSC-337: Successfully deconfigured Oracle Restart stack

En entornos Windows el fichero se está situado en:
\app\oracle\product\12.2.0\grid\crs\config\gridconfig.bat
3. Ejecutamos el script de reconfig con el usuario root
export GRID_HOME=/app/oracle/product/12.1.0.2/grid $GRID_HOME/root.sh [root@oraclehost1 grid]# /app/oracle/product/12.1.0.2/grid/root.sh Performing root user operation. The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /app/oracle/product/12.1.0.2/grid Enter the full pathname of the local bin directory: [/usr/local/bin]: The contents of "dbhome" have not changed. No need to overwrite. The contents of "oraenv" have not changed. No need to overwrite. The contents of "coraenv" have not changed. No need to overwrite. 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: /app/oracle/product/12.1.0.2/grid/crs/install/crsconfig_params 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 oraclehost1 successfully pinned. 2019/10/09 13:24:00 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service' oraclehost1 2019/10/09 13:24:30 /app/oracle/product/12.1.0.2/grid/cdata/oraclehost1/backup_20211019_131230.olr 1721139106 CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'oraclehost1' CRS-2673: Attempting to stop 'ora.evmd' on 'oraclehost1' CRS-2677: Stop of 'ora.evmd' on 'oraclehost1' succeeded CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'oraclehost1' has completed CRS-4133: Oracle High Availability Services has been stopped. CRS-4123: Oracle High Availability Services has been started. 2019/10/09 13:27:28 CLSRSC-327: Successfully configured Oracle Restart for a standalone server.
4. Nos logamos en como owner del grid y modificamos la siguiente propiedad css
$ $GRID_HOME/bin/crsctl modify resource “ora.cssd” -init -attr “AUTO_START=1” -unsupported
5. Reiniciamos el has
$ $GRID_HOME/bin/crsctl stop has CRS-2791: Starting shutdown of Oracle High Availability Servic es-managed resources on 'oraclehost1' CRS-2673: Attempting to stop 'ora.evmd' on 'oraclehost1' CRS-2677: Stop of 'ora.evmd' on 'oraclehost1' succeeded CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'oraclehost1' has completed CRS-4133: Oracle High Availability Services has been stopped. $ $GRID_HOME/bin/crsctl start has CRS-4123: Oracle High Availability Services has been started.
6. Comprobamos el estado de los recursos:
cd $GRID_HOME/bin $ ./crsctl check has CRS-4638: Oracle High Availability Services is online $ ./crsctl check css CRS-4529: Cluster Synchronization Services is online $ ./crsctl stat resource NAME=ora.cssd TYPE=ora.cssd.type TARGET=ONLINE STATE=ONLINE on oraclehost1 NAME=ora.diskmon TYPE=ora.diskmon.type TARGET=OFFLINE STATE=OFFLINE NAME=ora.evmd TYPE=ora.evm.type TARGET=ONLINE STATE=ONLINE on oraclehost1 NAME=ora.ons TYPE=ora.ons.type TARGET=OFFLINE STATE=OFFLINE $ ./crsctl stat res -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.ons OFFLINE OFFLINE oraclehost1 STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.cssd 1 ONLINE ONLINE oraclehost1 STABLE ora.diskmon 1 OFFLINE OFFLINE STABLE ora.evmd 1 ONLINE ONLINE oraclehost1 STABLE -------------------------------------------------------------------------------- $
7. Configuramos el listener
Estamos usando el puerto por defecto, por lo que ejecutaremos:
srvctl add listener srvctl start listener
8. Preparamos y creamos la instancia de +ASM
create the asm pfile as below: $ cat init+ASM.ora +ASM1.__oracle_base='/gridapp/app/oracle'#ORACLE_BASE set from in memory value *.asm_diskstring='/dev/oracleasm/disks/*' *.asm_power_limit=16 *.large_pool_size=12M *.instance_type='asm' start the asm instance: SQL> startup pfile=init+ASM.ora SQL> select instance_name,status from gv$Instance; INSTANCE_NAME STATUS ---------------- ------------ +ASM STARTED SQL> select path from v$asm_disk; PATH -------------------------------------------------------------------------------- /dev/oracleasm/disks/MGMTD SQL> create spfile from pfile; File created. Modify asm properties. $ srvctl modify asm -p /app/oracle/product/12.1.0.2/grid/dbs/spfile+ASM.ora $ srvctl modify asm -l LISTENER $ srvctl config asm ASM home: Password file: ASM listener: LISTENER Spfile: /app/oracle/product/12.1.0.2/grid/dbs/spfile+ASM.ora ASM diskgroup discovery string: /dev/oracleasm/disks/*
9. Una vez lo tengamos todo, reiniciamos el has completamente para ver que todo arranca bien.
$GRID_HOME/bin/crsctl stop has $GRID_HOME/bin/crsctl start has
Con este último reinicio ya tendríamos nuestro entorno con el nuevo cambio de nombre y funcionando con normalidad.
Más información en: https://docs.oracle.com/en/database/oracle/oracle-database/12.2/ntdbi/troubleshooting-host-name-changes-and-css.html#GUID-80D61C9B-5520-4492-AE69-F2DD8866A837
Esperamos que os haya sido de utilidad, si necesitáis una mano o consejo sobre BBDD, no dudéis en contactar con nosotros.
Más información sobre Oracle en: https://www.gpsos.es/category/bases-de-datos/oracle/
¿Aún no conoces Query Performance? Descubre cómo puede ayudarte en tu entorno Oracle. Más información en su página de LinkedIn.
Sígue a GPS en LinkedIn
Pasos para cambiar el nombre de host público para una Standalone Grid infrastructure