Ok

En poursuivant votre navigation sur ce site, vous acceptez l'utilisation de cookies. Ces derniers assurent le bon fonctionnement de nos services. En savoir plus.

  • How to add Additional target properties in Oracle Enterprise Manager12c

     
    Ajouter une valeur dans la propriété Location :
     
    pour un hôte
    ./emcli get_targets -noheader -script -targets=host | awk '{print $4":"$3":Location:"}' > /tmp/targets
     
    dans le fichier targets ajouter : 
     
    serveurJJY:host:Location:RIZ
    serveurJOJO:host:Location:RIA
    serveur TATA:host:Location:RIS
     
    idem pour une database :
     
    ./emcli get_targets -noheader -script -targets=oracle_database | awk '{print $4":"$3":Location:"}' > /tmp/targets
     
    ensuite on fait :
     
    ./emcli set_target_property_value -property_records="REC_FILE" -input_file="REC_FILE:/tmp/targets" -separator=property_records="n"
     
     

  • EMCLI Enterprise Manager 12c/13c : Ajout d'une base de données avec mot de passe avec des caractères spéciau

    Pour exécuter la commande « emcli add_target », il est nécessaire de se connecter :

    1
    2
    3
    sysman_password="<mot de passe SYSMAN>"
    emcli login -username=SYSMAN -password=${sysman_password}
    emcli sync

    La définition des propriétés est réalisée via des variables :

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    instance_name=<db_name>
    host_name=<full_hostname>
    dbhome_path=/opt/oracle/product/12.1/dbhome_1
    instance_resname=${instance_name}_${host_name}
    user_name=DBSNMP
    user_role=Normal
    listener_name=LISTENER_${instance_name}
    listener_resname=LISTENER_${instance_name}_${host_name}
    listener_port=1521
    db_properties="SID:${instance_name}"
    db_properties="${db_properties};Port:${listener_port}"
    db_properties="${db_properties};OracleHome:${dbhome_path}"
    db_properties="${db_properties};MachineName:${host_name}"
    db_credentials="UserName:${user_name};password:<mot de passe DBSNMP>;Role:${user_role}"
    lsnr_properties="LsnrName:${listener_name}"
    lsnr_properties="${lsnr_properties};ListenerOraDir:${dbhome_path}/network/admin"
    lsnr_properties="${lsnr_properties};Port:${listener_port}"
    lsnr_properties="${lsnr_properties};OracleHome:${dbhome_path}"
    lsnr_properties="${lsnr_properties};Machine:${host_name}"

    source : 

  • Script python avec emcli


    setproperty.py :

     

    #  
    # Sample EMCLI Python script file for mass update a property value  
    #  
      
    # check number of arguments
     
    if len(sys.argv) <> 3:
      print 'Usage: emcli @setproperty.py hostname "propertyname" propertyvalue'
      exit()
     
    # assign the arguments to variables (for readability)
     
    hostname = sys.argv[0]
    propertyname = sys.argv[1]
    propertyvalue = sys.argv[2]
     
    # login to the OMS
     
    login( username="SYSMAN", password="welcome1" )
     
    # find the targets running on a given host
     
    targets = list( sql="select target_name  || '@' || target_type as target from MGMT$TARGET where host_name = '" + hostname + "' and target_name <> host_name" )
     
    # set the target property for each target
     
    for t in targets.out()['data']:
      print "Setting property " + propertyname + " for " + t['TARGET'].split(':')[0]
      set_target_property_value( property_records= t['TARGET'] + "@" + propertyname + "@" + propertyvalue, subseparator="property_records=@" )