Connect the pdbctl utility to database
Once the utility is configured, it can be used to connect to a database in a system where CDP is installed. The adddb
command tries to connect the utility to both Key Manager and the database. If the connection is successful, then the database alias and other information are saved.
Steps
Navigate to the pdbctl utility directory.
Set the pdbctl environment variable by using the following command, if not already done:
export PDB_MUTIL_PATH=<location of pdbctl>
For example,
export PDB_MUTIL_PATH=/home/pdb/utility/pdbctl
Run the
adddb
command to initialize the database connection and provide the required parameters. The following command provides an example to add an Oracle database with alias name demoalias:./pdbctl adddb -a demoalias -u <database_user> -d <database_name> -p <database_password> -t Oracle -i <host_ip> -m <meta_user_password> -o <port> -b <naeuser> -c <naepassword>
To view the parameters (flags) required to pass with the adddb command, run the following command.
./pdbctl adddb –h
Flag Description
The following table describes the flags associated with this command:
Flag | Data Type | Description |
---|---|---|
-a | string | Name of the connection. |
-r | string | Connection protocol. Possible values are: —TCP —SSL (applicable only for DB2 and Oracle database.) |
-u | string | Database user name with permission to modify the tables to be migrated. User can be the owner of the database table or has permission to CREATE, MODIFY, and DROP views, tables, and triggers. |
-d | string | Database name that contains the tables to be migrated. Note: For Oracle database, if you want to use the service name, use I:<service_name> along with -d in the command. For example -d I:<service_name> . Service should be used when using pluggable database. |
-p | string | Database user password. |
-t | string | Supported Database. Following are the supported databases: —Oracle —SQLServer —DB2 |
-h | Flag to view help for the adddb command. | |
-i | string | Hostname or IP address of the database server. |
-n | string | Name of the database where CDP metadata is installed. Applicable only for SQL Server database. |
-m | string | Database password of the user with permission to connect to CDP metadata. |
-l | string | Database user name with permission to connect to CDP metadata. |
-c | string | NAE password of the user to connect to Key Manager. |
-b | string | NAE User name to connect to Key Manager. If NAE user belongs to any domain on CipherTrust Manager, use the following format: domain||username |
-o | string | Port number to connect the pdbctl utility to the database. Use I: instance_name parameter if the database is to be connected using instance name. Instance name is applicable only for SQL Server database. |
-s | string | Secondary authentication ID. This optional parameter is applicable only for DB2 database. |
-e | string | Database schema/owner name. This is an optional parameter. — For SQL Server, the default value is dbo. — For Oracle, the default value is database username. |
-- verbose | Print verbose logs. |
Note
In SQL Server, if a domain user executes the adddb command, then the users specified in -u
and -l
(flag) must be part of the same domain.
Example
The following sample code connects the utility to Oracle database and Key Manager:
./pdbctl adddb -a demo -u ingrian -d orcl -p asdf1234 -t Oracle -i 10.164.x.x -m asdfxxxx -o 1521 -b dbusr -c asdfxxxx