Using the command-line interface for databases

You can use the CLI to manage your database patterns, database instances, database images, database workloads, pattern types, and system plug-ins.

Database pattern type CLI command specifications

Retrieve detail information of database pattern type

deployer.patterntypes.get(<dbaas_patterntype>, <version>)
Note: The value of {dbaas_patterntype} could be dbaas, dbaas.std.oltp or dbaas.std.datamart
Table 1. Retrieve detail information of database pattern type details
Example
deployer.patterntypes.get("dbaas.std.oltp","1.1")
 
Sample output
{
  "description": "IBM Transactional Database Pattern",
  "name": "IBM Transactional Database Pattern",
  "required": (nested object),
  "shortname": "dbaas.std.oltp",
  "status": "avail",
  "version": "1.1"
}
 

Accept license agreement of database pattern type

deployer.patterntypes.get((<dbaas_patterntype>,<version_vrmf>).acceptLicense()
Note: The value of {dbaas_patterntype} could be dbaas.std.oltp or dbaas.std.datamart
Table 2. Accept license agreement of database pattern type details
Example
deployer.patterntypes.get('dbaas.std.oltp', '1.1.0.0').acceptLicense()
 
Sample output
{'status':'accepted'}
 

Enable database pattern type

deployer.patterntypes.get(<dbaas_patterntype>,<dbaas_version>).enable()
Note: The value of {dbaas_patterntype} could be dbaas, dbaas.std.oltp or dbaas.std.datamart
Table 3. Enable database pattern type details
Example
deployer.patterntypes.get('dbaas', '1.1.0.0').enable()
 
Sample output
{'status':'avail'}
 

Disable database pattern type

deployer.patterntypes.get(<dbaas_patterntype>,<dbaas_version>).disable()
Note: The value of {dbaas_patterntype} could be dbaas, dbaas.std.oltp or dbaas.std.datamart
Table 4. Disable database pattern type details
Example
deployer.patterntypes.get('dbaas', '1.1.0.0').disable()
 
Sample output
{ 'status': 'deprecated'}
 

Database Plug-in Configuration CLI command specifications

Retrieve plug-in configuration information

deployer.plugins.getConfig(<plugin_name>) or deployer.plugins.get(<plugin_name>).getConfig()
Table 5. Retrieve plug-in configuration information details
Example
deployer.plugins.getConfig('oltp/1.1.0.0') 
 
Sample output
{
    'metadata': [
        {
            'label': 'Environment',
            'displayId': 'Environment',
            'type': 'string',
            'id': 'parms.environment',
        'options':[
							{
						'value': None, 
						'name': 'None(disabled)'
							} 
							{
						'value': 'PROD', 
						'name': 'Only IBM Transactional Database Pattern'
							} 
							{
							'value': 'NONPROD', 
							'name': 'Only IBM Transactional Database Pattern for Non-Production Environment'
							}
							{
							'value': 'BOTH', 
							'name': 'Both'
                        }
                    ]
                }
            ],
    'config': {
        'version': '1.1.0.0',
        'patterntypes': {
            'secondary': [
                {
                    'dbaas': '1.1'
                }
            ],
            'primary': {
                'dbaas.std.oltp': '1.1'
            }
        },
        'parms': {
            'environment': 'PROD'
            'dbaas_standard': True
        },
        'packages': {
            'oltp.prod': [
                {
                    'node-parts': [
                        {
                            'node-part': 'nodeparts/license.tgz',
                            'parms': {
                                'tagfile': 'Transactional_Database_Pattern.1.1.0.swtag'
                            }
                        }
                    ]
                }
            ],
            'oltp.nonprod': [
                {
                    'node-parts': [
                        {
                            'node-part': 'nodeparts/license.tgz',
                            'parms': {
                                'tagfile': 'Transactional_Database_Pattern_for_Non_Production_Environment.1.1.0.swtag'
                            }
                        }
                    ]
                }
            ]
        },
        'name': 'oltp'
    }
}
 

Database Pattern CLI command specifications

List all database patterns

deployer.applications.list({"app_type":"database"})
Table 6. List all database patterns details
Example
deployer.applications._list({"app_type":"database"})
 
Sample output
{
  "access_rights": (nested object),
  "acl": (nested object),
  "app_id": "a-5f733bb6-4be8-4c74-852f-055f09274192",
  "app_name": "pattern1",
  "app_type": "database",
  "artifacts": (nested object),
  "content_md5": "D086CC2D8E54E7E86E159085392DD6D8",
  "content_type": "application/json",
  "create_time": "2011-09-08T03:27:46Z",
  "creator": "cbadmin",
  "last_modified": "2011-09-08T03:27:48Z",
  "last_modifier": "cbadmin"
}
 

Create a database pattern

deployer.applications.create(<LOCAL_FILE_PATH>)
Table 7. Create a database pattern details
a) Applying a default database workload standard: Example
deployer.applications.create("D:\\deployer.cli\\bin\\appmodel-default.json")
 
Input file: appmodel-default.json
{"model":{"app_type":"database","patterntype":"dbaas","version":"1.1","name":"dbp_default","description":"","nodes":[{"attributes":{"purpose":"production","source":"defaultWorkloadStandardApproach","dbDiskSize":30,"workloadStandard":"departmental_OLTP","sqlType":"DB2","dbTerritory":"US","dbCodeset":"UTF-8","dbCollate":"SYSTEM","versionName":"V97Linux","fixpackName":"db2_hybrid_en-9.7.0.5-linuxx64-20120112.tgz"},"type":"DB2","id":"database"}]}}
 
b) Applying a customized database workload standard: Example
deployer.applications.create("D:\\deployer.cli\\bin\\appmodel-customized.json")
 
Input file: appmodel-customized.json
{"model":{"app_type":"database","patterntype":"dbaas","version":"1.1","name":"dbp_cust","description":"","nodes":[{"attributes":{"purpose":"production","source":"workloadStandardApproach","cusDbDiskSize":30,"cusWorkloadStandard":"8e64a636-7920-4e11-a471-55ffb3e7b75c","cusVersionName":"V97Linux","cusFixpackName":"db2_hybrid_en-9.7.0.5-linuxx64-20120112.tgz"},"type":"DB2","id":"database"}]}}
 
c) Cloning from a database image: Example
deployer.applications.create("D:\\deployer.cli\\bin\\appmodel-clone.j
son")
 
Input file: appmodel-clone.json
{"model":{"app_type":"database","patterntype":"dbaas","version":"1.1","name":"clone_dbp","description":"","nodes":[{"attributes":{"purpose":"production","source":"cloneApproach","databaseImage":"auto_172.16.68.124_mydb6_20120511230014.json"},"type":"DB2","id":"database"}]}}
 
Sample output
{
  "access_rights": (nested object),
  "acl": (nested object),
  "app_id": "a-aa0581a8-c0e1-47ce-8909-686f1b588edf",
  "app_name": "dbp_default",
  "app_type": "database",
  "artifacts": (nested object),
  "content_md5": "3EB002BE6EB3CE941FDE95668B283E35",
  "content_type": "application/json",
  "create_time": "2012-05-14T02:30:34Z",
  "creator": "cbadmin",
  "last_modified": "2012-05-14T02:30:34Z",
  "last_modifier": "cbadmin",
  "patterntype": "dbaas",
  "version": "1.1"
}
 

Update a database pattern specified by Database Pattern ID

deployer.applications.get(<dbpatternID>).update("<local file path>")
Table 8. Update a database pattern details
Example
deployer.applications.get("a-5f733bb6-4be8-4c74-852f-055f09274192").update("/home/updateDBPattern.json")
 
Input file: createDBPattern.json
{"model":
{"app_type":"database",
"patterntype":"dbaas",
"version":"1.1",
"name":"db_pattern1",
"description":"
","nodes":
[{"attributes":
{"purpose":"production",
"source":"defaultWorkloadStandardApproach",
"dbDiskSize":30,
"workloadStandard":"departmental_OLTP"
"sqlType":"DB2"
"dbTerritory":"US"
"dbCodeset":"UTF-8"
"dbCollate":"SYSTEM"
"versionName":"V97Linux"
"fixpackName":"db2_hybrid_en-9.7.0.5-linuxx64-20120112.tgz"}
"type":"DB2"
"id":"database"}]}}
 
Sample output No output. View the details of the updated pattern type to verify that the command executed successfully.  

Upload a script file for database pattern specified by Database Pattern ID

deployer.applications.get(<dbpatternID>).artifacts.upload(<local_file_path>)
Table 9. Upload a script file for database pattern specified by Database Pattern ID details
Example
deployer.applications.get("a-5f733bb6-4be8-4c74-852f-055f09274192").artifacts.upload("/home/lyy/my/testdb.sql")
 
Sample output
{'file': 'artifacts/testdb.sql', 'file_name': 'testdb.sql', 'fileName': 'testdb.sql'}
 

Update database pattern access rights for specified user name or group name

deployer.applications.get(<dbpatternID>).sharegroup(<group_name>,<accessRights>)
deployer.applications.get(<dbpatternID>).shareuser(<user_name>,<accessRights>)
Table 10. Update database pattern access rights for specified user name or group name details
Example, group
deployer.applications.get("a-cdaac959-672c-4df7-a648-b333a3843422").sharegroup("Everyone","F")
 
Example, user
deployer.applications.get("a-cdaac959-672c-4df7-a648-b333a3843422").shareuser("liuyy","F")
 
Sample output No output. View the details of the updated pattern type to verify that the command executed successfully.  

Delete a database pattern specified by Database Pattern ID

deployer.applications.delete(<dbpatternID>)
Table 11. Delete a database pattern specified by Database Pattern ID details
Example
deployer.applications.delete("a-5f733bb6-4be8-4c74-852f-055f09274192") 
 
Sample output No output. View the list of all pattern types to verify if the pattern type has been removed.  

Database Instance CLI command specifications

Note: You must create a database pattern before deploying a database when using CLI commands.

List all databases

deployer.databases.getlist()
Table 12. List all databases details
Example
deployer.databases.getlist()
 
Sample output
[
    {
        'status': 'TERMINATED',
        'creator_name': 'cbadmin',
        'dbname': 'mydb',
        'start_time': '2011-10-18T06: 55: 46.661Z',
        'id': 'd-fc0c1425-8daf-41ba-ac6e-7413d7f4bc87',
        'creator': 'cbadmin'
    },
    ...
]
 

Provision a database specified by Database Pattern ID

deployer.applications.get("<dbpatternID>").deploy("<deployment_name>", <cloud_group (optional)>, <certFile>(optional), <params>)
Table 13. Provision a database specified by Database Pattern ID details
Example
deployer.applications.get("a-aa0581a8-c0e1-47ce-8909-686f1b588edf ").deploy("defdb",deployer.clouds[0],None,{"database.dbname":"defdb"})
 
Sample output
{
  "acl": (nested object),
  "app_id": "a-aa0581a8-c0e1-47ce-8909-686f1b588edf",
  "app_type": "database",
  "appmodel": "https://172.16.65.62:9444/storehouse/user/deployments/d-d497f877-
4526-4578-8e4d-2662fd1125f2/appmodel.json",
  "deployment": "https://172.16.65.62:9444/storehouse/user/deployments/d-d497f87
7-4526-4578-8e4d-2662fd1125f2/deployment.json",
  "deployment_name": "defdb",
  "id": "d-d497f877-4526-4578-8e4d-2662fd1125f2",
  "maintenance_mode": False,
  "operations": (nested object),
  "role_error": False,
  "start_time": "2012-05-14T02:36:39.017Z",
  "status": "LAUNCHING",
  "topology": "https://172.16.65.62:9444/storehouse/user/deployments/d-d497f877-
4526-4578-8e4d-2662fd1125f2/topology.json"
}
 

Retrieve database information specified by Database ID

deployer.databases.get(<database_ID>)
Table 14. Retrieve database details specified by Database ID details
Example
deployer.databases.get("d-201fd95b-31c4-403a-8169-7c976da57a2f")
 
Sample output
{
    'status': 'TERMINATED',
    'description': '',
    'dbname': 'mydb',
    'id': 'd-fc0c1425-8daf-41ba-ac6e-7413d7f4bc87',
    'creator': 'cbadmin',
    'sqlType': 'DB2'
}
 

Destroy a database specified by Database ID

deployer.virtualapplications.terminate("d-201fd95b-31c4-403a-8169-7c976da57a2f")
Table 15. Destroy a database specified by Database ID details
Example
https://localhost/resources/virtualApplications/d-7956c64e-0fac-49f2-b04e-efbc131a4cc4
 
Sample output
True
 

Delete a database specified by Database ID

deployer.virtualapplications.delete(<dbID>)
Table 16. Delete a database specified by Database ID details
Example
deployer.virtualapplications.delete("d-201fd95b-31c4-403a-8169-7c976da57a2f")
 
Sample output No output. View the list of all databases to verify the database has been removed.  

Database Image CLI command specifications

List all database images

deployer.dbimages.getlist()
Table 17. List all database images details
Example
deployer.dbimages.getlist()
 
Sample output
[{'tsmnodename': 'd-3651868c-99d7-4fd4-89fb-02a6f0b01a6d', 'timestamp': '20110518092615', 'dbname': 'mydb', 'imagename': 'bk30', 'id': 'myimage2.json', 'imagedescription': 'bk', 'host': '172.16.37.180'}]
 

List database images by dbaasversionge

deployer.dbimages.getlist({"dbaasversionge":< dbaas_version>})
Table 18. List database images by dbaasversionge details
Example
deployer.dbimages.getlist({"dbaasversionge":"1.1"})
 
Sample output
[{'tsmnodename': 'd-3651868c-99d7-4fd4-89fb-02a6f0b01a6d', 'timestamp': '20110518092615', 'dbname': 'mydb', 'imagename': 'bk30', 'id': 'myimage2.json', 'imagedescription': 'bk', 'host': '172.16.37.180'}]
 

Create a database image specified by Database ID

deployer.virtualapplications.get(<dbID>).operations.create (<python_dictionary_object>)
Note: Creating a backup database image includes two parts: 1) create a database image manually 2) automatically create a database image
Table 19. Create a database image specified by Database ID manually details
Example
deployer.virtualapplications.get("d-201fd95b-31c4-403a-8169-7c976da57a2f").operations.create({"role": "database-db2.DB2","type": "backup","global": "false", "parameters": {"imageName": "testimage", "imageDescription": "My database image for testdb"},"script": "backup.py","method": "backup","roleType": "DB2"})
 
Sample output
{
    "operation_id": "o-dc099918-e727-403e-aeb6-07ab4c8a5407",
    "parameters": (nested object),
    "result": (nested object),
    "role": "database-db2.DB2",
    "virtualapplication": (nested object)
  }
 
Table 20. Create a database image specified by Database ID automatically details
Example
deployer.virtualapplications.get("d-201fd95b-31c4-403a-8169-7c976da57a2f").operations.create({"role":"database-db2.DB2","type":"auto-backup", "parameters":{"frequency":"daily"}})
 
Sample output
{
  "operation_id": "o-8baaa258-640f-44a6-ad58-256fa70c12dc",
  "parameters": (nested object),
  "result": (nested object),
  "role": "database-db2.DB2",
  "virtualapplication": (nested object)
}
 

Retrieve database image information specified by Database Image ID

deployer.dbimages.get(<database_image_ID>)
Table 21. Retrieve database image information specified by Database Image ID details
Example
deployer.dbimages.get("myimage.json")
 
Sample output
{'tsmnodename': 'd-3651868c-99d7-4fd4-89fb-02a6f0b01a6d', 'dbaasversion': '1.1', 'backupmode': 'ONLINE', 'timestamp': '20110518092615', 'dbname': 'mydb', 'imagename': 'bk30', 'backuptype': 'NORMAL', 'imagedescription': 'bk', 'host': '172.16.37.180'}
 

Database Configuration CLI command specifications

Change appuser/appdba password specified by Database ID

deployer.virtualapplications.get(< dbID>).operations.create(< python_dictionary_object>)
Table 22. Change appuser/appdba password specified by Database ID details
Example
deployer.virtualapplications.get("d-201fd95b-31c4-403a-8169-7c976da57a2f").operations.create({"role": "database-db2.DB2","type": "configuration","global": false, "parameters": {"DB2.PASSWORD": "NQitXSzfpcZ6L3", "DB2.APPDBAPASSWORD": "8ga0AOQ79dkk1VwCQh"},"script": "change.py","method": "configuration","roleType": "DB2"})
 
Sample output
{
"role": "database-db2.DB2",
"type": "configuration",
"global": false,
"parameters": {
{"DB2.PASSWORD": "NQitXSzfpcZ6L3",
"DB2.APPDBAPASSWORD": "8ga0AOQ79dkk1VwCQh"}
},
"script": "change.py",
"method": "configuration",
"roleType": "DB2"
}
 

Database Workload CLI command specifications

Get database workload list

deployer.dbworkloads.getlist()
Table 23. Get database workload list details
Example
deployer.dbworkloads.getlist()
 
Sample output
[
   {
      "rate": "3",
      "workload_type": "Departmental OLTP",
      "workload_file": "departmental_OLTP.zip",
      "is_system": "true",
      "version": "1.1.0.1",
      "initial_disk_size": "1",
      "name": "Departmental Transactional",
      "id": "departmental_OLTP",
      "description": "For databases primarily used for online transaction processing (OLTP). The database will be optimized for transactional applications."
   },
   {
      "rate": "3",
      "workload_type": "Dynamic Data Mart",
      "workload_file": "dynamic_datamart.zip",
      "is_system": "true",
      "version": "1.1.0.1",
      "initial_disk_size": "1",
      "name": "Data Mart",
      "id": "dynamic_datamart",
      "description": "For databases primarily used for data warehousing. The database will be optimized for reporting applications."
   },
   {
      "rate": "3",
      "workload_type": "Departmental OLTP",
      "workload_file": " customized_oltp.zip",
      "is_system": "false",
      "version": "1.1.0.1",
      "initial_disk_size": "1",
      "name": "dwl1",
      "id":"121b79d0-9faf-457c-9bda-67b4864c115d",
      "description": "the first one"
   }
]
 

Database VM Logging CLI command specifications

Get log list from a database VM specified by Database ID and Virtual Machine ID

deployer.loggings.getLogList(deployer.virtualapplications.get(<dbID>),<v
mID>)
Table 24. Get log list from a database VM specified by Database ID and Virtual Machine ID details
Example
deployer.loggings.getLogList(deployer.virtualapplications.get("d-50dedbbc-a0f4-46ce-8788-8c09fe51f096"),"database-db2.11316173053230")
 
Sample output
{'DB2': ['/home/db2inst1/sqllib/log/instance.log',
'/home/db2inst1/sqllib/db2dump/db2diag.log', 
'/home/db2inst1/sqllib/db2dump/db2inst1.nfy', 
'/home/db2inst1/sqllib/db2dump/stmmlog/stmm.0.log'], 
'IWD Agent': ['/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/database-db2.11316173053230.DB2/console.log', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/database-db2.11316173053230.DB2/trace.log', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/database-db2.11316173053230.SSH/console.log', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/database-db2.11316173053230.SSH/trace.log', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/database-db2.11316173053230.AGENT/console.log', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/database-db2.11316173053230.AGENT/trace.log', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/console.log.0', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/database-db2.11316173053230.systemupdate/console.log', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/database-db2.11316173053230.systemupdate/trace.log', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/ffdc.log.0', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/trace.log.0', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/database-db2.11316173053230.MONITORING/console.log', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/database-db2.11316173053230.MONITORING/trace.log', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/install/console.log', 
'/opt/IBM/maestro/agent/usr/servers/database-db2.11316173053230/logs/install/trace.log', '/0config/0config.log'], 'OS': ['/var/log/cron', '/var/log/acpid', '/var/log/wtmp', '/var/log/secure', '/var/log/brcm-iscsi.log', '/var/log/maillog', '/var/log/mcelog', '/var/log/messages', '/var/log/spooler', '/var/log/yum.log', '/var/log/boot.log', '/var/log/dmesg']
}
 

Download log content from a database VM specified by Database ID and Virtual Machine ID and Log File Path

deployer.loggings.download(<specific_file_name>, deployer.virtualapplications.get(<dbID>) , <vmID>, <log_File_Path>)
Table 25. Download log content from a database VM specified by Database ID and Virtual Machine ID and Log File Path details
Example
deployer.loggings.download("/home/mylog.log",deployer.virtualapplications.get("d-50dedbbc-a0f4-46ce-8788-8c09fe51f096"),"database-db2.11316173053230","/home/db2inst1/sqllib/db2dump/db2diag.log")
 
Sample output No specific result is returned, you can check the downloaded log file from your <specific_file_name>.  

Database Customized Workload Standards CLI command specifications

Create a new customized database workload standard

deployer.dbworkloads.create(<python_dictionary_object>)
Table 26. Create a new customized database workload standard
Example
deployer.dbworkloads.create({"rate":"3","workload_type":"Departmental OLTP","initial_disk_size":"1","name":"dbwl1","description":"the first one","is_system":"false","version":"1.1.0.1","workload_file":"customized_oltp.zip"})

workload_type: Value must be "Departmental OLTP" or "Dynamic Data Mart"

initial_disk_size: Value must be from 0 to 500

rate: Value must be from 1 to 3

is_system: Value must be "false"

workload_file: File must be a compressed file and the file name cannot start with numbers or an underscore

Sample output
{
'version': '1.1.0.1', 
'initial_disk_size': '1', 
'description': 'the first one', 
'rate': '3', 
'workload_type': 'Departmental OLTP', 
'id': '121b79d0-9faf-457c-9bda-67b4864c115d',
 'is_system': 'false', 'name': '
dbwl1', 
'workload_file': 'customized_oltp.zip'
}
 

Upload the compressed file

Note: This step is required to create a customized workload standard.
deployer.dbworkloads.get(<dbworkloadID>).workloadfiles.upload("<local file path>")
Table 27. Upload the compressed file
Example
deployer.dbworkloads.get("121b79d0-9faf-457c-9bda-67b4864c115d").workloadfiles.upload("/root/deployer.cli/bin/customized_oltp.zip")              
 
Sample output
{
'filename': 'customized_oltp.zip',
'success': 'true'
}
The file name must be the same as the value of "workload_file" in the meta json file.

List all database workload standards

deployer.dbworkloads.list()
Table 28. List all database workload standards
Example
deployer.dbworkloads.list()
 
Sample output
[
   {
      "rate": "3",
      "workload_type": "Departmental OLTP",
      "workload_file": "departmental_OLTP.zip",
      "is_system": "true",
      "version": "1.1.0.1",
      "initial_disk_size": "1",
      "name": "Departmental Transactional",
      "id": "departmental_OLTP",
      "description": "For databases primarily used for online transaction processing (OLTP). The database will be optimized for transactional applications."
   },
   {
      "rate": "3",
      "workload_type": "Dynamic Data Mart",
      "workload_file": "dynamic_datamart.zip",
      "is_system": "true",
      "version": "1.1.0.1",
      "initial_disk_size": "1",
      "name": "Data Mart",
      "id": "dynamic_datamart",
      "description": "For databases primarily used for data warehousing. The database will be optimized for reporting applications."
   },
   {
      "rate": "3",
      "workload_type": "Departmental OLTP",
      "workload_file": " customized_oltp.zip",
      "is_system": "false",
      "version": "1.1.0.1",
      "initial_disk_size": "1",
      "name": "dwl1",
      "id":"121b79d0-9faf-457c-9bda-67b4864c115d",
      "description": "the first one"
   }
]
 

Update a customized database workload standard specified by Database Workload Standard ID

Note: The two default database workload standards, Departmental Transactional and Data Mart, can not be updated.
deployer.dbworkloads.get(<dbworkloadID>).update(<python_dictionary_object>)
Table 29. Update a customized database workload standard
Example
deployer.dbworkloads.get("121b79d0-9faf-457c-9bda-67b4864c115d").update({"version": "1.1.0.1", "initial_disk_size": "1", "description": "the first one", "rate": "2", "workload_type": "Departmental OLTP", "id": "121b79d0-9faf-457c-9bda-67b4864c115d", "is_system": "false", "name": "dbwl1", "workload_file":"customized_oltp.zip"})

workload_type: Value must be "Departmental OLTP" or "Dynamic Data Mart"

initial_disk_size: Value must be from 0 to 500

rate: Value must be from 1 to 3

is_system: Value must be "false"

workload_file: File must be a compressed file and the file name cannot start with numbers or an underscore

Sample output No output. Get the details of the updated workload standard to verify.

Download the compressed file of a customized database workload standard specified by Database Workload Standard ID and compressed file name

deployer.dbworkloads.get("<dbworkloadID>").workloadfiles.download("<workload_file>","<local file path>") 
Table 30. Download the compressed file of a customized database workload standard
Example
deployer.dbworkloads.get("121b79d0-9faf-457c-9bda-67b4864c115d").workloadfiles.download("customized_oltp.zip","/root/deployer.cli/bin/a.zip")
 
Sample output No output. Check the local file path.  

Download the compressed file of a default database workload standard specified by Database Workload Standard ID and compressed file name

deployer.dbworkloads.get("<dbworkloadID>").workloadfiles.download("<workload_file>","<local file path>") 
Table 31. Download the compressed file of a default database workload standard
Example
deployer.dbworkloads.get("departmental_OLTP").workloadfiles.download("departmental_OLTP.zip","/root/deployer.cli/bin/a.zip")    
 
Sample output No output. Check the local file path.  

Delete a customized database workload standard

Note: The two default database workload standards, Departmental Transactional and Data Mart, cannot be deleted.
deployer.dbworkloads.get("<dbworkloadID>").delete()
Table 32. Delete a customized database workload standard
Example
deployer.dbworkloads.get("121b79d0-9faf-457c-9bda-67b4864c115d").delete() 
 
Sample output No output. Check the result by listing all database workload standards.  

Database User Management CLI command specifications

Create a new user

deployer.virtualapplications.get(<dbID>).operations.create(<python_dictionary_object>)
Table 33. Create a new user
Example
deployer.virtualapplications.get("d-0a70a575-4bac-420e-8c7a-e663d2448e10").operations.create({"role":"database-db2.DB2","type":"createDB2User","parameters":{"sshAccess":"Deny","userName":"newuser","password":"123456","authLevel":["SYSADM","SYSCTRL","SYSMAINT","SYSMON"]},"groups":{}})
 
Sample output
{
  "operation_id": "o-cc986b72-a38c-47a7-9940-61f0116e0e40",
  "parameters": (nested object),
  "result": (nested object),
  "role": "database-db2.DB2",
  "virtualapplication": (nested object)
}
 

Change the password of a specified user

deployer.virtualapplications.get(<dbID>).operations.create(<python_dictionary_object>)
Table 34. Change the password of a specified user
Example
deployer.virtualapplications.get("d-0a70a575-4bac-420e-8c7a-e663d
2448e10").operations.create({"role":"database-db2.DB2","type":"resetPassword",
"parameters":{"userName":"newuser","newPassword":"<xor>a2pp"},"groups":{}
})      
 
Sample output
{
 "operation_id": "o-216e22e1-1085-4fae-ad67-b185883e0372",
  "parameters": (nested object),
  "result": (nested object),
  "role": "database-db2.DB2",
  "virtualapplication": (nested object)
}
 

List all users for a specified database

deployer.virtualapplications.get(<dbID>).dbusers.getlist()
Table 35. List all users for a specified database
Example
deployer.virtualapplications.get("d-0a70a575-4bac-420e-8c7a-e663d
2448e10").dbusers.getlist()
 
Sample output
[{'sshAccess': 'Deny', 'userName': 'new2', 'authLevel': 
''}, {'sshAccess': 'Allow', 'userName': 'user4', 'authLevel': 
'SYSADM,SYSCTRL,SYSMAINT,SYSMON'}, {'sshAccess': 'Deny', 'userName': 
'newuser', 'authLevel': 'SYSADM,SYSCTRL,SYSMAINT,SYSMON'}]
 

Delete a user

deployer.virtualapplications.get(<dbID>).operations.create(<python_dictionary_object>)
Table 36. Delete a user
Example
deployer.virtualapplications.get("d-0a70a575-4bac-420e-8c7a-e663d
2448e10").operations.create({"role":"database-db2.DB2","type":"userList","globa
l":"false","role_type":"DB2","parameters":{"userName":"newuser"}})
 
Sample output
{
 "operation_id": "o-18967b36-1776-4e66-b732-bdd099d1e794",
  "parameters": (nested object),
  "result": (nested object),
  "role": "database-db2.DB2",
  "virtualapplication": (nested object)
}
 

Database DB2 Fix Pack CLI command specifications

Note: The Create, Upload and Update steps are required to create a fix pack.

Create a DB2® fix pack

deployer.virtualapplications.get(<dbID>).operations.create(<python_dictionary_object>)
Table 37. Create a DB2 fix pack
Example
deployer.db2fixpacks.create(< python_dictionary_object >)
 
Sample output
{{'description': 'db2 v97fp6', 'id': 'f552d174-89da-4799-a130-82fe2973d8bd', 'name': 'v97fp6'}
 

Upload a package file by DB2 fix pack package name

deployer.db2fixpacks.upload("<local_file_path>")
Table 38. Upload a package file by DB2 fix pack package name
Example
deployer.db2fixpacks..upload("/home/alex/deployer.cli.3102/deployer.cli/bin/v9.7fp6_linuxx64_server.tgz")      
 
Sample output
{'file': 'v9.7fp6_linuxx64_server.tgz', 'file_name': 'v9.7fp6_linuxx64_server.tgz', 'fileName': 'v9.7fp6_linuxx64_server.tgz'} 
 

Update a package file by DB2 fix pack package name

deployer.db2fixpacks.get("<db2fixpackID>").update(<python_dictionary_object>)
Table 39. Update a package file by DB2 fix pack package name
Example
deployer.db2fixpacks.get("f552d174-89da-4799-a130-82fe2973d8bd").update({"name": "v97fp6","description": "db2 v97fp6", "id": "f552d174-89da-4799-a130-82fe2973d8bd","packageFile": "v9.7fp6_linuxx64_server.tgz "})
The uploaded file name must be the same with the value of "packageFile" in the meta json file.
Sample output There is no output from this command, retrieve the details of the updated DB2 fix pack to verify success.  

List all DB2 fix packs

deployer.db2fixpacks.list()
Table 40. List all DB2 fix packs
Example
deployer. db2fixpacks.list()
 
Sample output
[{
  "db2fixpackfiles": (nested object),
  "description": "db2 v97fp7",
  "id": "9b59c1c5-87db-49c5-aea1-db49f9c7cd1d",
  "name": "db2v97fp7",
"packageFile": " v9.7fp7_linuxx64_server.tgz ",
"db2level": "9.7.0.7",
"db2version": "9.7",
"platform": "linuxx64"
}, {
  "db2fixpackfiles": (nested object),
  "description": "db2 v97fp6",
  "id": "f552d174-89da-4799-a130-82fe2973d8bd",
  "name": "v97fp6",
"packageFile": "v9.7fp6_linuxx64_server.tgz",
"db2level": "9.7.0.6",
"db2version": "9.7",
"platform": "linuxx64"
}]
 

List all fix packs valid for DB2 upgrade

deployer.db2fixpacks.getvalidfixpacks(<dbID>)
Table 41. List all fix packs valid for DB2 upgrade
Example
deployer.db2fixpacks.getvalidfixpacks("d-96652bdd-8543-4e51-aaa0-2eda7f582e7c ")
 
Sample output
{'label':'name','identifier':'value','items':[{'value':'v9.7fp6_linuxx64_server.tgz', 'name': 'V97fp6'}] }
 

List all DB2 fix packs valid for creating a database pattern or database instance

deployer. db2fixpacks. getfixpacks ()
Table 42. List all DB2 fix packs valid for creating a database pattern or database instance
Example
deployer.db2fixpacks.getfixpacks () 
 
Sample output
{'label': 'name', 'identifier': 'value', 'items': [{'platform': 'linuxx64', 'db2
version': '9.7', 'value': 'db2_hybrid_en-9.7.0.5-linuxx64-20120112.tgz', 'name':
 'DB2 Version 9.7 Fix Pack 5 for Linux'}, {'platform': 'aix64', 'db2version': '9
.7', 'value': 'db2_hybrid_en-9.7.0.5-aix64-20120112.tgz', 'name': 'DB2 Version 9
.7 Fix Pack 5 for AIX'}, {'platform': 'linuxx64', 'db2version': '10.1', 'value':
 'db2_hybrid_en-10.1.0.0-linuxx64-20120312.tgz', 'name': 'DB2 Version 10.1 for Linux'}, {'platform': 'aix64', 'db2version': '10.1', 'value': 'db2_hybrid_en-10.1
.0.0-aix64-20120312.tgz', 'name': 'DB2 Version 10.1 for AIX'}, {'platform': 'lin
uxx64', 'db2version': '9.7', 'value': 'v9.7fp6_linuxx64_server.tgz', 'name': ''V97fp6''}]}
 

Create a database pattern that uses a DB2 fix pack

command:deployer.applications.create("<local_json_file_path>)") 
Table 43. Create a database pattern that uses a DB2 fix pack
Example
deployer.applications.create("D:\\deployer.cli\\bin\\appmodel-fixpack.json")      
The content of appmodel-default.json looks like:
{"model":{"nodes":[{"attributes":{"workloadStandard":"departmental_OLTP","dbDiskSize":10,"dbCodeset":"UTF-8","dbCollate":"SYSTEM","sqlType":"DB2","versionName":"V97Linux","fixpackName":"v9.7fp6_linuxx64_server.tgz","source":"defaultworkloadStandardApproach","dbTerritory":"US","purpose":"non-production"},"type":"DB2","id":"database"}],"version":"1.1","app_type":"database","patterntype":"dbaas","name":"fixPattern","description":"use the db2 fixpack named v9.7fp6_linuxx64_server"}}
Sample output
{
  "access_rights": (nested object),
  "acl": (nested object),
  "app_id": "a-ab1cfdde-da0a-4cc2-aa86-9ddba1abcb29",
  "app_name": "fixPattern",
  "app_type": "database",
  "artifacts": (nested object),
  "content_md5": "DB9A55836909646ADECAB7551FEAD70F",
  "content_type": "application/json",
  "create_time": "2012-02-28T06:43:37Z",
  "creator": "cbadmin",
  "last_modified": "2012-02-28T06:43:39Z",
  "last_modifier": "cbadmin",
  "patterntype": "dbaas",
  "version": "1.1"
}
 

Deploy a database with a database pattern that uses a DB2 fix pack

deployer.applications.get("<dbpatternID>").deploy("<deployment_name>", <cloud_group (optional)>, <certFile>(optional), <params>)
Table 44. Deploy a database with a database pattern that uses a DB2 fix pack
Example
deployer.applications.get("a-ab1cfdde-da0a-4cc2-aa86-9ddba1abcb29").deploy("fixdb",deployer.clouds[0],None,{"database.dbname":"fixdb"})
 
Sample output
{
  "acl": (nested object),
  "app_id": "a-ab1cfdde-da0a-4cc2-aa86-9ddba1abcb29",
  "app_type": "database",
  "appmodel": "https://172.16.65.196:9444/storehouse/user/deployments/d-96652bdd
-8543-4e51-aaa0-2eda7f582e7c/appmodel.json",
  "deployment": "https://172.16.65.196:9444/storehouse/user/deployments/d-96652b
dd-8543-4e51-aaa0-2eda7f582e7c/deployment.json",
  "deployment_name": "fixdb",
  "id": "d-96652bdd-8543-4e51-aaa0-2eda7f582e7c",
  "maintenance_mode": False,
  "operations": (nested object),
  "role_error": False,
  "start_time": "2012-02-28T06:51:30.876Z",
  "status": "LAUNCHING",
  "topology": "https://172.16.65.196:9444/storehouse/user/deployments/d-96652bdd
-8543-4e51-aaa0-2eda7f582e7c/topology.json"
}]
 

Upgrade a deployed database

deployer.virtualapplications.get(<dbID>).operations.create(<python_dictionary_object>)
Table 45. Upgrade a deployed database
Example
deployer.virtualapplications.get("d-96652bdd-8543-4e51-aaa0-2eda7f582e7c").operations.create({"role":"database-db2.DB2","type":"applyFixpacks","parameters":{"fixpackName":"v9.7fp6_linuxx64_server.tgz"}}) 
 
Sample output
{
  "operation_id": "o-45616cda-7594-4683-930f-81eccdaf0b44",
  "parameters": (nested object),
  "result": (nested object),
  "role": "database-db2.DB2",
  "virtualapplication": (nested object)
}
 

Upgrade database application

deployer.virtualapplications.get(<dbID>).upgrade()
Table 46. Upgrade database application
Example
deployer.virtualapplications.get("d-96652bdd-8543-4e51-aaa0-2eda7f582e7c ").upgrade() 
 
Sample output True  

Delete a specified DB2 fix pack

deployer.db2fixpacks.get("<db2fixpackID>").delete()
Table 47. Delete a specified DB2 fix pack
Example
deployer.db2fixpacks.get("f552d174-89da-4799-a130-82fe2973d8bd).delete()       
 
Sample output There is no output from this command, retrieve the list of all DB2 fix packs to verify if the fix pack has been removed.