COMANDOS PARA CONFIGURAR O ORACLE GRID CONTROL

*no sqlplus como sys

drop user sysman cascade;
drop public synonym SETEMVIEWUSERCONTEXT;
drop role MGMT_USER;
drop PUBLIC SYNONYM MGMT_TARGET_BLACKOUTS;
drop user MGMT_VIEW;
drop tablespace MGMT_TABLESPACE including contents and datafiles; 
drop tablespace MGMT_ECM_DEPOT_TS including contents and datafiles;
set termout off feedb off trimsp on lin 9999 head off echo off 
spool /tmp/dropsysmanpublicsynonym.sql 
select 'drop public synonym '||synonym_name||';' ddl from dba_synonyms where table_owner='SYSMAN'; 
spool off 
set termout on feedb on echo on 
@/tmp/dropsysmanpublicsynonym

no so

****emca -config dbcontrol db -repos recreate
emca -deconfig dbcontrol db -cluster -repos drop
emca -config dbcontrol db -repos create -cluster

emca -deconfig all db -cluster
emca -deconfig all db -repos drop -cluster

emca -config dbcontrol db -repos recreate -cluster

emca -config dbcontrol db -repos recreate -cluster -CLUSTER_NAME crs -DB_UNIQUE_NAME ALEAP -PORT 1521 -EMAIL_ADDRESS dba@ALE.COM.br -MAIL_SERVER_NAME mailx.XAN.org.br -ASM_OH /oracle/product/asm -ASM_USER_ROLE SYSDBA -ASM_USER_NAME sys -ASM_PORT 1521 -NODE_LIST ALE-db-001,ALE-db-002,ALE-db-003

emca -config dbcontrol db -repos create -cluster -CLUSTER_NAME crs -DB_UNIQUE_NAME ALEAP -PORT 1521 -EMAIL_ADDRESS dba@ALE.COM.br-MAIL_SERVER_NAME mailx.XAN.org.br -ASM_OH /oracle/product/asm -ASM_USER_ROLE SYSDBA -ASM_USER_NAME sys -ASM_PORT 1521 -NODE_LIST ALE-db-001,ALE-db-002,ALE-db-003

emca -config dbcontrol db -repos create -cluster -CLUSTER_NAME crs -DB_UNIQUE_NAME ALEAP -PORT 1521 -EMAIL_ADDRESS dba@ALE.COM.br -MAIL_SERVER_NAME mailx.XAN.org.br -ASM_OH /oracle/product/asm -ASM_USER_ROLE SYSDBA -ASM_USER_NAME sys -ASM_PORT 1521 -NODE_LIST ALE-db-001,ALE-db-002,ALE-db-003

*********para mostrar destinos do agente

emctl config agent listtargets

********* para mostrar configuração do cluster

emca -displayConfig dbcontrol -cluster

********* para adicionar instance no console

emca -addInst db

cd <AGENT_HOME>/bin
agentca -d -c “node1,node2…” [-t -i <path to oraInst.loc> -n CLUSTER_NAME]

agentca -d -c "ALE-db-001,ALE-db-002,ALE-db-003"

HOST: Database hostname
SID: Database SID
PORT: Listener port number
ORACLE_HOME: Database ORACLE_HOME
HOST_USER: Host username for automatic backup
HOST_USER_PWD: Host user password for automatic backup
BACKUP_SCHEDULE: Automatic backup schedule (HH:MM)
EMAIL_ADDRESS: Email address for notifications
MAIL_SERVER_NAME: Outgoing Mail (SMTP) server for notifications
ASM_OH: ASM ORACLE_HOME
ASM_SID: ASM SID
ASM_PORT: ASM port
ASM_USER_ROLE: ASM user role
ASM_USER_NAME: ASM username
ASM_USER_PWD: ASM user password
SRC_OH: ORACLE_HOME for the database to be upgraded
DBSNMP_PWD: Password for DBSNMP user
SYSMAN_PWD: Password for SYSMAN user
SYS_PWD: Password for SYS user
DBCONTROL_HTTP_PORT: Database Control HTTP port
AGENT_PORT: EM agent port
RMI_PORT: RMI port for Database Control
JMS_PORT: JMS port for Database Control

CLUSTER_NAME: Cluster name
DB_UNIQUE_NAME: Database unique name
SERVICE_NAME: Service name
EM_NODE: Database Control node name
EM_SID_LIST: Agent SID list [comma separated]
**********************************************************************************

Database ORACLE_HOME ……………. /oracle/product/app/10R2/db
Database instance hostname ……………. XAN-db-001
Listener port number ……………. 1521
Cluster name ……………. crs
Database unique name ……………. ALEAP
Email address for notifications …………… dba@ALEX.COM.br
Outgoing Mail (SMTP) server for notifications …………… mail.ALEX.org.br
ASM ORACLE_HOME ……………. /oracle/product/asm
ASM port ……………. 1521
ASM user role ……………. SYSDBA
ASM username ……………. SYS

*****************************OUTRO LADO*******************************

Database ORACLE_HOME ……………. /oracle/product/app/10R2/db
Database instance hostname ……………. XAN-db-001
Listener port number ……………. 1521
Cluster name ……………. crs
Database unique name ……………. SPCAP
Email address for notifications …………… dba@ALEX.br
Outgoing Mail (SMTP) server for notifications …………… mailx.XAN.org.br
ASM ORACLE_HOME ……………. /oracle/product/asm
ASM port ……………. 1521
ASM user role ……………. SYSDBA
ASM username ……………. SYS

ps -ef |grep java

Caso tenha alterado o horário e nao subir mais, pode seyr o Time zone
Nesse caso colocar a variavel TZ = o valor que etiver em /etc/sysconfig/clock

ex: export TZ=Brasil/East

Obs: Colocar essa variável no profile!

Fazer isso em todos os nós do RAC

lista de timezone oracle
/oracle/product/app/10R2/db/sysman/admin/supportedtzs.lst

emctl resetTZ agent

Updating /oracle/product/app/10R2/db/cot-db-001_ALEAP1/sysman/config/emd.properties…
Time zone set to +00:00.

To complete this process, you must either:

connect to the database served by this DBConsole as user ‘sysman’, and execute:

SQL> exec mgmt_target.set_agent_tzrgn('cot-db-001:1830','+00:00')

— or —

connect to the database served by this DBConsole as user ‘sys’, and execute:

SQL> alter session set current_schema = SYSMAN;
SQL> exec mgmt_target.set_agent_tzrgn('ALE-db-001:1830','+00:00')

lista o nome dos agents

emctl config listtargets
********************************
drop user sysman cascade; 
drop user MGMT_VIEW cascade; 
drop role MGMT_USER; 
drop tablespace MGMT_TABLESPACE including contents and datafiles; 
drop tablespace MGMT_ECM_DEPOT_TS including contents and datafiles; 
set termout off feedb off trimsp on lin 9999 head off echo off 
spool /tmp/dropsysmanpublicsynonym.sql 
select 'drop public synonym '||synonym_name||';' ddl from dba_synonyms where table_owner='SYSMAN'; 
spool off 
set termout on feedb on echo on 
@/tmp/dropsysmanpublicsynonym
set|export ORACLE_SID=<database_sid>
set|export ORACLE_HOME=<oracle_home>
cd to ORACLE_HOME/bin
./emca -deconfig dbcontrol db -repos drop

******************************************************************
example I:

[celcaix2]> export TZ=EET-10EETDT-11,M10.1.0/02:00,M4.1.0/03:00
[celcaix2]> echo $TZ
EET-10EETDT-11,M10.1.0/02:00,M4.1.0/03:00

[celcaix2]> emctl config agent getTZ
Oracle Enterprise Manager 10g Release 4 Grid Control 10.2.0.4.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
GMT+10:00

example II:

[celcaix2]> export TZ=EET-10EETDT,M10.1.0/02:00,M4.1.0/03:00
[celcaix2]> echo $TZ
EET-10EETDT,M10.1.0/02:00,M4.1.0/03:00

[celcaix2]> emctl config agent getTZ
Oracle Enterprise Manager 10g Release 4 Grid Control 10.2.0.4.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
Australia/Sydney
********************************************************************

export TZ=GMT+3
na produção quando forA do horário de verão TZ=GMT+3 e no horario de verão= TZ=GMT+2

se der erro ao executar:
ORA-20233: Invalid agent name
sun220r.spiceindia.com:3872
ORA-06512: at “SYSMAN.MGMT_TARGET”, line 3814
ORA-06512: at line 1

Faça o seguinte:

emctl stop dbconsole
emdctl validateTZ agent GMT+3
- emctl getemhome
- EXPORT emdroot=<from above>
emctl start dbconsole
Start the console. This populates values in sysman.mgmt_targets
As SYSMAN, run the SQL:
exec mgmt_target.set_agent_tzrgn('cur-db-001.dc.spc.org.br:3938','-03:00');

comando para verificar a porta.

NETSTAT -AN |GREP (nº da porta) 
netstat -an |grep 1830

——————-*************————————–**************————————
This script worked for me on Solaris 5.10 with Oracle 10.2.0.4.

Test before running on your server.

# 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
********************----------------------***********************

Here is a related script for updating the dbms scheduler timezone and database timezone. Updating these timezone values should be done before the dbconsole related timezone work.
This script worked for me on Solaris 5.10 with Oracle 10.2.0.4. Test before running on your server.

This script requires manual updates. Manually set the UTC_OFFSET and manually remove the sqlplus ” prompt” statement in front of
“exec dbms_scheduler.set_scheduler_attribute”
and in front of
“alter database set time_zone”.

The database changes are commented out to protect from accidental changes due to the manual configurtion for the UTC_OFFSET.

# SCRIPT NAME: set_dbtimezone.ksh
# PURPOSE: Update the timezone for the dbms_scheduler and database.
# FYI - dbconsole must also be updated using "emctl resetTZ agent" and set_agent_tzrgn.
# USAGE . ./set_dbtimezone.ksh
# Configure the oracle home and ORACLE_SID before sourcing this script.
#
#set -vx
echo "Report the current timezone from the OS."
echo $TZ
# Manually set the offset based on the expected TZ value.
UTC_OFFSET=+08:00
# 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 database timezone for &1
select distinct tzname from v\$timezone_names where tzname like '&2' order by tzname;
select dbms_scheduler.stime from dual;
prompt exec dbms_scheduler.set_scheduler_attribute('default_timezone','&2');
select dbms_scheduler.stime from dual;
select localtimestamp from dual;
select dbtimezone, sessiontimezone from dual;
prompt alter database set time_zone = '&3';
select localtimestamp from dual;
prompt commit;
exit SQL.SQLCODE
" > /tmp/dbtimezone_""$$"".sql
echo "\nExecute dbtimezone.sql script to update the dbms scheduler timezone and database timezone."
$ORACLE_HOME/bin/sqlplus -S "/ as sysdba" @/tmp/dbtimezone_""$$"".sql $ORACLE_SID $TZ $UTC_OFFSET
SQLRESULT=$?
if \[ $SQLRESULT -eq 0 \] ; then
echo "\nDatabase and DBMS Scheduler timezone updated to $TZ $UTC_OFFSET."
else
echo "\nFAILED: The 'dbms_scheduler.set_scheduler_attribute' and/or 'alter database set time_zone' task failed."
fi
rm /tmp/dbtimezone_""$$"".sql
echo "\nTimezone update for the database and dbms scheduler is finished."
echo "\nFor further details on set_scheduler_attribute (for 10g or 11g) see:"
echo "Oracle® Database Administrator's Guide 11g Release 1 (11.1) B28310-04 March 2008. - Configuring Oracle Scheduler."
set +vx

———————************************—————————-*********************

emca -reconfig dbcontrol –cluster –EM_NODE cur-db-001 -EM_NODE_LIST cur-db-001,cur-db-002,cur-db-003
emca -config dbcontrol db -repos create -cluster –EM_NODE cur-db-001 -EM_NODE_LIST cur-db-001,cur-db-002,cur-db-003

emca -reconfig dbcontrol –cluster –EM_NODE node5 -EM_NODE_LIST node6,node7,node8
emctl unsecure agent

1. setup env.
$ export PERL5LIB=$ORACLE_HOME/perl/lib:$PERL5LIB
2. Run targetdeploy.pl with arguments.
$ cd $ORACLE_HOME << ORACLE_HOME is /u0001/app/product/db/10.2.0/dv00ism
$ find . -name 'Copy.pm' -printcd
find . -name 'agentca' -printcd
export PERL5LIB= /oracle/product/app/10R2/db/perl/lib/site_perl/5.8.3:/oracle/product/app/10R2/db/perl/lib/5.8.3
directories...
/oracle/product/app/10R2/db/perl/bin/perl /oracle/product/app/10R2/db/bin/targetdeploy.pl -v cDur-db-001-vip -l LISTENER_CDUR-DB-001 -t LISTENER_CDUR-DB-001_cDur-db-001.dc.org.br -s +ASM1 -o /oracle/product/asm /oracle/product/app/10R2/db/cur-db-001_ALEAP1 cDur-db-001.dc.org.br ALEAP1
/oracle/product/app/10R2/db/perl/bin/perl /oracle/product/app/10R2/db/bin/targetdeploy.pl -v cDur-db-003-vip -l LISTENER_CDUR-DB-003 -t LISTENER_CDUR-DB-003_cDur-db-003.dc.org.br -s +ASM3 -o /oracle/product/asm /oracle/product/app/10R2/db/cDur-db-003_ALEAP3 cDur-db-003.dc.org.br ALEAP3
/oracle/product/app/10R2/db/perl/bin/perl /oracle/product/app/10R2/db/bin/targetdeploy.pl -v cDur-db-002-vip -l LISTENER_CUR-DB-002 -t LISTENER_CDUR-DB-002_cDur-db-002.dc.org.br -s +ASM2 -o /oracle/product/asm /oracle/product/app/10R2/db/cDur-db-002_ALEAP2 cDur-db-002.dc.org.br ALEAP2

Sobre Alexandre Pires

ORACLE OCS Goldengate Specialist, OCE RAC 10g R2, OCP 12C, 11g, 10g , 9i e 8i - Mais de 25 anos de experiência na área de TI. Participei de projetos na G&P alocado na TOK STOK, EDINFOR alocado na TV CIDADE "NET", 3CON Alocado no PÃO DE AÇUCAR, DISCOVER alocado na VIVO, BANCO IBI e TIVIT, SPC BRASIL, UOLDIVEO alocado no CARREFOUR e atualmente na ORACLE ACS atendendo os seguintes projetos: VIVO, CLARO, TIM, CIELO, CAIXA SEGUROS, MAPFRE, PORTO SEGURO, SULAMERICA, BRADESCO SEGUROS, BANCO BRADESCO, BASA, SANTANDER, CNJ, TSE, ELETROPAULO, EDP, SKY, NATURA, ODEBRESHT, NISSEI, SICREDI, CELEPAR, TAM, TIVIT, IBM, SMILES, CELEPAR, SERPRO,OKI,BANCO PAN, etc
Esse post foi publicado em GRID CONTROL, TUTORIAL e marcado , , , , , , , , , , . Guardar link permanente.

Deixe um comentário