Thursday, April 17, 2014

WLST script to migrate default File Stores to JDBC store in weblogic servers

WLST script to migrate default File Stores to JDBC store in weblogic servers

The persistent store provides a built-in, high-performance storage solution for WebLogic Server subsystems and services that require persistence. For example, it can store persistent JMS messages or temporarily store messages sent using the Store-and-Forward feature. The persistent store supports persistence to a file-based store or to a JDBC-enabled database.
By default, File store is used as a persistence store for weblogic servers
File stores are generally easier to configure and administer, and do not require that WebLogic subsystems depend on any external component.
File stores generate no network traffic; whereas, JDBC stores will generate network traffic if the database is on a different machine from WebLogic Server.
JDBC stores may make it easier to handle failure recovery since the JDBC interface can access the database from any machine on the same network. With the file store, the disk must be shared or migrated.
This tutorial explains the approach to migrate the default JMS file store to a DB store through WLST script.

Data Source

As a first step, create a schema in target database(beloSQL for Oracle database)
alter session set “_ORACLE_SCRIPT”=true;
create user JDBC_STORE_USER
identified by “jdbcstoreuser”
temporary tablespace temp
default tablespace users;
grant connect to JDBC_STORE_USER;
grant resource to JDBC_STORE_USER;
grant create session to JDBC_STORE_USER;
ALTER USER JDBC_STORE_USER quota unlimited on USERS;
Create a data source with name “JDBCStoreDataSource” to connect to the database
weblogic-migrate-file-store-to-jdbc-store
A JDBC store must use a JDBC data source that uses a non-XA JDBC driver and has Supports Global Transactions disabled.
weblogic-migrate-file-store-to-jdbc-store
weblogic-migrate-file-store-to-jdbc-store
weblogic-migrate-file-store-to-jdbc-store.png
Test the configurations and ensure the test connection successful
weblogic-migrate-file-store-to-jdbc-store
Target the data source to all the servers in the domain so the same data source can be used by all the servers to manage the JDBC stores(For demo i am targeting only to Admin Server)
Now the data source is ready and can be used for JDBC store configurations

WLST Script

The below wlst script migrate the existing File Store to JDBC Persistence store — my case the server is enabled with one persistence store(BAMMonitoringJMSFileStore) for JMS Server(BAMMonitoringServer) and targeted only to Admin Server so the script migrate the JMS store to JDBC store and target to Admin Server, modify the script based on the number of existing File store configuration
weblogic-migrate-file-store-to-jdbc-store
weblogic-migrate-file-store-to-jdbc-store.

MigrateFileStoreToJDBSStore.py

import sysprint "@@@ Starting the script ..."from java.util import *
from javax.management import *#The directory of the domain configuration
#/app/oracle/products/11g/admin/domains
wlsDomain='C://Albin/SW/Oracle/Middleware/Oracle_Home/user_projects/domains/base_domain'
print "WLSDOMAIN="+wlsDomainadminURL='t3://localhost:7001'
adminUserName='weblogic'
adminPassword='weblogic1'
connect(adminUserName, adminPassword, adminURL)
edit()
startEdit()
############# JDBC stores for STANDALONE ADMINSERVER ## Enable and target unique JDBC Store for all the servers in the domain
cd('/')
cmo.createJDBCStore('BAMMonitoringJMSJDBCStore')
cd('/JDBCStores/BAMMonitoringJMSJDBCStore')
cmo.setDataSource(getMBean('/SystemResources/JDBCStoreDataSource'))
cmo.setPrefixName('bammonitoring')
set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))#### Add 
#### end of creating jdbc stores############Set Persistent Stores for the sub systems e.g JMS Serverscd('/JMSServers/BAMMonitoringServer')
cmo.setPersistentStore(getMBean('/JDBCStores/BAMMonitoringJMSJDBCStore'))#################DESTROY ALL THE EXISTING FILE STOREScd('/')
cmo.destroyFileStore(getMBean('/FileStores/BAMMonitoringJMSFileStore'))
 
save()
activate()
Script

techforum-repo/youttubedata

Contribute to techforum-repo/youttubedata development by creating an account on GitHub.

github.com


Before executing the script, change the configurations as required.
Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd MigrateFileStoreToJDBSStore.py
weblogic-migrate-file-store-to-jdbc-store
The existing file store is deleted after enabling the JDBC store for the modules.
weblogic-migrate-file-store-to-jdbc-store
weblogic-migrate-file-store-to-jdbc-store
For clustered environment the same should be executed for all the servers in the cluster with unique JDBC store name(e.g BAMMonitoringJMSJDBCStore for server 1 and BAMMonitoringJMSJDBCStore2 for server 2).
Restart the servers, the required tables({PrefixName}WLStore) — BAMMonitoringWLStore will be created.
The config.xml file will be enabled with required JDBC store configurations as below.
weblogic-migrate-file-store-to-jdbc-store
The table with name “BAMMONITORINGWLSTORE” created in database
select object_name as table_name from user_objects where object_type = ‘TABLE’ order by object_name;
weblogic-migrate-file-store-to-jdbc-store
The required data now stored into the JDBC store
weblogic-migrate-file-store-to-jdbc-store
This concludes the migration of existing Default File Store to JDBC store. The File Store and JDBC store has its own merits and demerits, the stores should be selected based on the uses cases — File Store provides better performance but JDBC store provides better recovery support.




WLST script to update Graceful Shutdown parameters in weblogic server

WLST script to update Graceful Shutdown parameters in weblogic server


A graceful shutdown gives WebLogic Server subsystems time to complete certain application processing currently in progress.

Graceful Shutdown


The Graceful Shutdown command transitions a server instance from the RUNNING state to the SHUTDOWN state, allowing work in process to be handled gracefully, with this sequence of state transitions:

RUNNING > SUSPENDING > ADMIN > SHUTTING_DOWN > SHUTDOWN

Controlling Graceful Shutdown


Ignore Sessions During Shutdown — If you enable this option WebLogic Server will drop all HTTP sessions immediately, rather than waiting for them to complete or timeout. Waiting for abandoned sessions to timeout can significantly lengthen the graceful shutdown process, because the default session timeout is one hour.

Graceful Shutdown Timeout — Specifies a time limit for a server instance to complete a graceful shutdown. If you supply a timeout value, and the server instance does not complete a graceful shutdown within that period, WebLogic Server performs a forced shutdown on the server instance.

This tutorial explains the approach to update graceful update parameters through WLST script in weblogic

WLST Script


The script will help us to update the Graceful Shutdown parameter for the servers in the weblogic domain.

UpdateGracefulShutdownParameters.py


Script

https://github.com/techforum-repo/youttubedata/blob/master/scripts/wlst/UpdateGracefulShutdownParameters.py

Before executing the script, change the configurations as required.

Execute the script — <<Oracle_Home>>\oracle_common\common\bin\wlst.cmd UpdateGracefulShutdownParameters.py

Now the Graceful Shutdown Parameters updated for all the servers in the domain




Wednesday, April 16, 2014

oracle.webservices.preemptiveBasicAuth for invoking the webservices with Basic Authentication- Oracle SOA Suite

oracle.webservices.preemptiveBasicAuth for invoking the webservices with Basic Authentication- Oracle SOA Suite

HTTP basic authentication can have two types of authentication handshake methods, one is Reactive another one is Preemptive,

Reactive:

  • The client makes a request for a resource which needs authentication;
  • The server returns an HTTP 401 Authorization required response (indicating the authentication scheme and realm) with WWW-Authenticate header.
  • The client re-submits the request with an Authentication header;
  • The server verifies client credentials and returns the resource if authenticated successfully..

Preemptive:

The client can preemptively pass the credentials on the first request. The server returns immediately the resource if authenticated successfully.

Not all the authentication server accepts the Preemptive authentication mode, The NTLM authentication will not support the Preemptive handshake method it should be Reactive.

In Oracle SOA 11g the parnerlink binding property oracle.webservices.preemptiveBasicAuth will help us to set the handshake method accordingly.
  • oracle.webservices.preemptiveBasicAuth=false - Reactive mode
  • oracle.webservices.preemptiveBasicAuth=true - Preemptive mode


Tuesday, April 15, 2014

Response is displayed in compressed form while testing the Siebel webservices from SOAP UI

Response is displayed in compressed form while testing the Siebel webservices from SOAP UI

When i am trying to test the Siebel web services from SOAP UI the response is displayed in compressed form, seems the response is return in compressed for(i am not sure this is part of some Siebel configuration)


To display the response in decompressed form, make sure the option "Accept compressed responses from hosts" option in SOAP UI preference.





Monday, April 14, 2014

Backing up the MDS Repository Artifacts - Oracle SOA Suite 11g

Backing up the MDS Repository Artifacts - Oracle SOA Suite

In Oracle SOA Suite 11g and Oracle SOA Suite 12c , all the common artifacts , the deployed composites and the common configurations are stored in the MDS database schema. Sometimes there is a possibility of MDS schema getting corrupted (the best example is the composites getting corrupted frequently)those scenario we will not be able to bring up the soa-infra and also we may loose all the deployments.

Backing up the MDS artifacts is the the solution for these kind of issues.

In this post i will be explaining some of the different options to back up the MDS artifacts.

The best approach is do a full back up of MDS repository schema using database backup utilities(dbexp).The backup can be restored if there is any issue with the MDS schema.

EM console - MDS configuration Page :

Right click on soa-infra and click on Administration and MDS Configuration.
Click Export on MDS Configuration page.


This will export the MDS artifacts to local machine as zip file.