Sedna LogoBackground Top
 
Home  |  Getting Started  |  Documentation  |  Demo  |  Download  |  Support 

2.3 Managing Databases

2.3.1 Creating a Database

To create a database, use the se_cdb command.

Each database consists of the following files, which are located as described in Section 2.1.

  • The <db_name>.sedata file is used for storing persistent XML data, which are loaded to the database by user using LOAD/UPDATE expressions.
  • The <db_name>.setmp file is used for storing temporary XML data. It stores intermediate results and size may grow during query execution.
  • The <db_name>.*llog files are used for storing database logical log.

Besides, for each database there are run-time configuration parameters, which are stored in the database configuration file (see Section 2.3.2).

The usage of the se_cdb command is as follows:

Usage: se_cdb [options] dbname  
 
options:  
  --help                      display this help and exit  
  -help                       display this help and exit  
  -version                    display product version and exit  
  -data-file-max-size Mbs     the max size of data file (in Mb),  
                              infinite size by default (0)  
  -tmp-file-max-size Mbs      the max size of tmp file (in Mb),  
                              infinite size by default (0)  
  -data-file-ext-portion Mbs  the data file extending portion  
                              size (in Mb), default 100Mb  
  -tmp-file-ext-portion Mbs   the tmp file extending portion  
                              size (in Mb), default 100Mb  
  -data-file-init-size Mbs    the data file initial size (in Mb),  
                              default 100Mb  
  -tmp-file-init-size Mbs     the tmp file initial size (in Mb),  
                              default 100Mb  
  -bufs-num N                 the number of buffers in main memory,  
                              default 1600 (64Kb per buffer)  
  -upd-crt N                  update criterion parameter  
                              (fraction of database), default 0.25  
  -max-log-files N            maximum log files  
                              until log truncate (default: 3)  
  -log-file-size Mbs          maximum one log file size (in Mb),  
                              (default 100Mb)  
  -db-security  level         the level of database security:  
                                1) ’off’ - none;  
                                2) ’authentication’ (default);  
                                3) ’authorization’  
 
   db_name                    name of the database to be created

The first and second options are straightforward, typing one of these options administrator can get the exhaustive information about the se_cdb command.

The third option allows getting the version of the se_cdb command.

The -data-file-max-size option allows Administrator to set up the maximum size (in Mb) of the file where the persistent data are stored. The default value for this option is infinite (0). Note, when database hits this limit it raises system error (SE1012) and shutdowns.

The -tmp-file-max-size option allows Administrator to set up the maximum size (in Mb) of the file where the temporary data are stored. The default value for this option is infinite (0). Note, when database hits this limit it raises system error (SE1012) and shutdowns.

The -data-file-ext-portion option allows Administrator to set up the size (in Mb) of the portion to which the persistent data file will be extended as result of executing resize operation. Resize operation is applied to the persistent data file if its size is less than needed for storing XML documents. The default value is 100 Mb.

The -tmp-file-ext-portion option allows Administrator to set up the size of the portion to which the temporary data file will be extended as result of executing resize operation. The resize operation is applied to the temporary data file if its size is less than needed for storing temporary data intermediate results of the query, for example). The default value is 100 Mb.

The -data-file-init-size option allows Administrator to set up the initial size (in Mb) of the persistent data file. It is obvious that the initial size can’t be greater than the maximum size of the persistent data file. The default value is 100 Mb.

The -tmp-file-init-size option allows Administrator to set up the initial size (in Mb) of the temporary data file. It is obvious that the initial size can’t be greater than the maximum size of the temporary data file. The default value is 100 Mb.

The -bufs-num option allows Administrator to set up the number of buffers in main memory. This number is connected with the size of the main memory, but the performance of the database depends of this number very much. The default value is 1600 buffers, which is equal to 100Mb and we do not recommend to use less number of buffers. The size of one buffer is 64Kb and can’t be customized by Administrator.

The -upd-crt option is the parameter of the Sedna Storage Manager to control snapshot advancement rate. It allows Administrator to specify the fraction of the database updating of which will result in snapshot advancement. The default value is 0.25.

The -max-log-files option allows Administrator to control how many log files will be created until Storage Manager will try to truncate logical log by making a checkpoint. For example, if the value is 3, then after creating fourth file Storage Manager will try to truncate log. This may significantly speed up recovery process, since there would be much shorter log to analyze. Note, however, that checkpoint may be quite a performance-heavy procedure. So you should not set the value too small. This parameter can be changed later on every Storage Manager run.

The -log-file-size option allows to control size of each log file. When current log file size becomes greater than the value specified, new log file is created. With the previous parameter it allows Administrator to find compromise between frequent checkpoints and faster recovery. This parameter can be set only on database creation and cannot be changed later.

The -db-security option is used to set the level of security in a database being created. Currently there are 3 possible levels: (1) off - there is no authentication, neither authorization; (2) authentication - only authentication supported (checks user name and password on session open) (3) authorization - authentication and authorization supported (support for database users and privileges). By default database is created with authentication level. Note, that this parameter is set only once on database creation and cannot be changed later for the database.

The last parameter db_name is the name of the database to be created. Database name may contain Latin letters, numbers. Also the following special symbols are allowed #%&()[]{},.-_=@^‘~ (double quote (quote on Windows) database name parameter to create a database with the name which contains special symbols). There cannot be two databases with the same name.

2.3.2 Configuring a Database

For each database there is a set of run-time configuration parameters, which store in the database configuration file. The name of the database configuration file is <db_name>_cfg.xml where <db_name> is the name of the database. The location of configuration file is:

[win:] SEDNA_INSTALL\cfg  
[nix:] SEDNA_INSTALL/cfg

The configuration file is an XML document, which satisfies the following DTD:

<!ELEMENT db (name, bufs_num, max_trs_num, upd_crt,  
              tmp_file_initial_size)>  
<!ELEMENT name (#PCDATA)>  
<!ELEMENT bufs_num (#PCDATA)>  
<!ELEMENT max_trs_num (#PCDATA)>  
<!ELEMENT max_log_files (#PCDATA)>  
<!ELEMENT upd_crt (#PCDATA)>  
<!ELEMENT tmp_file_initial_size (#PCDATA)>

The root of this XML document is the db element, which contains name, bufs_num, max_trs_num, max_log_files, upd_crt, tmp_file_initial_size elements. The name element defines the name of the database. The bufs_num element defines the number of buffers in main memory for Storage Manager component. The semantic of max_trs_num element will be defined in future versions of Sedna. The max_log_files element defines the maximum number of log files prior to truncation attempt. The upd_crt element defines the fraction of the database updating of which will result in snapshot advancement. Finally, tmp-file-initial-size defines initial size of the temporary data file in megabytes. Once the database is started up, old temporary file is removed and empty one of this size is initialized. Default value is 100 Mb. To tune the database run-time configuration, Administrator should edit the proper elements of the database configuration file. Note, in order for new configuration to take effect you must restart Storage Manager.

2.3.3 Deleting a Database

To drop a database, use the se_ddb command. The usage of the se_ddb command is as follows:

Usage: se_ddb [options] dbname  
 
options:  
  --help            display this help and exit  
  -help             display this help and exit  
  -version          display product version and exit  
   db-name          The name of the database

The first and second options are straightforward, typing one of these options Administrator can get the exhaustive information about the se_ddb command.

The third option allows getting the version of the se_ddb command.

The last parameter db_name is the name of the database to be dropped.

Note that administrator must stop database firstly (see 2.3.5) and then run se_ddb utility.

2.3.4 Running a Database

To run the database with name db_name Administrator should use se_sm command. The run-time configuration parameters of the database can be set by means of se_sm command line options. If configuration parameter is not set via command line option, than the database Storage Manager retrieves the default value of this parameter from configuration file (see section 2.3.2).

The usage of the se_sm command is as follows:

Usage: se_sm [options] dbname  
 
options:  
  -help                    display this help and exit  
  --help                   display this help and exit  
  -version                 display product version and exit  
  -background-mode on/off  start the server in the background mode  
                           (default on)  
  -bufs-num N              the number of buffers in main memory,  
                           (config file defines default value)  
  -upd-crt N               criterion parameter to advance snapshots  
                           (config file defines default value)  
  -max-log-files N         maximum log files until log truncate  
                           (default: 3)  
  -tmp-file-init-size Mbs  the tmp file initial size (in Mb),  
                           (config file defines default value)  
   db-name                 The name of the database

The first and second options are straightforward, typing this option Administrator can get the exhaustive information about the se_sm command.

The third option allows getting the version of the se_sm command. The -background-mode option allows Administrator to start database in the background mode.

The -bufs-num option allows to set up the number of buffers in main memory. This number is connected with the size of the main memory, but the performance of the database depends of this number very much. The default value is retrieved from configuration file. The size of one buffer is 64Kb and can’t be customized.

The -upd-crt option allows Administrator to specify the fraction of the database updating of which will result in snapshot advancement.

The -max-log-files option allows Administrator to control how many log files will be created until Storage Manager will try to truncate logical log by making a checkpoint. For example, if the value is 3, then after creating fourth file Storage Manager will try to truncate log. This may significantly speed up recovery process, since there would be much shorter log to analyze. Note, however, that checkpoint may be quite a performance-heavy procedure. So you should not set the value too small. This parameter can be changed on every Storage Manager run.

The -tmp-file-init-size defines initial size of the temporary data file in megabytes. Once the database is started up, old temporary file is removed and empty one of this size is initialized. Default value of this parameter is retrieved from the database configuration file 2.3.2.

The last parameter dbname defines the name of the database to be started up.

Note: before running any database be sure that Sedna Server is strarted up (see section 2.2.1).

2.3.5 Stopping a Database

To stop the database with name db_name, Administrator should use se_smsd command. This command takes one input parameter, which defines the name of the database to be shut down. The usage of the se_smsd command is as follows:

Usage: se_smsd [options] dbname  
 
options:  
  --help              display this help and exit  
  -help               display this help and exit  
  -version            display product version and exit  
   db-name            The name of the database

The first and second options are straightforward, typing these options Administrator can get the exhaustive information about the se_smsd command. The third option allows getting the version of the se_smsd.

Note that se_smsd command causes a roll back of all active transactions executed over db_name database.