Using The WebLogic Scripting Tool
Using The WebLogic Scripting Tool
Purpose
This tutorial shows you how to use the WebLogic Scripting Tool (WLST) to administer Oracle WebLogic Server
12c (12.2.1) from the command line.
Time to Complete
Approximately 15 Minutes.
Background
With WLST, you can monitor, control, and configure servers and other domain resources from the command line.
You can also save groups of commands in files so that you can reliably perform the same tasks many times.
This tutorial introduces you to WLST. It gives you a chance to practice basic commands and to change server
attributes from the command line.
WebLogic Server 12c (12.2.1): Installing WebLogic Server Using the Generic Installer
(https://apexapps.oracle.com/pls/apex
/f?p=44785:24:0:::24:P24_CONTENT_ID,P24_PREV_PAGE:12310,1)
WebLogic Server 12c (12.2.1): Creating and Starting a Basic Domain (https://apexapps.oracle.com
/pls/apex/f?p=44785:24:0:::24:P24_CONTENT_ID,P24_PREV_PAGE:12311,1)
. This tutorial assumes that Oracle WebLogic Server 12c (12.2.1) has been installed successfully.
1 of 8 12/12/2020 4:50 PM
WebLogic Server 12c (12.2.1): Using the WebLogic Scripting Tool https://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/wls/1...
The administration server does not have to be running to access WLST. However, in this tutorial, because
WLST connects to the administration server, it must be running.
1. If the administration server of the domain is not already running, open a Terminal window and navigate to the
domain directory for this tutorial:
$ cd /scratch/u01/app/fmw/user_projects/domains/mydomain
$ ./startWebLogic.sh
$ cd /scratch/u01/app/fmw/
$ cd oracle_common/common/bin
2 of 8 12/12/2020 4:50 PM
WebLogic Server 12c (12.2.1): Using the WebLogic Scripting Tool https://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/wls/1...
$ ./wlst.sh
wls:/offline>
If you are accessing WLST for the first time, Jython scans the Java Archive (JAR) files that the WLST
depends on before the welcome message and the WLST offline prompt are displayed.
To change a server property by using WLST in interactive mode, perform the following steps:
1. At the WLST prompt, enter the following command to connect to the running administration server:
wls:/offline>connect('<USERNAME>','<PASSWORD>','t3://<ADMIN_HOST>:<ADMIN_PORT>')
Replace the sample argument values with those that match your domain environment. In this tutorial, the
command is:
wls:/offline>connect('weblogic','welcome1','t3://localhost:7001')
wls:/mydomain/serverConfig/>
Note: WLST always uses the t3 (or t3s) proprietary protocol to connect to a server.
3 of 8 12/12/2020 4:50 PM
WebLogic Server 12c (12.2.1): Using the WebLogic Scripting Tool https://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/wls/1...
wls:/mydomain/serverConfig/>edit()
Location changed to edit tree.
This is a writable tree with DomainMBean as the root.
To make changes you will need to start an edit session via startEdit().
For more help, use help('edit').
wls:/mydomain/edit/>
wls:/mydomain/edit>startEdit()
Starting an edit session ...
Started edit session, be sure to save and activate your changes once you are done.
wls:/mydomain/edit/ !>
wls:/mydomain/edit!>cd('Servers/<SERVER_NAME>/Log/<SERVER_NAME>')
Replace the sample argument values with those that match your domain environment. In this tutorial, the
command is:
wls:/mydomain/edit!>cd('Servers/AdminServer/Log/AdminServer')
wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer !>
5. Set the FileCount property of the administration server log file to 8 , and then use the ls() command to
check whether the server property was changed.
wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer!>set('FileCount','8')
wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer !>
4 of 8 12/12/2020 4:50 PM
WebLogic Server 12c (12.2.1): Using the WebLogic Scripting Tool https://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/wls/1...
wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer!>ls()
dr-- DomainLogBroadcastFilter
dr-- LogFileFilter
dr-- MemoryBufferFilter
dr-- StdoutFilter
-rw- BufferSizeKB 8
-rw- DateFormatPattern MMM d, yyyy h:mm:ss a z
-rw- DomainLogBroadcastFilter null
-rw- DomainLogBroadcastSeverity Notice
-rw- DomainLogBroadcasterBufferSize 10
-r-- DynamicallyCreated false
-rw- FileCount 8
-rw- FileMinSize 5000
-rw- FileName logs/AdminServer.log
-rw- FileTimeSpan 24
-r-- Id 0
-rw- Log4jLoggingEnabled false
-rw- LogFileFilter null
-rw- LogFileRotationDir null
-rw- LogFileSeverity Trace
-rw- LogMonitoringEnabled true
-rw- LogMonitoringIntervalSecs 30
-rw- LogMonitoringThrottleMessageLength 50
-rw- LogMonitoringThrottleThreshold 1500
-rw- LoggerSeverity Info
-rw- LoggerSeverityProperties null
-rw- MemoryBufferFilter null
-rw- MemoryBufferSeverity Trace
-rw- MemoryBufferSize 500
-rw- Name AdminServer
-rw- Notes null
-rw- NumberOfFilesLimited true
-rw- PlatformLoggerLevels null
-rw- RedirectStderrToServerLogEnabled false
-rw- RedirectStdoutToServerLogEnabled false
-rw- RotateLogOnStartup false
-rw- RotationTime 00:00
-rw- RotationType bySize
-rw- ServerLoggingBridgeUseParentLoggersEnabled false
5 of 8 12/12/2020 4:50 PM
WebLogic Server 12c (12.2.1): Using the WebLogic Scripting Tool https://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/wls/1...
wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer !>
wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer!>save()
Saving all your changes ...
Saved all your changes successfully.
wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer !>
wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer!>activate()
Activating all your changes, this may take a while ...
The edit lock associated with this edit session is released once the activation is c
ompleted.
Activation completed
wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer>
6 of 8 12/12/2020 4:50 PM
WebLogic Server 12c (12.2.1): Using the WebLogic Scripting Tool https://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/wls/1...
To shut down the administration server of the domain by using WLST in interactive mode, perform the
following steps:
wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer>shutdown()
Shutting down the server AdminServer with force=false while connected to AdminServer
...
Disconnected from weblogic server: AdminServer
WLST lost connection to the WebLogic Server that you were connected to.
This may happen if the server was shut down or partitioned.
You will have to re-connect to the server once the server is available.
Disconnected from weblogic server: AdminServer
wls:/offline>
Note: By default, the WLST shutdown() command shuts down the server to which it is connected.
2. At the prompt, enter the following command to exit WLST:
wls:/offline> exit()
For documentation on Oracle WebLogic Server 12c (12.2.1), visit the Oracle WebLogic Server
Documentation Library. (http://docs.oracle.com/middleware/1221/wls/index.html)
For more information on the WebLogic Scripting Tool, see the WLST Command Reference for WebLogic
Server (http://docs.oracle.com/middleware/1221/wls/WLSTC/) document.
To learn more about Oracle WebLogic Server, refer to additional OBEs in the Oracle Learning Library
(http://www.oracle.com/goto/oll)
7 of 8 12/12/2020 4:50 PM
WebLogic Server 12c (12.2.1): Using the WebLogic Scripting Tool https://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/wls/1...
Credits
Version
01-32-001-UsingWLST
8 of 8 12/12/2020 4:50 PM