Problema
Durante um rollback de patch Out-Of-Place do Grid Infrastructure, uma tentativa de executar o switchGiHome a partir do GI Home original falhou com esse erro:
[grid@rac02 trace]$ $ORACLE_HOME/gridSetup.sh -silent -switchGridHome oracle.install.option=CRS_SWONLY ORACLE_HOME=$ORACLE_HOME oracle.install.crs.config.clusterNodes=rac02
Launching Oracle Grid Infrastructure Setup Wizard...
You can find the log of this install session at:
/u01/app/oraInventory/logs/cloneActions2023-09-24_03-38-23PM.log
Could not backup file /u01/app/product/19.0.0.0/grid/perl/bin/ptar to /u01/app/product/19.0.0.0/grid/perl/bin/ptar.ouibak
Could not backup file /u01/app/product/19.0.0.0/grid/perl/bin/podchecker to /u01/app/product/19.0.0.0/grid/perl/bin/podchecker.ouibak
.....
[FATAL] Failed to restore the saved templates to the Oracle home being cloned. Aborting the clone operation.
Esse erro ocorre porque o usuário grid não tem permissão de escrita nos arquivos do GI Home original, pelo fato do binário estar “lockado”. Quando executamos o gridSetup.sh -switchGiHome pela primeira vez para trocar Grid Home, o binário novo vem desbloqueado por padrão, então o comando funciona sem maiores problemas. Por outro lado, quando executamos este mesmo comando para voltar para o GRID Home original, este normalmente estará bloqueado.
Solução
1) Com root, defina a variável de ambiente ORACLE_HOME apontando para o GI Home que está tentando executar o switchGiHome:
export ORACLE_HOME=/u01/app/product/19.0.0.0/grid
2) Execute o script rootcrs.sh com a opção de -unlock:
$ORACLE_HOME/crs/install/rootcrs.sh -unlock -crshome $ORACLE_HOME
3) Com o usuário grid, execute –switchGiHome novamente, agora deve funcionar sem erros.
$ORACLE_HOME/gridSetup.sh -silent -switchGridHome oracle.install.option=CRS_SWONLY ORACLE_HOME=$ORACLE_HOME oracle.install.crs.config.clusterNodes=rac02
Exemplo
Com root:
[root@rac02 ~]# export ORACLE_HOME=/u01/app/product/19.0.0.0/grid
[root@rac02 ~]# $ORACLE_HOME/crs/install/rootcrs.sh -unlock -crshome $ORACLE_HOME
Using configuration parameter file: /u01/app/product/19.0.0.0/grid_home2/crs/install/crsconfig_params
The log of current session can be found at:
/u01/app/grid/crsdata/rac02/crsconfig/crsunlock_rac02_2023-09-24_03-39-29PM.log
2023/09/24 15:39:30 CLSRSC-347: Successfully unlock /u01/app/product/19.0.0.0/grid
Com grid:
[grid@rac02]$ $ORACLE_HOME/gridSetup.sh -silent -switchGridHome oracle.install.option=CRS_SWONLY ORACLE_HOME=$ORACLE_HOME oracle.install.crs.config.clusterNodes=rac02
Launching Oracle Grid Infrastructure Setup Wizard...
You can find the log of this install session at:
/u01/app/oraInventory/logs/cloneActions2023-09-24_03-39-33PM.log
As a root user, execute the following script(s):
1. /u01/app/product/19.0.0.0/grid/root.sh
Execute /u01/app/product/19.0.0.0/grid/root.sh on the following nodes:
[rac02]
You can find the log of this install session at:
/u01/app/oraInventory/logs/UpdateNodeList2023-09-24_03-39-33PM.log
You can find the log of this install session at:
/u01/app/oraInventory/logs/UpdateNodeList2023-09-24_03-39-33PM.log
Successfully Setup Software.