在命令行上挂起weblogic数据源 [英] Suspend weblogic datasource on command line

查看:567
本文介绍了在命令行上挂起weblogic数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否还有暂停/恢复weblogic 10 jdbc数据源通过命令行。我知道我可以在管理控制台这样做,但因为我们的应用程序有很多不同的数据源,这是一个痛苦。



这背后的原因是,我们的测试人员正在进行错误流测试,并且必须模拟db下降。理想情况下,我想给一个bat文件暂停所有的数据源和另一个恢复所有的数据源。



任何想法?



感谢

解决方案

您可以使用WLST脚本来完成。从命令行运行$ BEA_HOME / wlserver10.0 / common / bin / wlst.sh(Windows上的.cmd):
连接到正在运行的服务器。使用托管服务器端口,因为这是服务器运行时属性:

  wls:/ offline> connect('weblogic','weblogic','t3:// localhost:7002')



到服务器运行时树:
wls:/ mydomain / serverConfig> serverRuntime()



导航到JDBCService,管理服务器名称,JDBCDataSource运行时到您的数据源名称:

  wls:/ mydomain / serverRuntime> cd('JDBCServiceRuntime / managedsrv1 / JDBCDataSourceRuntimeMBeans / MyDS')

然后暂停并恢复: p>

  wls:/ mydomain / serverRuntime / JDBCServiceRuntime / managedsrv1 / JDBCDataSourceRuntimeMBeans / MyDS> cmo.suspend()
wls:/ mydomain / serverRuntime / JDBCServiceRuntime / managedsrv1 / JDBCDataSourceRuntimeMBeans / MyDS> cmo.resume()

使用命令ls()查看其他变量和操作。 p>

I was Wondering if there is anyway of suspending / resuming weblogic 10 jdbc datasources via the command line. I am aware that i can do this in the admin console, but because our app has many different datasources it is a bit of a pain.

The reason behind this is that our testers are doing error flow tests and have to simulate the db going down. Ideally i would like to give then a bat file for suspending all datasources and another one for resuming all datasources.

Any ideas?

Thanks

解决方案

You can use the WLST scripting to do that. From the command line, run $BEA_HOME/wlserver10.0/common/bin/wlst.sh (.cmd on Windows): Connect to the running server. Use the managed server port as this is a server runtime property:

wls:/offline> connect('weblogic','weblogic','t3://localhost:7002')

Go to the serverRuntime tree: wls:/mydomain/serverConfig> serverRuntime()

Navigate to the JDBCService, to your managed server name, the JDBCDataSource Runtime and finally to your datasource name:

wls:/mydomain/serverRuntime> cd('JDBCServiceRuntime/managedsrv1/JDBCDataSourceRuntimeMBeans/MyDS')

Then just suspend and resume it:

wls:/mydomain/serverRuntime/JDBCServiceRuntime/managedsrv1/JDBCDataSourceRuntimeMBeans/MyDS> cmo.suspend()
wls:/mydomain/serverRuntime/JDBCServiceRuntime/managedsrv1/JDBCDataSourceRuntimeMBeans/MyDS> cmo.resume()

use command ls() to see the the other variables and operations.

这篇关于在命令行上挂起weblogic数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆