Oracle WebLogic Server 12c: Using the WebLogic Scripting Tool

Overview

    Purpose

    This tutorial shows you how to use the WebLogic Scripting Tool (WLST) to administer Oracle WebLogic Server 12c (12.1.3) from the command line.

    Time to Complete

    Approximately 15 minutes

    Introduction

    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.

    Hardware and Software Requirements

    • Oracle Linux 5.6+
    • Oracle WebLogic Server 12c (12.1.3)

    Prerequisites

    Before starting this tutorial, you should have completed the Oracle by Example tutorial titled Oracle WebLogic Server 12c: Installing WebLogic Server and Creating a Domain.

Running WLST in Interactive Mode

    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.

    To run WLST in interactive mode, perform the following steps:

    If the administration server of the domain is not already running, open a Terminal window and navigate to the domain directory for this tutorial: /scratch/domains/mydomain

    At the prompt, enter the following command: $> ./startWebLogic.sh

    At the prompt, enter the domain administrator's credentials. In this tutorial, the username is weblogic and the password is Welcome1. (The password is not displayed.)

    In a new Terminal window, navigate to <MIDDLEWARE_HOME> for this tutorial: /scratch/u01/app/fmw

    Change the directory: cd oracle_common/common/bin

    Run the wlst.sh script: $>./wlst.sh

    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.

Changing a Server Property

    To change a server property by using WLST in interactive mode, perform the following steps:

    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://<ip_address>:7001')

    In the previous command, <ip_address> is the actual IP address of the tutorial's administration server.

    Note: WLST always uses the t3 (or t3s) proprietary protocol to connect to a server.

    Change to edit mode: wls:/mydomain/serverConfig> edit()

    Start an edit session to lock the configuration: wls:/mydomain/edit> startEdit()

    Change to the Log directory of your administration server:

    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')

    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 !> ls()

    Save and activate the changes:

    wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer !> save()
    wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer !> activate()

Shutting Down the Administration Server

    To shut down the administration server of the domain by using WLST in interactive mode, perform the following steps:

    At the WLST prompt, enter the following command:

    wls:/mydomain/edit/Servers/AdminServer/Log/AdminServer> shutdown()

    Note: By default, the WLST shutdown() command shuts down the server to which it is connected.

    At the prompt, enter the following command to exit WLST:

    wls:/offline> exit()

Summary

    In this tutorial, you learned how to:

    • Start WLST in interactive mode
    • Change a server property
    • Shut down the administration server
    • Exit WLST

    Resources

    Credits

    • Lead Curriculum Developer: Bill Bell
    • Original Oracle by Example tutorial for version 11g created by: TJ Palazzolo
    • Other Contributors: Susan Moxley

To navigate this Oracle by Example tutorial, note the following:

Hide Header Buttons:
Click the title to hide the buttons in the header. To show the buttons again, click the title again.
Topic List:
Click a topic to navigate to that section.
Expand All Topics:
Click the button to show or hide the details for the sections. By default, all topics are collapsed.
Hide All Images:
Click the button to show or hide the screenshots. By default, all images are displayed.
Print:
Click the button to print the content. The content that is currently displayed or hidden is printed.

To navigate to a particular section in this tutorial, select the topic from the list.