Batch processing of common tasks with DSM script utilities

IBM® Data Server Manager (DSM) version 2.1.3 provides administrators with command line utilities for the batch processing of common tasks. These utilities are provided in both shell script (*.sh) format for UNIX/Linux environments and batch (*.bat) format for Windows environments.

Users can access these scripts by navigating to the \dsutil\bin sub-folder of their DSM installation folder.


Encrypting credentials for database connection profiles prior to importing

Run the crypt utility to encrypt a text string, such as database connection profile passwords.

To run the crypt.sh/crypt.bat script:

  • From the command line, enter crypt. (.sh or .bat) <the string you want to encrypt> or...
  • simply enter crypt. (.sh or .bat)with no arguments to be prompted for a string to enter.

Updating stored database connection credentials

Run the upddbcredential utility to update stored user IDs and/or passwords for specified database connection profiles or all connection profiles.

Note: To run this script, the database server you are modifying must be online.
  • Ensure that profile names that contain spaces are contained withing quotation marks (e.g., updatecredential.sh -dbProfile <my_profile_name>
  • Separate multiple argument values (e.g., profile names) with a comma (,)
  • Omit the -password argument to force the utility to prompt for the user to enter a new password.

To set or change the password for a connection profile:

From the command line, enter upddbcredential.<extension> -dbProfile <the name of your connection profile> -password <your new password (no spaces)>

To force a prompt for a new password when updating:

From the command line, enter upddbcredential.<extension> -dbProfile <the name of your connection profile>

To set or change both a user ID and a password for a connection profile:

From the command line, enter upddbcredential.<extension> -dbProfile <the name of your connection profile> -user <your new user ID> -password <your new password (no spaced)>

To set or change the user ID and password for two database profiles:

From the command line, enter upddbcredential.<extension> -dbProfile <profile_name_1>, <profile_name _2> -user <your new user ID>

You will be prompted to enter a new password for the two connection profiles.

To apply the same user ID and password to all database profiles:

From the command line, enter upddbcredential.<extension> -alldbProfiles -user <your new user ID>

You will be prompted to enter a new password for all connection profiles.

To update the user ID and password of a repository database, using the newest password code:

From the command line, enter upddbcredential.<extension> -repositoryDB -user <your new repository database user ID> -password<your new repository database password>

To set or change the password for all connection profiles associated with one or more tags:

From the command line, enter upddbcredential.<extention> -tag <tagName1,tagName2> -user <newUserID>

When prompted, enter your password.


Updating specific attributes of stored database connection profiles

Run the upddbprofile utility with various arguments to list, add, change, or delete connection profiles or their properties.

Note: Enclose values with spaces in quotation marks.

To set or change only the host or IP address of a connection profile:

From the command line, enter upddbprofile.<extension> -dbProfile <the name of your connection profile> -host <the host URL (e.g., soyuz.example.com)>

To set or change the host, port, and JDBC URL properties of a connection profile:

From the command line, enter upddbprofile.<extension> -dbProfile <the name of your connection profile> -host <the host URL (e.g., soyuz.example.com)> -port <port number (e.g., 50000) > -xtraProps traceDirectory=/tmp/traces;traceFile=jcc;traceFileAppend=false;traceLevel=-1; .

To create a new database profile:

From the command line, enter upddbprofile.<extension> -host localhost -port <port number (e.g., 50000) > -user <your_new_user_ID> -password <your new password (no spaced)> -databaseName <the name of the monitored database> -dbProfile <the_name_of_your_connection_profile> -dataServerType <e.g., DB2LUW>

To list all existing database profiles:

From the command line, enter upddbprofile.<extension> -list

To delete an existing database profile:

From the command line, enter upddbprofile.<extension> -delete -dbProfile <your_profile_name>

To delete all existing database profiles:

From the command line, enter upddbprofile.<extension> -delete -alldbProfiles

To migrate an HADR primary profile TEST to an HADR cluster:

From the command line, enter upddbprofile.<extension> -migrate -dbProfile TEST

To migrate all profiles to an HADR or PureScale cluster:

From the command line, enter upddbprofile.<extension> -migrate -alldbProfile

To set a database to blackout:

From the command line, enter upddbprofile.<extension> -dbProfile $ <the name of your connection profile> -BlockAccess 1  

To release a database from blackout:

From the command line, enter upddbprofile.<extension> -dbProfile $ <the name of your connection profile> -BlockAccess 0

To list all existing tags:

From the command line, enter upddbprofile.<extension> -list - tag

To list connection profiles associated with tags:

From the command line enter upddbprofile.<extension> -list - tag <tag name1, tag name 2, ...>


Adding and managing users

Run the usermgt utility with various arguments to add new users or to update the password of existing users.

Note: To run this script, the database server you are modifying must be online.

To add one or more new users:

From the command line, enter usermgt.<extension> -addUser <newuser1, newuser2, ...>

To add one or more new users without (an) assigned password(s):

From the command line, enter usermgt.<extension> -addUser <newuser1, newuser2, ...> -noPassword

To update the password of an existing user:

From the command line, enter usermgt.<extension> -updatePassword <existing_user>

In both cases, you will be prompted to enter a password.


Managing the privileges of the dsm user

Run the privilegemgmt utility to list, grant, or revoke the privilege for the DSM user.

Note: To run this script, the database server you are modifying must be online.

To list the privilege:

From the command line, enter privilegemgmt.<extension> -list -user <dsm username(s), separated by comm(a)> -dbProfile <connection profile name(s), separated by comm(a)> | -alldbProfiles

To grant/revoke console privilege to/from the dsm user:

From the command line, enter privilegemgmt.<extension> [-grant | -revoke] -user <dsm username(s), separated by comma(s)> -privilege <DSWEBSECURITY.CANVIEW | DSWEBSECURITY.CANADMINISTER>

where...

DSWEBSECURITY.CANVIEW represents normal user access

DSWEBSECURITY.CANADMINISTER represents a DSM administrator that can grant access to DSM to other users

Note: A user must be assigned either the Administrator or User privilege to log into DSM.

To grant/revoke connection profile owner/user privilege to dsm user:

From the command line, enter privilegemgmt.<extension> [-grant | -revoke] -user <dsm username(s), separated by comma(s)> -dbProfile <connection profile name(s), separated by comma(s)> | -alldbProfiles -privilege <DSWEB.IS_DB_OWNER | DSWEB.IS_DB_USER>

where...

DSWEB.IS_DB_OWNER represents the owner of the connection profile

DSWEB.IS_DB>USER represents a user of the connection profile

To list all privilege assignments:

From the commend line, enter privilegemgmt.<extension> -list -user <dsm username(s), separated by comm(a)> -dbProfile <connection profile name(s), separated by comm(a)> | -alldbProfiles | -tag <tagname(s), separated by comm(a)>

To grant/revoke connection profile owner/user privileges to/from a dsm user:

From the command line, enter privilegemgmt.<extension> [-grant | -revoke] -user <dsm username(s), separated by comma(s)> -dbProfile <connection profile name(s), separated by comma(s)> | -alldbProfiles | -tag <tagname(s), separated by comm(a)> -privilege <DSWEB.IS_DB_OWNER | DSWEB.IS_DB_USER>

To export the Connection Profile privilege:

From the command line, enter privilegemgmt.<extension> -export <filename.csv, filepath\filename.csv> -user <dsm username(s), separated by comm(a)> -dbProfile <connection profile name(s), separated by comm(a)> | -alldbProfiles

To export the User privilege:

From the command line, enter privilegemgmt.<extension> -export <filename.csv, filepath\filename.csv> -user <dsm username(s), separated by comm(a)>