Enterprise Manager Target Relocation | EM Traget New Agent | EM Target new host


Procedure to replace EM agents to new target. Hand made after documented by oracle option failed.

>> emcli relocate_targets -src_agent="hostnamec:9999" -dest_agent="hostnamea:9999" -target_name=preprod_pccdb -target_type=oracle_database -copy_from_src -force=yes -ignoreTimeSkew=yes

##### SELECT 'emcli relocate_targets -src_agent=hostnamec -dest_agent=hostnamea -target_name='||target_name -target_type='||target_type 'as relocate_target FROM MGMT_TARGETS where TARGET_TYPE LIKE 'oracle_database' and target_name like 'preprod%' ;

Result>
2016.11.04 16:12:53 [ oracle@oms_node_1:/oracle/app/product/middleware/oms/bin ]
get_type=oracle_database -copy_from_src -force=yes -ignoreTimeSkew=yesdb-a:9999 -target_name=preprod_pccdb -tar
Errors from relocating targets from hostnamec:9999 to hostnamea:9999
Error from target relocation while performing relocation from null to null, ERROR Message: The following pluginsare not of the same version on source and destination agent:oracle.sysman.db:Src Agent Version: 12.1.0.8.0:Src Agent Rev Version: 0:Dest Agent Version: null:Dest Agent Rev Version: null:;


2016.11.04 16:12:58 [ oracle@oms_node_1:/oracle/app/product/middleware/oms/bin ]
gcdb $

#####   Both agents installed from same binary source. Configuration of agents was tipical and similar. Don't have time for this.

-- kamil.piorekk@gmail.com
-- 04.11.2016



declare
v_url               varchar2 (400) ;
v_newhostname       varchar2 (400) ;
BEGIN
FOR REC IN
    ( SELECT
            target_name,target_type,target_guid,emd_url,host_name
                FROM MGMT_TARGETS where target_name like 'preprod_dbprep1%' and target_type like 'oracle_database'     )
   LOOP            
v_url:=rec.emd_url ;
v_newhostname:='hostnamea';
 em_target_relocate.add_tgt_relocation_callback('trgt_rellocationCallbck',rec.target_name,rec.target_type);
 em_target_relocate.update_tables_for_relocation(rec.target_guid,'https://'||rec.host_name||':9999/emd/main/','https://'||v_newhostname||':9999/emd/main/') ;
 em_target_relocate.mark_relocate_start(rec.target_guid,'https://'||rec.host_name||':9999/emd/main/','https://'||v_newhostname||':9999/emd/main/');
 em_target_relocate.relocate_target(rec.target_guid,'https://'||rec.host_name||':9999/emd/main/','https://'||v_newhostname||':9999/emd/main/');
 em_target_relocate.UPDATE_TARGET_AGENT_LIST(rec.target_guid,'https://'||v_newhostname||':9999/emd/main/');
 em_target_relocate.end_relocate(rec.target_guid,'https://'||rec.host_name||':9999/emd/main/','https://'||v_newhostname||':9999/emd/main/') ;
 em_target_relocate.delete_tgt_relocation_callback('trgt_rellocationCallbck',rec.target_name,rec.target_type);
 END LOOP;
 commit ;
END ;





SELECT 'emcli relocate_targets -src_agent=hostnamec -dest_agent=hostnamea -target_name='||target_name -target_type='||target_type 'as relocate_target FROM MGMT_TARGETS where TARGET_TYPE LIKE 'oracle_database' and target_name like 'preprod%' ;

SELECT 'emcli set_standby_agent  -src_agent=hostnamec -dest_agent=hostnamea -target_name='||target_name||' -target_type='||target_type as relocate_target
    FROM MGMT_TARGETS where TARGET_TYPE LIKE 'oracle_database' and target_name like 'preprod%' ;

    emcli modify_target -name="pdb2" -type="oracle_database" -credentials= "UserName:sys;password:june;Role:SYSDBA" -on_agent

emcli modify_target -name="+ASM_devdb" -type="asm_instance" -credentials= "UserName:sys;password:devasm;Role:SYSDBA" -on_agent

emcli delete_target -name="testdb" -type="oracle_database"

emcli setup -url=https://prodoem.app.com/em/ -username=sysman -password=11goem
                                                                                                                                     

emcli relocate_targets -src_agent="hostnamec:9999" -dest_agent="hostnamea:9999" -target_name=preprod_pccdb -target_type=oracle_database -copy_from_src -force=yes -ignoreTimeSkew=yes


=

2016.11.04 16:12:53 [ oracle@oms_node_1:/oracle/app/product/middleware/oms/bin ]
get_type=oracle_database -copy_from_src -force=yes -ignoreTimeSkew=yesdb-a:9999 -target_name=preprod_pccdb -tar
Errors from relocating targets from hostnamec:9999 to hostnamea:9999
Error from target relocation while performing relocation from null to null, ERROR Message: The following pluginsare not of the same version on source and destination agent:oracle.sysman.db:Src Agent Version: 12.1.0.8.0:Src Agent Rev Version: 0:Dest Agent Version: null:Dest Agent Rev Version: null:;
2016.11.04 16:12:58 [ oracle@oms_node_1:/oracle/app/product/middleware/oms/bin ]
gcdb $


Komentarze

  1. select 'emcli set_standby_agent -src_agent='||agent_name||' -dest_agent=DB2:1830 -target_name='||target_name||' -target_type='||target_type
    from MGMT$AGENTS_MONITORING_TARGETS
    where target_type like 'oracle_database' and ( agent_host_name like 'DB1' ) order by agent_name

    OdpowiedzUsuń
  2. lst_node_name=`grep "Node name" $DIAGDEST/alert_$sid.log | tail -1 | awk {'print $3'}`
    act_node_name=`echo $HOSTNAME`
    if [ "$act_node_name" == "$lst_node_name" ]; then
    $AGENT_HOME/bin/emctl relocate_target agent vcs_$sid oracle_database
    fi

    OdpowiedzUsuń

Prześlij komentarz