mxdbs db-create
Syntax
mxdbs db-create [-h|--help] [--schema-name
schema_name]
database_name
database_size
external_username
password
Description
The
mxdbs db-create
sub-command creates a database.
Parameters
database_name
- specifies the name of the database to be created. The database name must be a valid SQL identifier of maximum length 120 characters. Only ISO88591 characters are supported. The database name is case-insensitive and cannot contain spaces. If the name contains any shell special characters such as &, >, or is a SQL reserved word, the name must be enclosed in double quotes. PUBLIC cannot be used as the database name.
database_size
- specifies the size of the database in Gigabytes.
external_username
- specifies an External Username who will be the initial user of the database. If the specified external user does not exist on the system, the user is created with an associated Guardian user. The initial database user must be a valid SQL identifier of maximum length 128 characters. The name cannot contain spaces. If the name contains any shell special characters such as &, >, or is a SQL reserved word, the name must be enclosed in double quotes. PUBLIC, DB_PUBLIC, and SYSTEM cannot be specified as external username. The database username cannot have the same format as a Guardian user name.
password
- specifies the password assigned to the database user. The password is assigned to the Guardian user associated with the external user. Password must be a string of one to 64 characters. It can contain any alphanumeric characters except blanks, commas, semicolons, and the ASCII null character, and must meet the Safeguard global attributes for password.
--schema-name schema_name
- specifies the name of the initial schema. If the
--schema-name
option is not specified, the schema name defaults to DEFAULT_SCHEMA. If the name contains any shell special characters such as &, >, or is a SQL reserved word, the name must be enclosed in double quotes. The initial schema is always converted to uppercase. The initial schema cannot be INFORMATION_SCHEMA or have the name prefix "DEFINITION_SCHEMA_VERSION_".
Options
-h | --help
- Displays the help details.
Considerations
- If there are not enough available volumes that meet the requested database size, the operation fails.
- Protection records for volumes configured for DBS are added to Safeguard at DBS installation time. The file-sharing group associated with the database to be created is added to the volume ACL of the selected volumes with CREATE (C) access.
-
An MXCS datasource is created with the same name as the database name. The datasource is associated with the MXCS service configured for DBS application access. The following set of read-only default attributes are added to the datasource for applications to access the database:The following are the default values for the datasource attributes:
Attribute Description CATALOG Value is set with the input database name. SCHEMA Value is set with the input schema name. POS_LOCATIONS Value is set with the list of volumes assigned to the database. POS_FOR_INDEX Value is set to ON. POS_NUM_OF_PARTNS Value is set to the number of volumes assigned to the database. DDL_DEFAULT_LOCATIONS Value is set with the list of volumes assigned to the database. HIST_SCRATCH_VOL Value is set to the volume assigned to the database. SCRATCH_DISKS Value is set with the list of volumes assigned to the database. TEMPORARY_TABLE_HASH_PARTITIONS Value is set to the list of volumes assigned to the database. Attributes Value MaxServer 100 IdleServer 2 InitServer 2 ConnTimeOut 120 mins IdleTimeOut 60 mins CpuList List of CPUs assigned for the database from the volume selected for the database. -
A catalog is created with the database name and is associated with the database. If a user catalog exists on the system with the same name as the database name, the database creation fails.
-
Users of the provisioned database do not have access to the NonStop server on which the database is hosted. However, the database object SPJ requires the class and jar file to be placed on the NonStop server in an OSS directory. When the database is created, an associated OSS directory is created and ownership of the directory is granted to the global DBS administrator user. The name of the OSS directory is in the form DBsafeguard_file-sharing_groupid. The database OSS directory is created in the directory configured for DBS at installation time. If not configured, the default home directory for database OSS directory is /mxdbsdata.
-
Volumes will be assigned to the database based on the CPU weightage of the volume's primary cpu. The volume whose primary CPU has the lowest weightage is assigned first. Once the volume is assigned, the primary CPU weightage is incremented by 2. The backup CPU weightage is incremented by 1. Then the next volume is assigned with the next lowest cpu weightage. The volume assignment continues until the requested database size is met. If there are not enough available volumes that meet the requested database size, the database creation fails.
-
Implicit privilege groups are created when you create a database. The privileges to the implicit privilege groups are granted at the schema level only. Database implicit privilege groups cannot be managed using privilege group management statements such as CREATE, ALTER, and DROP PRIVILEGE GROUP. The privileges granted to the implicit groups are applicable for existing and future schemas.
-
Privilege group for users with READ access to the database
Implicit privilege group for user with read access level to the database is of the form DBuid_READ. This privilege group is granted SELECT, USAGE, and EXECUTE privilege on all schemas in the database, at the time of database creation. The privileges are automatically extended to schemas created after database creation. Users added to the database with read access level are added to this implicit privilege group.
-
Privilege group for users with WRITE access to the database
The implicit privilege group for user with WRITE access level to the database is of the form DBuid_WRITE. This privilege group is granted SELECT, INSERT, UPDATE, DELETE, and READ access on all schemas in the database at the time of database creation. The privileges are automatically extended to schemas created after database creation. Users added to the database with WRITE access level are added to this implicit privilege group.
-
Privilege group for users with CREATE access to the database
The implicit privilege group for user with CREATE access level to the database is of the form DBuid_CREATE. This privilege group is granted CREATE, ALTER, DROP privileges, and READ, WRITE access on all schemas in the database at the time of database creation. The privileges are automatically extended to schemas created after database creation. Users added to the database with CREATE access level are added to this implicit privilege group. The members of this group are considered as database owners.
-
When a database is created, an external user specified will be assigned as the initial user of the database. The initial user will be added as a member to the privilege group for CREATE access. The users with CREATE access privilege level in the database can create schemas and other database objects. Users authorized to execute DBS commands can add users to the database using the
mxdbs db-add-user
sub-command.
Example input and output
The following command creates a database named DB1 with size 100 GB, and an initial database user, DEMOUSER. The optional parameter
--schema-name
is not specified in the command. Initial schema with the name DEFAULT_SCHEMA is created.
mxdbs db-create DB1 100 DEMOUSER hpe
Hewlett Packard Enterprise NonStop(TM) SQL/MX DBS Client 3.5
(c) Copyright 2016 Hewlett Packard Enterprise Development LP.
db-create command started.
MXCS Service Host : demohost.external.net
MXCS Service Port : 2100
Datasource Name : DB1
Initial Schema Name : "DEFAULT_SCHEMA"
OSS Directory : DB1005
--- mxdbs operation complete.