Blog Archives
Installing Standalone Oracle Http Server 12c R2 (12.2.1.1) on Windows 2012 R2
IMPORTANT!
According to MOS note Oracle Web Tier – Statement of Direction (Doc ID 1576588.1) Oracle mod_plsql in Oracle HttpServer is deprecated as of version OHS 12.1.3.
If you’re reading this to learn how to install OHS because your application depends on mod_plsql functionality, then we have a bad news for you. Oracle removed mod_plsql from OHS 12.2. So, the best help that we can give you is our reference installation note for OHS 12.1.3 installation on Windows 2012 R2.
Oracle recommends to move to Oracle REST Data Services (ORDS) (formerly known as Apex Listener) on top of Oracle WebLogic, Oracle Glassfish or Apache Tomcat.
Of course, if you’re still interested in installation procedure for OHS 12.2 on top of Windows 2012 R2 keep reading….
Once again, we got a brand new server with Windows 2012 R2, on which we wanted to install standalone Oracle HttpServer 12c R2 (12.2.1.1.0). If you read our post from the last year covering Oracle HttpServer 12.1 installation on Windows 2012 R2, you already know that we’re a big fans of Oracle end user friendliness and admiration of Oracle engineering capabilities to transform a mouse to an elephant. Let’s see if this crap excellent piece of software installs as smooth in Release 2 as it did in Release 1.
Find and download fmw_12.2.1.1.0_ohs_win64_Disk1_1of1.zip from OTN, at the time of this writing you should see something like this:
Unpack fmw_12.2.1.1.0_ohs_win64_Disk1_1of1.zip and run setup_fmw_12.2.1.1.0_ohs_win64.exe.
Setup will check the system prerequisites, you should be fine if you’re installing on Windows 2012 R2. Now, we’ll show you some screenshots from our installation with comments whenever we think they’re necessary. Basically, we left most options at default (apart from changing the Oracle home).
According to Oracle documentation:
On the Windows platform, Oracle HTTP Server requires Microsoft Visual C++ run-time libraries to be installed on the system.
To meet this system requirement for Oracle HTTP Server, download the Visual C++ Redistributable for Visual Studio 2012
software from the following URL: https://www.microsoft.com/en-us/download/details.aspx?id=30679D
After we downloaded and installed Visual C++ (VS 2012) redistributable we hit the Rerun button and the check completed successfully…
As you can notice, there is no screenshot of step #9. After we clicked Next on Step #8 the new dialog window opened for a second and immediately closed. Perhaps it was just us….fortunately, we could made an educated guess that the last screen should likely be an informative one, like the one that we saw during OHS 12c R1 installation:
…suggesting that fun is not over yet and that you need to create domain with the Configuration Wizard. Start configuration Wizard from:
D:\ORACLE\OFM\OFM12\oracle_common\common\bin\config.cmd
and configure Oracle Http Server in standalone mode…
If you check Windows services at this time you’ll see, well, nothing. We need to create service for Node Manager before we can start Http server.
Note that we installed Oracle HttpServer 12c R2 in ORACLE_HOME: D:\ORACLE\OFM.
First open command prompt (cmd) wit “Run as Administrator” and set the path before you run installNodeMgrSvc.cmd:
set DOMAIN_HOME_BIN=D:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin set PATH=%DOMAIN_HOME_BIN%;%PATH% installNodeMgrSvc.cmd
And if everything has gone well you should see the message at command prompt, with the line:
... Oracle Weblogic base_domain NodeManager (D_ORACLE_OFM_OFM12_wlserver) installed. ...
Script installeNodeMgrSvc.cmd created a new service, that reads, don’t hold your breath….:
"Oracle Weblogic base_domain NodeManager (D_ORACLE_OFM_OFM12_wlserver)"
with path to the executable like this:
D:\ORACLE\OFM\OFM12\wlserver\server\bin\wlsvcX64.exe
Yes, they probably set a World record for the length of a Windows service. What a schmucks.
The service is installed using the default Node Manager listen port (5556). By default Node Manager Listens only on localhost.
Now, we can finally start Oracle HttpServer 12c R2. First, make sure that Node manager service is running and if it’s not then start “Oracle Weblogic base_domain NodeManager (D_ORACLE_OFM_OFM12_wlserver)”.
You can START Oracle HttpServer 12c R2 on command line with:
set DOMAIN_HOME_BIN=D:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin set PATH=%DOMAIN_HOME_BIN%;%PATH% startComponent ohs1
You’ll be asked to enter password for Node Manager which you entered on screen 6 of Oracle Fusion Middleware Configuration Wizard.
You can STOP Oracle HttpServer 12c R2 on command line with:
set DOMAIN_HOME_BIN=D:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin set PATH=%DOMAIN_HOME_BIN%;%PATH% stopComponent ohs1
There is also a WLST tool (wlst.cmd) that allow us to manipulate with running OHS.
Using WLST to control OHS:
Open WLST D:\ORACLE\OFM\OFM12\oracle_common\common\bin\wlst.cmd: Initializing WebLogic Scripting Tool (WLST) ... Welcome to WebLogic Server Administration Scripting Shell Type help() for help on available commands wls:/offline> nmConnect('administrator','mysecretpassword','localhost','5556','base_domain','D:/ORACLE/OFM/OFM12/user_projects/domains/base_domain','ssl') // status wls:/nm/base_domain> nmServerStatus(serverName='ohs1', serverType='OHS') RUNNING // soft restart wls:/nm/base_domain> nmSoftRestart(serverName='ohs1', serverType='OHS') // stop OHS wls:/nm/base_domain> nmKill(serverName='ohs1', serverType='OHS') Killing server ohs1 ... Successfully killed server ohs1 // status wls:/nm/base_domain> nmServerStatus(serverName='ohs1', serverType='OHS') SHUTDOWN // start wls:/nm/base_domain> nmStart(serverName='ohs1', serverType='OHS')
And finally, let’s see where is the config file for httpd. According to the Oracle Http 12c documentation there are runtime and staging config files and we should always edit staging config file(s). In our example the config file location is:
Domain home bin : D:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin httpd.conf : D:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\config\fmwconfig\components\OHS\ohs1
Final Test….open IE and go to http://localhost:7777:
HTTP 400 error Too many arguments passed in
In one of our Apex-like application user reported a HTTP 400 error after clicking on a button that invokes PL/SQL procedure. At first glance I suspected a missing execute privilege but the quick look at Oracle HTTP log revealed the true reason:
X:\ORACLE\OFM\OFM11\instances\instance1\diagnostics\logs\OHS\ohs1\ohs1.log)
[2016-05-04T10:58:23.9709+02:00] [OHS] [ERROR:32] [OHS-9999] [core.c] [host_id: ACMEHOST] [host_addr: 10.10.10.11] [pid: 5048] [tid: 1816] [user: SYSTEM] [VirtualHost: main] MODPLSQL-00359: mod_plsql: /sales/!appschema.orderentry.program HTTP-400 Too many arguments passed in(2002). Limit is 2000, referer: http://ohs.acme.com/sales/!appschema.orderentry.program
-> HTTP-400 Too many arguments passed in(2002). Limit is 2000
.. so, the reason for the error is the default limit in mod_plsql on the number of parameters that can be passed to the pl/sql procedure.
A search on MOS confirmed by suspicion, please refer to:
Modplsql application throws “HTTP-400 Too many arguments passed in. Got 7076 parameters. Upper limit is 7000” (Doc ID 386946.1)
After adding directive “PlsqlMaxParameters 4000” to the plsql.conf and restarting the http listener (cmd> opmnctl restartproc process-type=OHS), the problem was solved.
Our plsql.conf looks like this:
X:\ORACLE\OFM\OFM11\instances\instance1\config\OHS\ohs1\moduleconf\plsql.conf # ============================================================================ # mod_plsql configuration file # ============================================================================ # 1. Please refer to plsql.README for a description of this file # 2. Parameters in this file have to be configured manually # ============================================================================ # Configure Oracle HTTP Server to load mod_plsql LoadModule plsql_module ${ORACLE_HOME}\ohs\modules\mod_plsql.dll # Load in mod_plsql directives only if mod_plsql is loaded <IfModule mod_plsql.c> # ============================================================================ # Global Settings Section : Directives that apply to all DADs # ============================================================================ PlsqlLogEnable on PlsqlLogDirectory "${ORACLE_INSTANCE}\diagnostics\logs\${COMPONENT_TYPE}/${COMPONENT_NAME}" # 4.5.2016 -- (see MOS ID 386946.1) PlsqlMaxParameters 4000 # PlsqlIdleSessionCleanupInterval 15 (default) # PlsqlDMSEnable On (default) # ============================================================================ # Database Access Descriptors Settings Section # ============================================================================ include "${ORACLE_INSTANCE}\config\${COMPONENT_TYPE}\${COMPONENT_NAME}\mod_plsql\dads.conf" # Custom DAD's for Acme.com include "${ORACLE_INSTANCE}\config\${COMPONENT_TYPE}\${COMPONENT_NAME}\mod_plsql\marvel.conf" # ============================================================================ # Cache Settings Section # ============================================================================ include "${ORACLE_INSTANCE}\config\${COMPONENT_TYPE}\${COMPONENT_NAME}\mod_plsql\cache.conf" </IfModule>
MS Access 2016 — a bug finally fixed after 16 years
[UPDATE on February 2018 — make sure that you read Part 2 as well!]
Around ~2001/2002 we found a bug in Microsoft MS Access in a combination with Oracle ODBC.
Bug is finally fixed in MS Access 2016.
Imagine this Oracle table:
create table salary (name varchar2(10), salary number(7,2), salary2 number); insert into salary values ('King',12345.55,12345.55); 1 row created. commit; Commit complete. select * from salary; NAME SALARY SALARY2 ---------- ---------- ---------- King 12345,55 12345,55
Note that salary table has salaries stored in NUMBER(n,m) and plain NUMBER data types.
Let’s see what we get if we use MS Access 2010 with Microsoft ODBC driver for Oracle to link the salary table:
Everything is OK. Now, let’s try to link the same table, but this time with Oracle ODBC driver:
Oooppsss. MS Access converted decimal number 12345,55 to an integer 1234555. Someone would argue that this can also be a bug in Oracle ODBC. But it isn’t, because Excel (or any other ODBC app) has no problem handling decimal data over Oracle ODBC driver. This bug persisted in all recent releases MS Office 2000, 2002, 2003, 2007, 2010 and 2013. Using Oracle ODBC with any of those MS Access versions was a big NO for us.
The problem is that the only workaround was to link tables using Microsoft ODBC driver for Oracle, which is 32-bit only, deprecated by Microsoft and not enhanced in at least a decade. You can imagine my surprise after I installed 64-bit version of MS Office 2016 and trying to link to Oracle table with Oracle12c ODBC driver (also tested with older 11g driver) and realized that Microsoft finally nailed the bug after 16+ years.
Oh, and if you wonder if I submitted bug report to Microsoft and Oracle sixteen years ago? Yes, I did. Microsoft product manager simply redirected me to Oracle Support and Oracle support told me that they think that the problem are undocumented hooks in MS Access, hence, MS ODBC driver for Oracle somehow works and driver written by Oracle according to official ODBC specs doesn’t. Oracle suspicion was correct anyway, because the bug was always limited to MS Access.
ODAC 12c Release 4 ODP.NET managed driver with Oracle Wallet gotcha
We’re pleased that Oracle fixed the issue with the ODP.NET managed driver in the newly released ODAC 12c Release 4, that prevented us to use Oracle Wallet as a password store in the past. We have several .NET applications that’re read-only, intended to be used by multiply end users. Users don’t need personal database accounts. Instead, we want our application to read app-user credentials from Oracle Wallet.
Until ODAC 12c Release 4 we were unable to use ODP.NET managed driver with Oracle Wallet file method. The issue that we had was limited to the managed driver, unmanaged driver has no problem reading Oracle Wallet password store.
After we saw new feature announcement on page 3: Secure External Password Store SEPS….”ODP.NET, Managed Driver supports storing password credentials using SEPS.”, we decided to test this.
We created and configured Oracle Wallet:
cmd> mkstore -wrl D:\OW\ACME -create cmd> mkstore -wrl D:\OW\ACME -createCredential apptns appuser apppassword Then we configured sqlnet.ora: SQLNET.AUTHENTICATION_SERVICES = (NONE) NAMES.DIRECTORY_PATH= (TNSNAMES) WALLET_LOCATION = (SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=D:\OW\ACME))) SQLNET.WALLET_OVERRIDE = TRUE and tnsnames.ora: APPTNS = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = acmedb.host.com) (PORT = 1521) ) ) (CONNECT_DATA = (SID = ACME) ) ) Finally we tested the connection with: sql> connect /@apptns Connected.
So far, so good. Oracle Wallet is prepared to be used by .NET application with managed driver 12c Release 4.
We saved sqlnet.ora and tnsnames.ora in the same directory with Oracle Wallet files. Relevant part of the application config looked like this:
<oracle.manageddataaccess.client> <version number="*"> <settings> <setting name="TNS_ADMIN" value="D:\OW\ACME"/> <setting name="TraceLevel" value="7" /> <setting name="TraceOption" value="1"/> <setting name="TraceFileLocation" value="D:\TRACE" /> </settings> </version> </oracle.manageddataaccess.client>
Just for the record, we could set everything (sqlnet.ora parameters + tns alias) in app.config as well:
<oracle.manageddataaccess.client> <version number="*"> <settings> <setting name="TraceLevel" value="7" /> <setting name="TraceOption" value="1"/> <setting name="TraceFileLocation" value="D:\TRACE" /> <setting name="SQLNET.AUTHENTICATION_SERVICES" value="null" /> <setting name="WALLET_LOCATION" value="(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=D:\OW\ACME)))" /> <setting name="SQLNET.WALLET_OVERRIDE" value="TRUE" /> <setting name="NAMES.DIRECTORY_PATH" value="(TNSNAMES)" /> </settings> <dataSources> <dataSource alias="APPTNS" descriptor="APPTNS = (DESCRIPTION =(ADDRESS_LIST=(ADDRESS =(PROTOCOL = TCP)(HOST = acmedb.host.com)(PORT = 1521)))(CONNECT_DATA=(SID=ACME)))"/> </dataSources> </version> </oracle.manageddataaccess.client>
For the purpose of testing managed driver with Oracle Wallet, we wrote simple applet that takes Username, Password and TNS alias from the end user:
displays connection string:
and displays a message “Connection Opened!” if login was successful. But instead, we’re surprised by ORA-01017 error:
I will spare you with all the dirty details of troubleshooting that we went through, finally we decided to turn on sqlnet trace by adding three parameters to the app.config, namely; TraceLevel, TraceOption and TraceFileLocation (note that Oracle documentation at the time of this writing has a typo: TraceFileLocations. Note the “s”, this is wrong!).
And found this:
2015-11-25 13:08:47.270153 TID:3 (PRI) (CP) OracleConnectionImpl.Connect() OracleConnectionImpl.Connect => Querying Data Source:APPTNS 2015-11-25 13:08:47.291153 TID:3 (NET) (SQLNET) SEPS userid is null. 2015-11-25 13:08:47.291153 TID:3 (NET) (SQLNET) SEPS password is null.
What the hack? We have APPTNS in our Oracle Wallet. Or do we?
cmd> mkstore -wrl D:\OW\ACME -listCredential Oracle Secret Store Tool : Version 12.1.0.2 Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved. Enter wallet password: List credential (index: connect_string username) 1: apptns appuser
Is it possible that managed driver is handling tns alias in case sensitive manner? Bingo.
Even thought it doesn’t matter how you connect with the sqlplus, like:
sqlplus /@APPTNS sqlplus /@apptns sqlplus /@Apptns ...
in all three cases login will succeed. Not so with ODP.NET managed driver. You have to specify tns alias precisely with the properly cased string,
as it was used while adding credential to the Oracle Wallet. Is it a bug or a feature? I guess both.
Also, be careful how you compile, if your target is 64 bit OS, then use x86 or AnyCPU as a target. We were out of luck trying to compile for x64 target, meaning that application must run as a 32-bit process, even on 64-bit OS, otherwise Oracle Wallet won’t work.
Installing Standalone Oracle Http Server 12c (12.1.0.3) on Windows 2012 R2
We’re in the middle of replacing an old Fujitsu server running Windows 2003 R2, that was reliably humming for the last 6+ years, with the new one, running Windows 2012R2. One of the things that we decided to install on new server is Oracle Http Server 12c (12.1.0.3). Based on my previous experience, I knew I’ll have to deal with the crappy Oracle distribution of Apache Http server again. The only question was, is it possible to pack and distribute Apache Httpd in creepier form than before (11g), is it possible to surpass end user experience and joy installing and configuring Standalone Oracle Http Server 12c (12.1.0.3). Oracle, again, didn’t disappoint us ;-(. Let’s begin…
Download Oracle Http Server 12c (12.1.0.3) from edelivery.oracle.com:
->"Oracle Fusion Middleware" ->-> "Microsoft Windows x64 (64-bit)" ->->-> "Oracle Fusion Middleware 12c Media Pack" ->->->-> "Oracle Fusion Middleware 12c (12.1.3.0.0) HTTP Server for Microsoft Windows x64 (64-bit)" -- Part Number: V45207-01, 471MB
Unpack zip file and begin installation by running setup_fmw_12.1.3.0.0_ohs_win64.exe. Fortunately, Oracle Http Server 12.1.0.3 is certified on Windows 2012 R2, so you should be fine…here’re the screenshots from our installation:
As you can see on the last screen, we’re not finished, we need to use Configuration wizard to create a “domain” and then start “Node Manager” and “Domain server”… — WTF — why we need to know anything about Weblogic Node Manager, Domain Servers, and other “weblogic parlance”…?? Oracle architects and developers, you should KISS more! ;-). Don’t forget, we’re talking about standalone Oracle Http Server which is not much more than minuscule Apache Httpd with some small proprietary code (mod_plsql…). Anyway, let’s continue…
Start configuration wizard (in our case it was located here: C:\ORACLE\OFM\OFM12\oracle_common\common\bin\config.cmd) and configure Oracle Http server in standalone mode…as you can see we left more or less everything at default:
The fun is not over yet. Your journey to the wonderland of Oracle Http server just started. If you check “Services”, you’ll (of course) find nothing, because Oracle didn’t bother to do this during configuration, it’s up to you to create service for Node Manager.
Steps for creating Windows Service for Node Manager:
Note that we installed Oracle HttpServer 12c in ORACLE_HOME: C:\ORACLE\OFM. 1) Open command prompt (cmd) wit "Run as Administrator" set DOMAIN_HOME_BIN=C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin set PATH=%DOMAIN_HOME_BIN%;%PATH% installNodeMgrSvc.cmd And if everything has gone well you should see a new service named the Oracle way, like this: "Oracle Weblogic base_domain NodeManager (C_ORACLE_OFM_OFM12_wlserver)" with path to executable like this: C:\ORACLE\OFM\OFM12\wlserver\server\bin\wlsvcX64.exe
The service is installed using the default Node Manager listen port (5556).
By default Node Manager Listens only on localhost.
If you’re not yet familiar with OracleHttp server you might think that starting Node manager will also start Oracle Http server you created previously – remember, after all, our main goal from the start is to run Http server. But no, Oracle product managers believes that you need to suffer a bit more….
You can START Oracle HttpServer 12c on command line with:
set DOMAIN_HOME_BIN=C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin set PATH=%DOMAIN_HOME_BIN%;%PATH% startComponent ohs1
You’ll be asked to enter password for the Node Manager which you entered on screen 6 of Oracle Fusion Middleware Configuration Wizard.
You can STOP Oracle HttpServer 12c on command line with:
set DOMAIN_HOME_BIN=C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin set PATH=%DOMAIN_HOME_BIN%;%PATH% stopComponent ohs1
If you want to avoid entering password each time you start OHS, you can ask Oracle to save the password in local encrypted file with parameter storeUserConfig:
set DOMAIN_HOME_BIN=C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin set PATH=%DOMAIN_HOME_BIN%;%PATH% startComponent.cmd ohs1 storeUserConfig Creating the key file can reduce the security of your system if it is not kept in a secured location after it is created. Creating new key... The username and password that were used for this WebLogic NodeManager connection are stored in C:\Users\alesk.ACME\.wlst\nm-cfg-base_domain.props and C:\Users\alesk.ACME\.wlst\nm-key-base_domain.props. Connecting to Node Manager ... Successfully Connected to Node Manager. Starting server ohs1 ... Successfully started server ohs1 ... Successfully disconnected from Node Manager.
What if you want to change username and password that is used to authenticate to Node Manager which we entered in step 6 of Configuration Wizard?
Checkout MOS note 1945039.1 “How to Change the Node Manager Username and Password for Oracle HTTP Server 12c in a Standalone Domain”
Basically what we did was:
1) Stop Http Server and Node Manager C:\ORACLE\OFM\OFM12\oracle_common\common\bin>stopComponent ohs1 Open cmd with "Run as Administrator" and stop NodeManager service: net stop "Oracle Weblogic base_domain NodeManager (C_ORACLE_OFM_OFM12_wlserver)" 2) Invoke WLST offline: C:\ORACLE\OFM\OFM12\oracle_common\common\bin>wlst.cmd Initializing WebLogic Scripting Tool (WLST) ... Welcome to WebLogic Server Administration Scripting Shell Type help() for help on available commands wls:/offline> 3) Read in the domain (make sure you type / and not \ in the path!!) wls:/offline> readDomain('C:/ORACLE/OFM/OFM12/user_projects/domains/base_domain') 4) Get the security MBean (Mr. Bean?): wls:/offline/ohs_domain> cd('/SecurityConfiguration/base_domain') 5. We changed the NM user name, but you can skip this, if you only want to change the password: wls:/offline/base_domain/SecurityConfiguration/base_domain>set('NodeManagerUsername','<new_NM_Username>') ...and my command was: wls:/offline/base_domain/SecurityConfiguration/base_domain>set('NodeManagerUsername','weblogic') 6. We also changed NM password. In our case the encrypted password was stored in C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\config\nodemanager\nm_password.properties. wls:/offline/base_domain/SecurityConfiguration/base_domain>set('NodeManagerPasswordEncrypted','oursecretpassword') wls:/offline/base_domain/SecurityConfiguration/base_domain>updateDomain() wls:/offline/base_domain/SecurityConfiguration/base_domain>closeDomain() wls:/offline/base_domain/SecurityConfiguration/base_domain>exit() 7. Start Node Manager Service net start "Oracle Weblogic base_domain NodeManager (C_ORACLE_OFM_OFM12_wlserver)" 8. Start OHS C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin> startComponent ohs1 If you already stored your password in a key store you have to delete cached key store file (check your user profile directory) before restarting OHS component!
And finally, let’s see where’re the config files for httpd and mod_plsql. According to Oracle Http 12c documentation there’re runtime and staging config files and we should always edit staging config files.
In our example the config file locations are (note that marvel.conf was created by us):
Domain home bin : C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\bin httpd.conf : C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\config\fmwconfig\components\OHS\ohs1 marvel.conf (mod_plsql): C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\config\fmwconfig\components\OHS\ohs1\mod_plsql\marvel.conf include for marvel.conf: C:\ORACLE\OFM\OFM12\user_projects\domains\base_domain\config\fmwconfig\components\OHS\ohs1\moduleconf\plsql.conf
There is also a WLST tool (wlst.cmd) that allow us to manipulate with running OHS. Let’s see…
Using WLST to control OHS:
Open WLST C:\ORACLE\OFM\OFM12\oracle_common\common\bin\wlst.cmd: Initializing WebLogic Scripting Tool (WLST) ... Welcome to WebLogic Server Administration Scripting Shell Type help() for help on available commands wls:/offline> nmConnect('weblogic','mysecretpassword','localhost','5556','base_domain','C:/ORACLE/OFM/OFM12/user_projects/domains/base_domain','ssl') // status wls:/nm/base_domain> nmServerStatus(serverName='ohs1', serverType='OHS') RUNNING // soft restart wls:/nm/base_domain> nmSoftRestart(serverName='ohs1', serverType='OHS') // stop OHS wls:/nm/base_domain> nmKill(serverName='ohs1', serverType='OHS') Killing server ohs1 ... Successfully killed server ohs1 // status wls:/nm/base_domain> nmServerStatus(serverName='ohs1', serverType='OHS') SHUTDOWN // start wls:/nm/base_domain> nmStart(serverName='ohs1', serverType='OHS')
** Edit March 2017 **
I needed a user friendly cli interface for controlling the OHS via “wlst.cmd” scripting environment for my client the other day and since wlst is controlled by Jython it was trivial to write simple python script that offers menu for basic actions, like start, stop and status.
# controlOHS.py # Usage: # C:\ORACLE\OFM\OFM12\oracle_common\common\bin\wlst.cmd controlOHS.py # pwd = None nmConnect('administrator',pwd,'localhost','5556','base_domain','C:/ORACLE/OFM/OFM12/user_projects/domains/base_domain','ssl') def menu(): print("") print("Available commands:") print("==========================================") print("1) softRestart ....soft restart of OHS") print("2) stopOHS ....stop OHS server") print("3) startOHS ....start OHS server") print("4) statusOHS ....status of OHS server") print("5) help ....print this help") print("6) Exit ....exit") print("==========================================") print("") def softRestart(): print("Soft restart...") nmSoftRestart(serverName='ohs1', serverType='OHS') def stopOHS(): print("Stop OHS....") nmKill(serverName='ohs1', serverType='OHS') def startOHS(): print("Start OHS...") nmStart(serverName='ohs1', serverType='OHS') def statusOHS(): print("Status...") nmServerStatus(serverName='ohs1', serverType='OHS') while 1: # endless loop menu() command = raw_input("Command [1..6]: ") if command == "1": softRestart() elif command == "2": stopOHS() elif command == "3": startOHS() elif command == "4": statusOHS() elif command == "5": menu() elif command == "6": break else: print("Invalid choice!") raw_input("Press Enter to continue...")
You must be logged in to post a comment.