Skip navigation.
Downloads | Product Documentation | Support

WebLogic Server Command Reference

## QUERY

Searches for WebLogic Server MBeans whose `WebLogicObjectName` matches a pattern that you specify.

All MBeans that are created from a WebLogic Server MBean type are registered in the MBean Server under a name that conforms to the `weblogic.management.WebLogicObjectName` conventions. You must know an MBean's `WebLogicObjectName` if you want to use `weblogic.Admin` commands to retrieve or modify specific MBean instances. For more information, refer to "WebLogic Server Management Namespace" in the Programming WebLogic Management Services with JMX guide.

The output of the command is as follows:

>     {MBeanName object-name {property1 value} {property2 value}. . .}
>     . . .

Note that the properties and values are expressed as name-value pairs, each of which is returned within curly brackets. This format facilitates parsing of the output by a script.

If `-pretty` is specified, each property-value pair is displayed on a new line and curly brackets are not used to separate the pairs:

>     MBeanName: object-name
>     property1: value
>     property2: value
>     .
>     .
>     .
>     MBeanName: object-name
>     property1: value
>     abbribute2: value

### Syntax

>     java [ SSL Arguments ] weblogic.Admin
>          [ {-url URL} |
>            {-adminurl[protocol://]Admin-Server-listen-address:listen-port}
>          ]
>          [ User Credentials Arguments ]
>        QUERY -pretty -pattern object-name-pattern

Argument | Definition
--- | ---
{-url [`protocol``://`]`listen-address:listen-port``}` or `{-adminurl` [`protocol``://`]`Admin-Server-listen-address:listen-port``}` | To search for Administration MBean object names, use `-url` to specify the Administration Server's listen address and listen port. To search for the object names of Local Configuration or Runtime MBeans, use one of the following: `-url` to specify the listen address and listen port of the server instance on which you want to search. `-adminurl` to search on all server instances in the domain. For more information, refer to the -url and `-adminurl` entries in Table 1-3 on page 11 and Protocol Support.
`-pretty` | Places property-value pairs on separate lines.
`-pattern` | A partial `WebLogicObjectName` for which the `QUERY` command searches. The value must conform to the following pattern: `domain-name``:``property-list` For the `domain-name` portion of the pattern, you can use the * character, which matches any character sequence. Because the server instance that you specify with the -url or -adminurl argument can access only the MBeans that belong to its domain, the * character is sufficient. For example, if you use `-url` to specify a server in the MedRec domain, `QUERY` can only return MBeans that are in the MedRec domain. It cannot search for MBeans in a domain named mydomain. For the `property-list` portion of the pattern, specify one or more components (property-value pairs) of a `WebLogicObjectName`. For a list of all `WebLogicObjectName` property-value pairs, refer to "WebLogic Server Management Namespace" in the Programming WebLogic Management Services with JMX guide. (For example, all `WebLogicObjectName`s include `Name=``value` and `Type=``value` property-value pairs.) You can specify these property-value pairs in any order. Within a given naming property-value pair, there is no pattern matching. Only complete property-value pairs are used in pattern matching. However, you can use the * wildcard character in the place of one or more property-value pairs. For example, `Name=Med*` is not valid, but `Name=MedRecServer,*` is valid. If you provide at least one property-value pair in the `property-list`, you can locate the wildcard anywhere in the given pattern, provided that the `property-list` is still a comma-separated list.

### Example

The following example searches for all `JDBCConnectionPoolRuntime` MBeans that are on a server instance that listens at ManagedHost:8001:

>     java weblogic.Admin -url ManagedHost:8001 -username weblogic
>      -password weblogic QUERY
>      -pattern *:Type=JDBCConnectionPoolRuntime,*

If the command succeeds, it returns the following:

>     Ok

For more information about the environment in which this example runs, refer to Example Environment.

The following example searches for all instances of `MedRecPool` MBeans on all servers in the current domain. It uses `-adminurl`, which instructs the Administration Server to query the Administration `MBeanHome` interface (This interface has access to all MBeans in the domain):

>     java weblogic.Admin -adminurl AdminHost:7001 -username weblogic
>      -password weblogic QUERY -pattern *:Name=MedRecPool,*

If the command succeeds, it returns an instance of the `JDBCConnectionPool` Administration MBean that is named `MedRecPool`, along with all corresponding Local Configuration and Runtime MBeans.