rm -rf /u01/domains/wls/ export PATH=/u01/java/bin/:$PATH; export JAVA_HOME=/u01/java;/u01/mid1213wls/oracle_common/bin/rcu -silent -createRepository -connectString 127.0.0.1:1521:xe -dbUser sys -dbRole SYSDBA -schemaPrefix EM -component IAU -component IAU_APPEND -component IAU_VIEWER -component OPSS -component STB -f < /u01/install/passwordfile.txt /u01/mid1213wls/oracle_common/common/bin/wlst.sh createDomain("/u01/mid1213wls/wlserver/common/templates/wls/wls.jar","/u01/domains/wls","weblogic","dadada01") readDomain("/u01/domains/wls") addTemplate("/u01/mid1213wls/em/common/templates/wls/oracle.em_wls_template_12.1.3.jar") drw- LocalSvcTblDataSource drw- opss-data-source drw- opss-audit-viewDS drw- opss-audit-DBDS v_alldatasources=['LocalSvcTblDataSource','opss-data-source','opss-audit-viewDS','opss-audit-DBDS'] for v_datasource in v_alldatasources: cd('/JDBCSystemResource/' + v_datasource + '/JdbcResource/' + v_datasource + '/JDBCDriverParams/NO_NAME_0') set('URL','jdbc:oracle:thin:@localhost:1521:xe') set('PasswordEncrypted','dadada01') cd('Properties/NO_NAME_0/Property/user') v_user=get('Value') set('Value',v_user.replace('DEV','EM')) updateDomain() closeDomain() exit()
Otra forma de sacar todos los datasources:
v_alldatasources = cmo.getJDBCSystemResources() for v_datasource in v_alldatasources: v_nombre = v_datasource.getName() print v_nombre
v_lista=ls('/AppDeployment', returnMap='true')
for v_linea in v_lista: print v_linea
manejados=[["mgd01","nodemanager1","192.168.1.101","10101","cluster"],["mgd02","nodemanager2","192.168.1.102","10102","cluster"]]
for i in range(0,len(manejados)): print manejados[i][0] print manejados[i][1] print manejados[i][2] print manejados[i][3] print manejados[i][4]
v_lista=ls('/AppDeployment', returnMap='true') for v_linea in v_lista: print v_linea
import re es Regular Expression
import re cadena="Proxy for osb_cluster: Name=osb_cluster, Type=Cluster" m = re.search('=(\w+),', str(cadena)) print m.group(1)
Otra forma
print(cadena).split('Name=')[1].split(',')[0] print(str(get('Target')[0])
En el caso del Target:
get('Target') array(weblogic.management.configuration.TargetMBean,[Proxy for osb_cluster: Name=osb_cluster, Type=Cluster])
Lo sacamos:
print(str(get('Target')[0]).split('Name=')[1].split(',')[0]) osb_cluster
cd('/AppDeployment') v_lista=ls(returnMap='true') for v_linea in v_lista: cd('/AppDeployment/' + v_linea) if get('Target') != None: v_targets=list() for v_target in get('Target'): v_targets.append(str(v_target).split('Name=')[1].split(',')[0]) v_total=v_linea+"\t"+",".join(v_targets) else: v_total=v_linea+"\tN/A" print(v_total)
/u01/mid12212/oracle_common/bin/rcu -silent -dropRepository -connectString 172.17.0.1:1521:DEV -dbUser sys -dbRole SYSDBA -schemaPrefix BPEL12C -selectDependentsForComponents true -component IAU -component MDS -component IAU_APPEND -component IAU_VIEWER -component OPSS -component STB -component WLS -component UCSUMS -component SOAINFRA -component ESS < /u01/pogramas/passwordfile.txt
v_estat="desconnectat" while v_estat != "connectat": try: nmConnect(username='weblogic', password='weblogic01',domainName='osb', host='127.0.0.1',port='5556', nmType='plain') v_estat = "connectat" except: print "No esta connectat" time.sleep(10)
Sin target:
cd('/') delete('defaultCoherenceCluster','CoherenceClusterSystemResource')