You can use the scripting language saved in an INI file and used by the WSH tool to perform batch processing tasks on the mobile server that are performed frequently by the administrator.
The following sections describe the scripting language for the mobile server:
The following sections describe the parameters and syntax available in the scripting language:
Using the following syntax, you can create users.
[USER] NAME=<User Name> PASSWORD=<User Password> EXTERNALUSER=<True or False> ENCRYPTED=<True or False; True if the password is encrypted, False if not> FULLNAME=<User Full Name> PRIVILEGE=<User privilege level as A, O, U, or null>
By default, this value is false for a user with password that is authenticated by the mobile server. If you are creating an external user that will be authenticated by an external authenticator class, set to True. If true, you do not provide a password in the INI script file with PASSWORD as the user is authenticated by the external authenticator. See Chapter 7, "Customizing Oracle Database Mobile Server Security" in the Oracle Database Mobile Server Developer's Guide for information on the external authenticator.
Using the [GROUP]
script, you can create a new group (if this group does not already exist) and add listed users to the group. If you use this entry and specify the name of a group that exists, all the users in the existing group will be removed and users who are listed will be added to this group.
The following syntax enables you to create a group.
[GROUP] NAME=<Group Name> USER=<User name you want to add to this group> USER=<User name you want to add to this group> USER=<User name you want to add to this group>
Using the [ADDUSERTOGROUP]
script, you can create a new group (if this group does not already exist) and add listed users to this group. You can also use this entry to add users to an existing group.
[ADDUSERTOGROUP] NAME=<Group Name> USER=<User name you want to add to this group> USER=<User name you want to add to this group>
Using the [REMOVEUSERFROMGROUP]
script, you can remove listed users from a specified group.
NAME=<Group Name> USER=<User name you want to remove from this group> USER=<User name you want to remove from this group>
Using the [ACL]
script, you can create a new ACL (if this ACL does not already exist). After creating the ACL, all the existing users will be removed and all the listed users will be added to this ACL.
Using the [GRANTACCESS]
script, you can add users to the existing ACL.
The following syntax enables you to create access privileges for users and groups.
[ACL] APPLICATION=<Virtual path of the application you want to create ACL for> ROLE=<Role of the user; set the value as DEFAULT ROLE or ADMINISTRATIVE ROLE> USER=<User's name> ACCESS=<Set access status as ENABLED> ROLE=<Role of the user> USER=<User name> ACCESS=<Set access status as ENABLED> ROLE=<Role of the group> GROUP=<Groups name> ACCESS=<Set access status as ENABLED>
Using the [GRANTACCESS]
script, you can create a new ACL (if this ACL does not already exist) and add listed users to this ACL.
[GRANTACCESS] APPLICATION=<Virtual path of the application you want to add ACL for> ROLE=<Role of the user> USER=<User name> ACCESS=<Access Status ENABLED/DISABLED> ROLE=<Role of the group> GROUP=<Group name>
Using the [REVOKEACCESS]
script, you can remove users that are listed in the specified ACL.
[REVOKEACCESS] APPLICATION=<Virtual path of the application you want to revoke ACL for> ROLE=<Role of the user> USER=<User name> ACCESS=<Access Status> ROLE=<Role of the group> GROUP=<Groups name>
Using the [REGISTRY]
script, you can create registries.
[REGISTRY] APPLICATION=<Virtual path of the application> NAME=<Registry Variable Name> VALUE=<Value for this variable>
Using the [SNAPSHOTVAR]
script, you can create snapshot variables.
[SNAPSHOTVAR] NAME=<Name of the publication item> PLATFORM=<Platform for which this publication item is> VIRTUALPATH=<Virtual path of the application this publication item belongs to> USER=<Name of the user who subscribes to this application> VAR=<Name of the Data Subsetting parameter, value of this parameter> USER=<Name of the user who subscribes to this application> VAR=<Name of the Data Subsetting parameter, value of this parameter> GROUP=<Name of the group which subscribes to this application> VAR=<Name of the Data Subsetting parameter, value of this parameter>
Using the [DROPUSER]
script, you can delete a user.
[DROPUSER] NAME=<User Name>
Using the [DROPGROUP]
script, you can delete a group.
[DROPGROUP] NAME=<Group Name>
Using the [DROPACL]
script, you can delete access privileges provided to users.
[DROPACL] APPLICATION=<Virtual path of the application you want to delete ACL for> ROLE=<Role of the user; set the value as DEFAULT ROLE or ADMINISTRATIVE ROLE> USER=<User name> ACCESS=<Set access status as DISABLED> ROLE=<Role of the group; set the value as DEFAULT ROLE or ADMINISTRATIVE ROLE> GROUP=<Groups name> ACCESS=<Set access status as DISABLED>
Using the [DROPREGISTRY]
script, you can delete a registry.
[DROPREGISTRY] APPLICATION=<Name of the application> NAME=<Registry Variable Name> VALUE=<Value for this variable>
Using the following [DROPSNAPSHOTVAR]
script, you can delete snapshot variables.
[DROPSNAPSHOTVAR] NAME=<Name of the publication item> PLATFORM=<Platform for which this publication item is> VIRTUALPATH=<Virtual path of the application this publication item belongs to> USER=<Name of the user who subscribes to this application> VAR=<Name of the Data Subsetting parameter, value of this parameter> USER=<Name of the user who subscribes to this application> VAR=<Name of the Data Subsetting parameter, value of this parameter> GROUP=<Name of the group which subscribes to this application> VAR=<Name of the Data Subsetting parameter, value of this parameter>
The WSH
tool is a command-line tool that you can use to execute batch commands on the mobile server. Use the -c
option to execute the commands you developed in the script INI file on the mobile server. The syntax for this option is as follows:
wsh –c <path_and_filename.ini> <username>/<password>[@<jdbc_url>]
Where:
<path_and_filename.ini>
: The INI file contains the batch commands for the mobile server. Provide the name and absolute path for the desired INI file.
<username>/<password>
: The mobile server repository administrator user name and password.
<jdbc_url>
: If the optional JDBC URL for the Oracle database that contains the mobile server repository is specified in the command line, then WSH
will use this URL, else it defaults to use the URL configured in the mobile.ora
file. You can specify the JDBC URL of a single Oracle database or an Oracle RAC database.
The JDBC URL for a single Oracle database has the structure of jdbc:oracle:thin:@<host>:<port>:<SID>
.
The JDBC URL for an Oracle RAC database can have more than one address in it for multiple Oracle databases in the cluster and follows this URL structure:
jdbc:oracle:thin:@(DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=PRIMARY_NODE_HOSTNAME)(PORT=1521)) (ADDRESS=(PROTOCOL=TCP)(HOST=SECONDARY_NODE_HOSTNAME)(PORT=1521)) ) (CONNECT_DATA=(SERVICE_NAME=DATABASE_SERVICENAME)))
For example, if you have an INI file called mybatch.ini
, you can execute the WSH
tool on this file. For this example, the mobile server repository user name and password is mobileadmin/manager
and the JDBC URL (<host>:<port>:<SID>
) is myhost:1521:mySID
:
wsh -c mybatch.ini mobileadmin/manager@jdbc:oracle:thin:@myhost:1521:mySID
The following sections enable you to accomplish the following tasks and describes examples from a script file in INI format:
The following examples illustrate how to create users, groups, registries, access privileges, snapshotvar template variables, add users to a group, and add users to an ACL.
[DATABASE] TYPE=ORACLE #Creation or modification of users, groups, access privileges, registry, and snapshot variable entries using the following entries in the INI file: #[USER], [GROUP], [ACL], [REGISTRY],[SNAPSHOTVAR]. # Create user JOHN # [USER] NAME=JOHN PASSWORD=john ENCRYPTED=false FULLNAME=Sample1 User John PRIVILEGE=U # # Create group 'Sample Users' containing JANE, JOHN, JACK # [GROUP] NAME=Sample Users USER=JANE USER=JOHN USER=JACK # # Set the ACL on the Sample3 application. # The following gives John, Jane, and Jack, plus all the users in the group # Sample Users access to the application # [ACL] APPLICATION=/sample3 ROLE=Default Role USER=JOHN ACCESS=ENABLED ROLE=Default Role USER=JANE ACCESS=ENABLED ROLE=Default Role USER=JACK ACCESS=ENABLED ROLE=Default Role GROUP=Sample Users ACCESS=ENABLED # # Add registry entry for user JOHN and a default value for the Sample3 application to the Repository # [REGISTRY] APPLICATION=/sample3 USER=JOHN NAME=USERCODE VALUE=1111 # # Add template variables. # You can specify user/group specific values for these variables # [SNAPSHOTVAR] NAME=RECORDINGS PLATFORM=WIN32 VIRTUALPATH=/sample3 USER=JOHN VAR=CODE, 1111 USER=JACK VAR=CODE, 1111 USER=JANE VAR=CODE, 2222 GROUP=Sample Users VAR=CODE, 2222 # #Add users to a group. # [ADDUSERTOGROUP] NAME=Sample Users USER=USER1 USER=USER2 # #Grant Access to users. # [GRANTACCESS] APPLICATION=/sample3 ROLE=Default Role USER=USER1 ACCESS=ENABLED ROLE=Default Role USER=USER2 ACCESS=ENABLED ROLE=Default Role GROUP=Sample Users
The following examples illustrate how to delete a user, group, registry and snapshotvar, remove users from a group, and revoke access.
#Deletion of users, groups, access privileges, registry and snapshot #variable entries using the following entries in the INI file: #[DROPUSER], [DROPGROUP], [DROPACL], [DROPREGISTRY],[DROPSNAPSHOTVAR]. # # Dropuser JOHN # [DROPUSER] NAME=JOHN # # Drop group 'Sample Users' # [DROPGROUP] NAME=Sample Users # # Drop the ACL on the sample3 application. # [DROPACL] APPLICATION=/sample3 ROLE=Default Role USER=JOHN ACCESS=DISABLED ROLE=Default Role GROUP=Sample Users ACCESS=DISABLED # # Drop registry entriy for user JOHN from Sample3 application. # [DROPREGISTRY] APPLICATION=/sample3 USER=JOHN NAME=USERCODE # # Drop template variables for user JOHN and group 'Sample Users' # [DROPSNAPSHOTVAR] NAME=RECORDINGS PLATFORM=WIN32 USER=JOHN VAR=CODE, 1111 GROUP=Sample Users VAR=CODE, 2222 # #Remove users from a group. # [REMOVEUSERFROMGROUP] NAME=Sample Users USER=USER1 USER=USER2 # #Revoke access. # [REVOKEACCESS] APPLICATION=/sample3 ROLE=Default Role USER=USER1 ACCESS=DISABLED ROLE=Default Role USER=USER2 ACCESS=DISABLED ROLE=Default Role GROUP=Sample Users