Mover Agente de Cloud (OH) de un folder a otro ( o Filesystem).

Raúl Antonio Molina Alvarenga

07 de Agosto de 2023

#OracleACEAssociate

Hola, un día me enfrente a la siguiente situación: Instale un agente de Cloud Control en la ruta equivocada.

Y se nos viene la idea, fácil, lo remueve y lo reinstalo.

Esto podrá ser fácil, pero si puede complicarse si la red es lenta, es un sitio remoto, etc etc.

Y si existe una forma mas fácil, porque no la ejecutamos?, bueno aquí veremos algo que para mi criterio resulta, más fácil.

Usaremos el DOCID:

Que nos provee el script:

ConvertToStandalone.pl

Hay que tener algunas consideraciones con la nota, hay que definir estas 2 variables de SO:

El Home no es el agent_inst es el $OH/core/Version12c
export OLD_AGENT_HOME=/oracle/agent12c/core/12.1.0.5.0
export ORACLE_HOME=/oracle/agent12c/core/12.1.0.5.0

Generamos el plugin list

$OLD_AGENT_HOME/perl/bin/perl /tfs/oracle/agent12c/core/12.1.0.5.0/sysman/install/create_plugin_list.pl -instancehome /tfs/oracle/agent12c/core/12.1.0.5.0

The agent Base Dir is /oracle/agent12c

 Creating file : /oracle/agent12c/rwFile

Removed the /oracle/agent12c/rwFile file.

oracle.sysman.xa|12.1.0.6.0||discoveryPlugin

oracle.sysman.db|12.1.0.8.0||discoveryPlugin

oracle.sysman.emas|12.1.0.8.0||discoveryPlugin

oracle.sysman.oh|12.1.0.5.0||discoveryPlugin

oracle.sysman.oh|12.1.0.5.0||agentPlugin
oracle.sysman.db|12.1.0.8.0||agentPlugin
/oracle/agent12c/plugins.txt
[oracle@nodo ~]$ 

Cambiar archivo agent12c/agentimage.properties  la ultima  linea

SBIN_MODIFIED_VERSION=12.1.0.5.0

$OLD_AGENT_HOME/perl/bin/perl  ConvertToStandalone.pl -instanceHome /oracle/agent12c/agent_inst -newAgentBaseDir /export/home/oracle/agent12c

OUTPUT

Migrating the agent home to different home

Validating the arguments

The log file is /oracle/agent12c/agent_inst/install/logs/convert/convertingtostandalone_2023-07-05_16-29-55.log

The agent image file Exists : /oracle/agent12c/agentimage.properties. Check for value of : VERSION

The current home is /oracle/agent12c/core/12.1.0.5.0Software only install of the agent bits

Home : /home/oracle/agent12c/core/12.1.0.5.0 already exist. Do you want to overwrite the home? Confirm (y/n)y

User confirmed for overwrite.

 The command is cp -r /oracle/agent12c/core /oracle/agent12c/plugins /oracle/agent12c/agentimage.properties /oracle/agent12c/plugins.txt /home/oracle/agent12c 

The command exitcode 0

The command is cp -r /oracle/agent12c/sbin /home/oracle/agent12c 

cp: cannot open ‘/oracle/agent12c/sbin/nmo’ for reading: Permission denied

cp: cannot open ‘/oracle/agent12c/sbin/nmhs’ for reading: Permission denied

cp: cannot open ‘/oracle/agent12c/sbin/nmb’ for reading: Permission denied

The command exitcode 256

Copying of /oracle/agent12c/sbinto /home/oracle/agent12c Failed

The command is /home/oracle/agent12c/core/12.1.0.5.0/oui/bin/runInstaller -clone -forceClone -silent -waitForCompletion -nowait ORACLE_HOME=/home/oracle/agent12c/core/12.1.0.5.0 -noconfig -force EM_PROTOCOL=https ORACLE_HOME_NAME=agent12c -invPtrLoc /oracle/agent12c/core/12.1.0.5.0/oraInst.loc AGENT_BASE_DIR=/home/oracle/agent12c 

The command exitcode 0

The command is /home/oracle/agent12c/core/12.1.0.5.0/oui/bin/runInstaller -attachHome -force -silent ORACLE_HOME=/home/oracle/agent12c/sbin ORACLE_HOME_NAME=sbin12c -waitForCompletion -invPtrLoc /oracle/agent12c/core/12.1.0.5.0/oraInst.loc 

The command exitcode 0

The command is /home/oracle/agent12c/core/12.1.0.5.0/oui/bin/runInstaller -updateHomeDeps -waitForCompletion HOME_DEPENDENCY_LIST={/home/oracle/agent12c/sbin:/home/oracle/agent12c/core/12.1.0.5.0} -invPtrLoc /oracle/agent12c/core/12.1.0.5.0/oraInst.loc  

The command exitcode 0

Converting the agent to standalone

The command is /oracle/agent12c/agent_inst/bin/emctl start blackout AGT_CNT_BLK_OUT -nodeLevel 

The command exitcode 0

The command is /oracle/agent12c/agent_inst/bin/emctl stop agent 

The command exitcode 0

The command is cp -r /oracle/agent12c/agent_inst/* /home/oracle/agent12c/agent_inst 

The command exitcode 0

The command is /home/oracle/agent12c/core/12.1.0.5.0/jdk/bin/java -jar /home/oracle/agent12c/core/12.1.0.5.0/jlib/updateStateDirectory.jar -migrateBase -emStateDir /home/oracle/agent12c/agent_inst -oldAgentHome /oracle/agent12c/core/12.1.0.5.0 -newAgentHome /home/oracle/agent12c/core/12.1.0.5.0 -oldAgentBase /oracle/agent12c -newAgentBase /home/oracle/agent12c 

The command exitcode 0

The command is /home/oracle/agent12c/agent_inst/bin/emctl setproperty agent -name agentStateDir -value /home/oracle/agent12c/agent_inst 

The command exitcode 0

The command is /home/oracle/agent12c/core/12.1.0.5.0/perl/bin/perl /home/oracle/agent12c/core/12.1.0.5.0/bin/AgentPluginDeploy.pl -oracleHome /home/oracle/agent12c/core/12.1.0.5.0 -agentDir /home/oracle/agent12c -pluginIdsInfoFile /home/oracle/agent12c/plugins.txt -action upgrade -emStateDir /home/oracle/agent12c/agent_inst -ignoreUnzip -dont_restart   

The command exitcode 0

The command is /home/oracle/agent12c/agent_inst/bin/emctl update_inventory plugin 

The command exitcode 0

The command is /home/oracle/agent12c/core/12.1.0.5.0/jdk/bin/java -jar /home/oracle/agent12c/core/12.1.0.5.0/jlib/upgradeCollections.jar -emStateDir /home/oracle/agent12c/agent_inst -newPluginXml /home/oracle/agent12c/core/12.1.0.5.0/sysman/admin/agentLib.xml -oldPluginXml /oracle/agent12c/core/12.1.0.5.0/sysman/admin/agentLib.xml 

log4j:ERROR No appenders could be found for category (oracle.sysman.gcagent.util.logging.ODLLogging).

log4j:ERROR Please initialize the log4j system properly.

The command exitcode 0

The command is /home/oracle/agent12c/agent_inst/bin/emctl start agent 

The command exitcode 0

The command is /home/oracle/agent12c/agent_inst/bin/emctl stop blackout AGT_CNT_BLK_OUT  

The command exitcode 0

The command is mv /oracle/agent12c/agent_inst/bin/emctl /oracle/agent12c/agent_inst/bin/emctl_converted 

The command exitcode 0

Move of File :  /oracle/agent12c/agent_inst/bin/emctl to File : /oracle/agent12c/agent_inst/bin/emctl_converted is successfully done

Modifying the oragchomelist to include the current agent home with the instancehome

The migration is completed Successfully. Run /home/oracle/agent12c/core/12.1.0.5.0/root.sh as root user manually.

Deinstall agent home /oracle/agent12c/core/12.1.0.5.0 manually.

[oracle@nodo ~]$ exit

logout

Ejecutamos el script de root de nuevo:

[root@nodo ~]# /home/oracle/agent12c/core/12.1.0.5.0/root.sh

Con esto el agente de movio de folder a un nuevo directorio.

Espero les sea de Utilidad

Saludos

Adenda de despliegue, cuando se debe forzar el HOSTNAME

EM 12c: Agent installation reports failure for Hostname pre-requisite check – “The host name specified for the installation or retrieved from the system is incorrect” (Doc ID 1488737.1)
/agentDeploy.sh AGENT_BASE_DIR=<Agent Base Directory Path> OMS_HOST=<OMS Host Name> EM_UPLOAD_PORT=<OMS Upload Port> ORACLE_HOSTNAME=mypc.oracle.com