Friday 28 November 2014

Em12c Creating Metric Extension(User Defined Metrics) for BPEL Process State OFF

clip_image002
clip_image004
clip_image006
clip_image008
clip_image010

select Domain_ref,process_id,state  from ORABPEL.PROCESS where state=1;


clip_image012
clip_image014
clip_image016
1) Save as Deployable Draft
2) Publish Metric Extension
3) Deploy To Targets : Cluster Database
4) Add this metric to your incident Rules to get alerts
clip_image018
clip_image020

Seeing slow startup of SOA OSB and other Java based application then verify Entropy

We faced slow startup of Domain Creation, slow startup  of Domain and resolved using proper Entropy settings:
You should be able to select the faster-but-slightly-less-secure /dev/urandom on Linux using: 
$JAVA_HOME/jre/lib/security/java.security 
Default /dev/urandom is configured, but as mentioned this is ignored by Java. 
-Djava.security.egd=file:/dev/urandom 
However, this doesn’t work with Java 5 and later (Java Bug 6202721). The suggested work-around is to use:
-Djava.security.egd=file:/dev/./urandom(note the extra ‘/./’) 
  
You can also set in your environment like below in setDomainEnv.sh 
if "${USER_MEM_ARGS}" != "" ] ; then 
MEM_ARGS="${USER_MEM_ARGS} 
export MEM_ARGS 
fi 
MEM_ARGS="${MEM_ARGS} -Djava.security.egd=file:/dev/./urandom" 
  
  
Or at runtime: 
export CONFIG_JVM_ARGS="-Djava.security.egd=file:/dev/./urandom" 
/u01/app/oracle/product/fmw/wlserver_12.1/common/bin/config.sh 
  
References:
http://theheat.dk/blog/?p=1539
http://stackoverflow.com/questions/137212/how-to-solve-performance-problem-with-java-securerandom






How to uninstall/remove EM12c Agent

./emctl stop agent

/opt/app/oracle/agent12c/core/12.1.0.3.0/perl/bin/perl /opt/app/oracle/agent12c/core/12.1.0.3.0/sysman/install/AgentDeinstall.pl -agentHome /opt/app/oracle/agent12c

rm -Rf /opt/app/oracle/agent12c

From host where emcli is installed:
emcli delete_target -name="test.example.com:1836" -type="oracle_emd" -delete_monitored_targets –async

Reference:
https://docs.oracle.com/cd/E24628_01/install.121/e24089/deinstall_agent.htm#CBBCEJHG

Check any left out info:
select target_name,target_type from MGMT_TARGETS_DELETE where DELETE_COMPLETE_TIME is null

select target_name,target_type from MGMT_TARGETS_DELETE where target_name like '%spare%' and target_type='oracle_emd'



You can try:

exec mgmt_admin.delete_target('target_name','target_type');


If the agent install fails to register with OEM than try:

     cd /opt/app/oracle/agent12c/agent_inst/bin/
    /opt/app/oracle/agent12c/agent_inst/bin/emctl secure agent
    /opt/app/oracle/agent12c/agent_inst/bin/emctl start agent
    /opt/app/oracle/agent12c/agent_inst/bin/emctl config agent addInternalTargets

   /opt/app/oracle/agent12c/agent_inst/bin/emctl upload

Tuesday 25 November 2014

How to Restore Oracle Database using RMAN (with Examples):


As a Linux sysadmin, you might recover a system from backup, which may include Oracle Database.

So, it is essential for all admins to understand how to restore oracle database from backup.

Typically, DBAs will use Oracle RMAN utility to take a hot backup of the database.

This tutorial provides an introduction on how to restore an Oracle database on a Linux server from RMAN backup.

http://www.thegeekstuff.com/2014/11/oracle-rman-restore/

Thursday 20 November 2014

Oracle Launches SOA Governance 11g or 12c installation : Enterprise Repository, Service Registry, SOA management with EM and Web Services Manager

Oracle SOA Governance 11g
Oracle has released Oracle SOA Governance 11g(component of Fusion Middleware)  which consists of following sub components
  • Oracle Enterprise Repository (single source of truth for SOA assets)
  • Oracle Service Registry (UDDI v3 compliant registry)
  • Oracle Enterprise Manager Pack Plus for SOA (pack to monitor runtime services)
  • Oracle Web Services Manager (tool to secure web services)
For press release about SOA Governance 11g click here
  • Two major components released as part of SOA Governance 11g are Oracle Service Registry 11g and Oracle Enterprise Repository 11g
  • Oracle SOA Governance 11g supports Oracle Applications including Oracle E-Business Suite and Siebel along with Oracle Application Integration Architecture (AIA).
  • Oracle Service Registry 11g software can be downloaded from here (Need Oracle/3rd Party Database)
  • Oracle Enterprise Repository 11g can be downloaded from here  (Need Oracle/3rd Party Database and Oracle/3rd Party Application Server)
  • For documentation on Oracle Service Registry 11g and Oracle Enterprise Repository 11g click here and go to end of page at OER Guides
  
Related/References 
http://www.oracle.com/us/corporate/press/057498
http://www.oracle.com/us/products/middleware/soa/governance/overview/index.html

Installation of Soa governance 12:-

http://docs.oracle.com/middleware/1213/oer/install-oer/install_gui.htm#OERIG378
http://docs.oracle.com/middleware/1213/oer/concepts-oer/intro.htm#OERQS376

Deploying Application on SOA/BPM domain : exception.71056.name: Access to internal workflow context is denied :

I discussed about SOA suite 11gR1 installation here, in this post I am going to cover issue I encountered while deploying application on SOA 11.1.1.6 Server .
Error while deploying application on SOA Server
______
Deploying on partition “default” of “/Farm_soa_domain/soa_domain/soa_server1″ …
Deploying on “/Farm_soa_domain/soa_domain/soa_server1″ failed!
There was an error deploying the composite on soa_server1: Deployment Failed: Error occurred during deployment of component: ManualAuthProcess to service engine: implementation.bpmn for composite: serv-manual-auth: BPM-71056
Exception
exception.71056.type: error
exception.71056.severity: 2
exception.71056.name: Access to internal workflow context is denied.
exception.71056.description: Requested access to internal workflow context is not allowed according to security policy.
exception.71056.fix: Contact Oracle support if exception can not be fixed
: Exception
exception.71056.type: error
exception.71056.severity: 2
exception.71056.name: Access to internal workflow context is denied.
exception.71056.description: Requested access to internal workflow context is not allowed according to security policy.
exception.71056.fix: Contact Oracle support if exception can not be fixed
_______
If you get above error then check following things in this order
1. Check BPM is enabled in Domain 
To check BPM is enabled in domain look for entry like below in $DOMAIN_HOME/bin/setDomainEnv.sh
EXTRA_JAVA_PROPERTIES=”${EXTRA_JAVA_PROPERTIES} -Dbpm.enabled=true”
If this entry is missing then extend the domain to include Oracle BPM Suite template as shown below and re-start domain



2. Check permission in $DOMAIN_HOME/config/fmwconfig/system-jazn.xmlfor  bpm-services.jar
Check that permission for bpm-services.jar contains minimum with entry like below (Add any missing permission) and restart SOA domain
_____
<grant>               <grantee>
                   <codesource>

                       <url>file:${soa.oracle.home}/soa/modules/oracle.soa.workflow_11.1.1/bpm-services.jar</url>
                   </codesource>
               </grantee>
               <permissions>
                   <permission>

                       <class>oracle.security.jps.JpsPermission</class>
                       <name>VerificationService.createInternalWorkflowContext</name>
                   </permission>
                   <permission>

                       <class>oracle.security.jps.service.policystore.PolicyStoreAccessPermission</class>
                       <name>context=APPLICATION, name=*</name>
                       <actions>getApplicationPolicy</actions>
                   </permission>
                   <permission>

                       <class>oracle.security.jps.service.policystore.PolicyStoreAccessPermission</class>
                       <name>context=SYSTEM, name=*</name>
                       <actions>getConfiguredApplications</actions>
                   </permission>
                   <permission>

                       <class>oracle.security.jps.service.policystore.PolicyStoreAccessPermission</class>
                       <name>context=SYSTEM, name=*</name>
                       <actions>getSystemPolicy</actions>
                   </permission>
                   <permission>

      <class>oracle.security.jps.service.credstore.CredentialAccessPermission</class>
                       <name>context=SYSTEM, mapName=BPM-SERVICES, keyName=BPM-SERVICES</name>
                       <actions>read</actions>
                   </permission>
                   <permission>

                       <class>oracle.security.jps.service.credstore.CredentialAccessPermission</class>
                       <name>context=SYSTEM, mapName=WF-ADMIN-USER, keyName=WF-ADMIN-CREDENTIAL</name>
                       <actions>read,write</actions>
                   </permission>
                   <permission>

                       <class>oracle.security.jps.service.credstore.CredentialAccessPermission</class>
                       <name>context=SYSTEM, mapName=BPM-CRYPTO, keyName=BPM-CRYPTO</name>
                       <actions>read,write</actions>
                   </permission>
                   <permission>

                       <class>oracle.security.jps.JpsPermission</class>
                       <name>IdentityAssertion</name>
                       <actions>*</actions>
                   </permission>
               </permissions>
           </grant>
_____

https://forums.oracle.com/message/10094583

Error while starting OAM WebLogic Servers “Policy store update operations are not allowed, system is write protected”

I’ve come across an issue in OAM 11g R2 PS2 environment. Multi Data Center is also being setup with one DC as Master and other DC as Clone. After configuring the Clone DC using T2P commands and running few WLST commands to accomplish MDC setup, the below errors were seen while starting the OAM WebLogic Admin/Managed Servers.
<Apr 8, 2014 4:28:05 PM PDT> <Warning> <oracle.oam.engine.policy> <OAMSSA-06342> <Bootstrap failed for handler oracle.security.am.common.policy.tools.upgrade.r2ps2.bootstrap.RMR2PS2BootstrapHandler!>
<Apr 8, 2014 4:28:05 PM PDT> <Error> <oracle.oam.engine.policy> <BEA-000000> <Policy store update operations are not allowed, system is write protected.
Analysis:
The OAM 11g documentation states “Clone Data Centers can be write protected so no updates can be made to the system or policy configurations”. So I had set WriteEnabledFlag flag in oam-config.xml to false. Therefore any updates to Clone DC for policy or system changes will fail.
You can verify this flag in oam-config.xml and it would look like:
<Setting Name=”WriteEnabledFlag” Type=”xsd:boolean”>true</Setting>
However the weblogic servers would start up fine.
Solution:
Even Clone DC should be Write Enabled.
Connect to weblogic admin server through wlst.sh and run commands as shown below:
wls:/oam_domain/serverConfig> domainRuntime()
Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.
For more help, use help(domainRuntime)
wls:/oam_domain/domainRuntime> setMultiDataCenterWrite(WriteEnabledFlag=”true”)
Data center write enable flag set successfully
wls:/oam_domain/domainRuntime>

Oracle Upgrade – from R12.2.3 to R12.2.4

 I performed ERP Upgrade from 12.2.3 to 12.2.4. I would like to share the document, which contains the steps performed, according to environment. This is just to give an idea, user must review the following documents and take environment specific action:
  • Oracle E-Business Suite Release 12.2.4 Readme (Doc ID 1617458.1)
  • Applyng the Latest AD and TXK Release Update Packs to Oracle E-Business Suite Release 12.2 (Doc ID 1617461.1)
  • DataInstall and HRGLOBAL Application: 12.2 Specifics (Doc ID 1469456.1)
  • Oracle E-Business Suite Release 12.2: Consolidated List of Patches and Technology Bug Fixes (Doc ID 1594274.1)
You may download the file using the URL:R12.2.3 Upgrade to R12.2.4

Tuesday 18 November 2014

Unable to start the Weblogic AdminServer 12c: Server subsystem failed. Reason: java.lang.NullPointerException

Scenario:

Users were unable to start the AdminServer ( weblogic 12c). The startup failed with following error

####<Jul 31, 2013 4:47:04 AM PDT> <Critical> <WebLogicServer> <host02> <AdminServer> <main> <<WLS Kernel>> <> <> <1375271224766> <BEA-000386> <Server subsystem failed. Reason: java.lang.NullPointerException 
java.lang.NullPointerException at weblogic.management.internal.PendingDirectoryManager.find(PendingDirectoryManager.java:571) at weblogic.management.internal.PendingDirectoryManager.find(PendingDirectoryManager.java:556) at weblogic.management.internal.PendingDirectoryManager.find(PendingDirectoryManager.java:575)  at weblogic.management.internal.PendingDirectoryManager.find(PendingDirectoryManager.java:556) at weblogic.management.internal.PendingDirectoryManager.getAllFiles(PendingDirectoryManager.java:413) at weblogic.management.provider.internal.EditAccessImpl.<init>(EditAccessImpl.java:165)

Reason:

One user stopped and restarted the Admin service as "root" user instead of the S/W owner (which was oracle). He also tried to create datasources for the application after starting up the weblogic Admin server.

Impact:

The action modified the ownership and permissions on many of the domain's folders to root. This was stopping the Admin server from coming up.

Tried few work around like renaming the AdminServer folder and then starting up, removing the replicas.prop file under AdminServer/data/ldap/conf directory and renaming WLS_DIAGNOSTICS000000.DAT file under AdminServer/data/store/diagnostics location. But nothing worked in this case.

Solution:

Check for the permission of "pending" folder under $DOMAIN_HOME. If it is under root move it back to oracle (or the original WLS S/W owner).

Also check whether we have any files under pending. If so we can rename them too

chown -R oracle:oinstall pending

This did the trick. After this I was able to start up the AdminServer.

Error while starting WebLogic Server : java.lang.NumberFormatException: null

 I was working on WebLogic Server where Admin Server failed to start because Disk was 100% full. Admin Server failed to start after clearing some unwanted files from server with below error message
Error message in Admin Server log file $DOMAIN_HOME/servers/AdminServer/logs/AdminServer.log
__________________
<aug 13, 2010 2:49:51 PM BST> <Critical> <WebLogicServer> <BEA-000386>
<Server subsystem failed. Reason: java.lang.NumberFormatException: null
java.lang.NumberFormatException: null
        at java.lang.Integer.parseInt(Integer.java:417)
        at java.lang.Integer.parseInt(Integer.java:499)
        at weblogic.ldap.EmbeddedLDAP.validateVDEDirectories(EmbeddedLDAP.java:1035)
        at weblogic.ldap.EmbeddedLDAP.start(EmbeddedLDAP.java:212)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        Truncated. see log file for complete stacktrace
_________________
Since error was point to embedded LDAP server for weblogic so I compared files related to embedded ldap server ($DOMAIN_HOME/ servers/ AdminServer/ data/ ldap/) with one of our running weblogic instance and found that size ofreplicas.prop file was 0 byte.
 $DOMAIN_HOME/servers/AdminServer/data/ldap/conf
-rw-r—– 1 oraowc dba 568 Aug 13 09:17 vde.prop
-rw-r—– 1 oraowc dba   0 Aug 13 09:17 mapping.cfg
-rw-r—– 1 oraowc dba   0 Aug 13 14:33 replicas.prop
.
Fix:
Option 1 - Open
 $DOMAIN_HOME/servers/AdminServer/data/ldap/conf/replicas.prop and add line
replica.num=0
or
Option 2- Move file $DOMAIN_HOME/servers/AdminServer/data/ldap/conf/replicas.prop to replicas.prop.bak  (On Restart WebLogic Server will recreate this file)

Unable to start Admin server BEA-000386 (Server subsystem failed. Reason: java.lang.AssertionError: java.lang.reflect.InvocationTargetException)

Problem: Not able to start Admin server with BEA-000386 Error.

Symptom:
Weblogic Server fail with below error:

<Apr 30, 2014 5:50:48 PM IST> <Critical> <WebLogicServer> <BEA-000386> <Server subsystem failed. Reason: java.lang.AssertionError: java.lang.reflect.In
ocationTargetException
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
        at weblogic.descriptor.DescriptorManager$SecurityServiceImpl$SecurityProxy._invokeServiceMethod(DescriptorManager.java:175)
        at weblogic.descriptor.DescriptorManager$SecurityServiceImpl$SecurityProxy.decrypt(DescriptorManager.java:192)
        at weblogic.descriptor.DescriptorManager$SecurityServiceImpl.decrypt(DescriptorManager.java:114)
        at weblogic.descriptor.internal.AbstractDescriptorBean._decrypt(AbstractDescriptorBean.java:1092)
        at weblogic.management.configuration.SecurityConfigurationMBeanImpl.getCredential(SecurityConfigurationMBeanImpl.java:737)
        Truncated. see log file for complete stacktrace
Caused By: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at weblogic.descriptor.DescriptorManager$SecurityServiceImpl$SecurityProxy._invokeServiceMethod(DescriptorManager.java:173)
        Truncated. see log file for complete stacktrace
Caused By: weblogic.security.internal.encryption.EncryptionServiceException
        at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptBytes(JSafeEncryptionServiceImpl.java:139)
        at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.decryptString(JSafeEncryptionServiceImpl.java:187)
        at weblogic.security.internal.encryption.ClearOrEncryptedService.decrypt(ClearOrEncryptedService.java:96)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        Truncated. see log file for complete stacktrace
>

Solution:
The file SerializedSystemIni.dat has become corrupted. Admin Server will not start because it is not able to decrypt the credential and perform authentication properly.

Take backup of config.xml file and replace all the encrypted values with plain text, like below:

<credential-encrypted>{AES}HLsT8dQxvGB0z6NBItIlMaiX/kYyI/d7SNqhwnqL/xot2gUAj7EglBJeM2mkynJDZUbwCe7cN6hwVRU5jZkLOZLA3C/WUqlc6voRI9mKiPTfaqMvqNSJsny+gas8V8cO</credential-encrypted>

<credential-encrypted>SimpleText</credential-encrypted>

Once you restart the Admin Server, all the plain text values will get encrypted again.

Error: Server subsystem failed. Reason: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 while Starting Weblogic managed server !!

Issue details :- we got below exception during weblogic manged server and UI showing status FAILED TO START SERVER. xxx_server.out file saw below exception.. ..


--------------- Exception in .OUT logs
<Jul 30, 2014 8:33:56 PM EDT> <Notice> <Cluster> <BEA-000142> <Trying to download cluster JNDI tree from server soa_server1.>
<Jul 30, 2014 8:33:57 PM EDT> <Critical> <WebLogicServer> <BEA-000386> <Server subsystem failed. Reason: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.RangeCheck(ArrayList.java:547)
        at java.util.ArrayList.get(ArrayList.java:322)
        at weblogic.rmi.cluster.BasicReplicaList.getPrimary(BasicReplicaList.java:90)
        at weblogic.rmi.cluster.ClusterableRemoteRef.getPrimaryRef(ClusterableRemoteRef.java:155)
        at weblogic.rmi.cluster.ClusterableRemoteRef.add(ClusterableRemoteRef.java:474)
        Truncated. see log file for complete stacktrace
> 
<Jul 30, 2014 8:33:57 PM EDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED>
<Jul 30, 2014 8:33:57 PM EDT> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down>
<Jul 30, 2014 8:33:57 PM EDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN>
<Jul 30, 2014 8:33:57 PM EDT> <Warning> <oracle.soa.services.notification> <BEA-000000> <<.> With the current setting, only Email notifications will be sent; Notifications via voice, SMS or IM   will not be sent. If you would like to enable them, please configure corresponding sdpmessaging driver. Then modify the accounts and set NotificationMode attribute to ALL in workflow-notifica  tion-config.xml>
[TopLink Info]: 2014.07.30 20:33:58.166--ServerSession(301646737)--deferred_session logout successful
[TopLink Info]: 2014.07.30 20:33:58.166--ServerSession(304814922)--tracking_session logout successful
<Jul 30, 2014 8:33:59 PM EDT> <Error> <JMSPool> <BEA-169805> <A pooled JMS connection is being closed because an error was detected on the connection: Unknown reason>
<Jul 30, 2014 8:34:00 PM> <FINEST> <NodeManager> <Waiting for the process to die: 20768>
<Jul 30, 2014 8:34:00 PM> <INFO> <NodeManager> <Server failed during startup so will not be restarted>

<Jul 30, 2014 8:34:00 PM> <FINEST> 
---------------------------- OR ----------------------------------


Solution :- Please verify Disk space availabe in System[if yes the clean unnecessary files and make sure available disk space should be 20-40% of total disk space]  then shutdown whole domain including node manager[NM] {FYI- I believe there is no command available to stop NM. Please kill it kill -9 [PID] }

NOTE:- Rolling restart doesn't help. must be stop whole domain and start

Step1:- Start NM  then start Admin servers. 
Step2:- Before start the Managed servers Clean tmp and cache folders under @DOMAIN_HOME/servers/xxx_server1/ 

it's worked for our environment all time[Please let me know if issue is not resolved..then will update this blog...]

Create WebLogic 12C Datasource using WLST Scripting Tool


          Creating and configuring various resources in WebLogic Server using WLST tool, where we used properties file data as an input to the resource configuration. Here is an example in which we can see How to Configure WebLogic DataSource using WLST tool
In bellow sample, use a properties file to avoid hard coding. This script will be same for various DataSource configuration and need to change the Properties files entry to make a new DataSource.
Step1). Create a Directory (Based on space availability) in your file system:
”C:WLST_DS_Creation” and place a properties file like below in this directory with name “Datasource.properties”
Datasource.properties:
Location of Properties:- C:\Users\krushnavenus\Desktop\Datasource\datasource.properties
 




Datasource.py:
 Step2). Create Datasource in different directory by following WLST script
Create “Datasource.py”:
Location of Datasource.py:- C:\Users\krushnavenus\Desktop\Datasource\datasource.py

# ###############     Connecting to Start     #################################
def connectAdmin() :
 try:
  connect(CONUSR,CONPWD, CONURL)
  print('Successfully connected')
 except:
  print 'Unable to find admin server...'
  exit()
################### Configuring Connection Pool #############################
def connPool(DSnam) :
 DRVPARM='/JDBCSystemResources/'+DSnam+'/JDBCResource/'+DSnam+'/JDBCDriverParams/'+DSnam
 cd(DRVPARM)
 set('Url',DBURL)
 set('DriverName',DBDRV)
 set('Password',DBPASS)
 cd(DRVPARM+'/Properties/'+DSnam)
 cmo.createProperty('user')
 cd(DRVPARM+'/Properties/'+DSnam+'/Properties/user')
 set('Value',DBUSR)

############         Creating Data source    ###############################
def createDS() :
 print('Naming the datasource')
 DSnam = DSName
 cmo.createJDBCSystemResource(DSnam)
 RESOURCE='/JDBCSystemResources/'+DSnam+'/JDBCResource/'+DSnam
 cd(RESOURCE)
 set('Name',DSnam)

 #Setting JNDI name
 cd(RESOURCE+'/JDBCDataSourceParams/'+DSnam)
 print RESOURCE+'/JDBCDataSourceParams/'+DSnam
 set('JNDINames',jarray.array([String(JNDIName)], String))

 connPool(DSnam)

 #Set Connection Pool specific parameters
 cd(RESOURCE+'/JDBCConnectionPoolParams/'+DSnam)
 cmo.setTestConnectionsOnReserve(true)
 cmo.setTestTableName('SQL SELECT 1 FROM DUAL')
 cmo.setConnectionReserveTimeoutSeconds(25)
 cmo.setMaxCapacity(15)
 cmo.setConnectionReserveTimeoutSeconds(10)
 cmo.setTestFrequencySeconds(120)

 cd(RESOURCE+'/JDBCDataSourceParams/'+DSnam)
 cmo.setGlobalTransactionsProtocol('TwoPhaseCommit')
 cd('/JDBCSystemResources/'+DSnam)

 # targets the DS to Servers(Cluster or Server)
 #targetType=raw_input('Target to (C)luster or (S)erver: ')
 #if targetType in ('C','c') :
 if targetType == 'true':
  #clstrNam=raw_input('Cluster Name: ')
  set('Targets',jarray.array([ObjectName('com.bea:Name='+clstrNam+',Type=Cluster')], ObjectName))
 else:
  #servr=raw_input('Server Name: ')
  set('Targets',jarray.array([ObjectName('com.bea:Name='+servr+',Type=Server')], ObjectName))

###############     Main Script   #####################################
if __name__== "main":
 print('This will enable you to create or update a Datasource')
 connectAdmin()
 edit()
 startEdit()
 # Create a new JDBC resource)
 cd('/')
 createDS()
 save()
 activate()
 dumpStack()
 disconnect()
####################################



execution command:-
syntax:
$MW_HOME/$WL_HOME/common/bin/wlst.sh –loadProperties datasource.properties datasource.py location
Execution command:-
D:\u02\app\Oracle\Middleware\Oracle_Home\wlserver\common\bin>wlst.cmd -loadProperties C:\Users\krushnavenus\Desktop\Datasource\datasource.propertiesC:\Users\krushnavenus\Desktop\Datasource\datasource.py


OUT PUT OF DATASOURCES:-
A JDBC data source is an object bound to the JNDI tree that provides database connectivity through a pool of JDBC connections. Applications can look up a data source on the JNDI tree and then borrow a database connection from a data source.
This Screen shot summarizes the JDBC data source objects that have been created in this domain.