MigraTI - Soluções em banco de dados

segunda-feira, 7 de março de 2011

Erro no Enterprise Manager após mudanças de Horário de verão.

Buenas.

Este erro ocorre em 100% dos Bancos que estão configurados o EM, ao trocar a hora no server referente ao horário de verão o EM até levanta mas mostra vários erros na tela se tornando impossível trabalhar.

Para resolver este problema vou postar um script muito útil que poderá lhe ajudar apenas executando um comando.

Vale lembrar que este script é utilizado apenas para plataforma UNIX.
Antes de rodar o script, certifique-se de que a variável TZ esteja configurada no server.

Copiar e colar o script abaixo em um arquivo sh e mandar executar.

#######################################
# SCRIPT NAME: set_agent_tzrgn.sh
# PURPOSE: Update the timezone for dbsoncole. FYI - database timezone should be updated first.
# USAGE . ./set_agent_tzrgn
# Configure the oracle home and ORACLE_SID before sourcing this script.
#
#set -vx

echo "Report the current timezone from the OS."
echo $TZ

echo "Check to see if the reported timezone is supported by the agent."
grep $TZ $ORACLE_HOME/sysman/admin/supportedtzs.lst

echo "Check to see the current timezone as configured for the agent."
grep TZ $ORACLE_HOME/`hostname`_$ORACLE_SID/sysman/config/emd.properties

# Just a reporting step.
emctl status agent

echo "This should display current timezone as reported by OS TZ value."
emctl config agent getTZ



echo "Take OS TZ and update emd.properties."
echo "resetTZ may send output to the screen on the next command needed in sqlplus."
emctl resetTZ agent
grep TZ $ORACLE_HOME/`hostname`_$ORACLE_SID/sysman/config/emd.properties

# Review and set the EMDROOT then validate the new timezone
emctl getemhome
export EMDROOT=$ORACLE_HOME/`hostname`_$ORACLE_SID
emdctl validateTZ agent $TZ

echo "Make sure the dbconsole is shutdown."
emctl stop dbconsole

# Just a reporting step.
emctl config agent getTZ

# These should be the same port and server as reported by the resetTZ command
hostname=`hostname`
agentport=`grep "Agent Port" $ORACLE_HOME/install/portlist.ini|grep $ORACLE_SID|awk '{print $7}'`

# Create timezone update sql script.
echo "
set echo on verify on feedback on autocommit off;
WHENEVER OSERROR EXIT SQL.SQLCODE ROLLBACK
WHENEVER SQLERROR EXIT SQL.SQLCODE ROLLBACK
prompt Updating dbconsole timezone for &1
alter session set current_schema = SYSMAN;
exec mgmt_target.set_agent_tzrgn('&2:&3','&4');
commit;
exit SQL.SQLCODE
" > /tmp/set_agent_tzrgn_""$$"".sql

echo "\nExecute set_agent_tzrgn.sql script to update the dbconsole config for sysman."
$ORACLE_HOME/bin/sqlplus -S "/ as sysdba" @/tmp/set_agent_tzrgn_""$$"".sql $ORACLE_SID $hostname $agentport $TZ
SQLRESULT=$?
if \[ $SQLRESULT -eq 0 \] ; then
echo "\nBrowse to the URL as reported by the startup of dbconsole."
else
echo "\nFAILED: The set_agent_tzrgn task failed."
fi
rm /tmp/set_agent_tzrgn_""$$"".sql

emctl start dbconsole

echo "\nTimezone update for dbconsole is finished."
echo "\nFor further details on resetTZ and set_agent_tzrgn see:"
echo "Oracle® Enterprise Manager Advanced Configuration 10g Release 5 (10.2.0.5) E10954-02 March 2009."
set +vx

Nenhum comentário:

Postar um comentário