Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP SQL Anywhere, on-demand edition 1.0 SP 6

Search queries

The cloud supports two types of search queries: search by names or object ID using a top-level-search query and search using the full search syntax.

  • Search by names or object ID using a top-level-search query

    The easiest way to find a cloud object is to specify its name or title. When searching for names, you can use wildcards (asterisks) in any position. When specifying more than one object, use a semicolon (;) as the delimiter.

    For example, the following search queries can be used to search for the cloud server myserver#3 with the object ID SV-f9z5:

    • myserver#3
    • myserv*
    • SV-f9z5

    You can use multiple asterisks in a search query. For example, the following search query finds cloud objects whose names contain ABC: name:*ABC*.

  • Search using the full search syntax

    Syntax search queries allow you to use expressions such as comparison operators, function values, filters, and literals.

    A filter has the following form: filter-name:filter-value. Whitespace characters are not permitted before or after the colon. An example of a filter name is status. For example, you can define a search query for cloud objects whose current status is stopped using: status:stopped.

    Link names allow you to search for relationships between cloud objects, such as between cloud servers and hosts. The following search query finds cloud servers that run on the host named myhost. type:server and host:(name:myhost).

Search queries are used to:

  • Specify cloud objects for task parameters.

    When running a task, you can specify a search query for any task parameter that requires a cloud object. For example, the following command uses the search query ( 'status:running' ) to stop all databases that are running in the cloud:

    CALL DBCloud.StopDatabase ( 'status:running' ) 
  • Implement rules for controlling the placement of cloud servers and databases.

  • Query metadata for cloud objects that meet some criteria.

Example

  • The StartDatabase task has one required parameter, database_list. The following command starts the database named MyDemo:

    dbcloudcmd run StartDatabase MyDemo
  • The following command starts a tenant database with the ID DB-c9w5:

    dbcloudcmd run StartDatabase DB-c9w5
  • The following command starts any database whose name begins with MY and ends with mo:

    dbcloudcmd run StartDatabase "My*mo"
  • The following command starts databases MyDemo and CompanyA:

    dbcloudcmd run StartDatabase "MyDemo;CompanyA"
  • The following command uses the name filter to stop all databases except the MyDemo database.

    dbcloudcmd run StopDatabase "not name:MyDemo"
  • The following command uses the status filter to start all stopped databases:

    CALL DBCloud.StartDatabase ( 'status:stopped' ) 
  • The following commands apply the MyCompany tag to the MyDemo database:

    dbcloudcmd run ApplyTag MyCompany "type:database and name:MyDemo"
  • The following command applies the MyCompany tag to all hosts and cloud servers that are running the MyDemo database:

    dbcloudcmd run ApplyTag MyCompany "( type:Server or type:Host ) and database:MyDemo"