Nonstop Database, HiRDB Version 9 Command Reference

[Contents][Index][Back][Next]

2.26 pddefrev (Generate definition SQL)

Organization of this section
(1) Function
(2) Executor
(3) Format
(4) Options
(5) Rules
(6) Notes

(1) Function

The pddefrev command generates a definition SQL for tables, indexes, view tables, stored procedures, and triggers defined in the HiRDB system.

The generated definition SQL can be used as an input to the database definition utility. This command generates the definition SQL by starting the dictionary import/export utility (pdexp) internally.

(2) Executor

User with DBA privilege or the table owner

(3) Format

 
pddefrev -f control-statements-filename
         -o definition-SQL-output-filename
        [-w work-directory-name]
        [-W execution-monitoring-interval]
 

(4) Options

(a) -f control-statements-filename ~<pathname> ((up to 1023 bytes))

Specifies the name of the control statements file that contains the tables and stored procedures for which the definition SQL is to be generated. For details about the contents of the control statements file, see Chapter 9. Dictionary Import/Export Utility (pdexp).

(b) -o definition-SQL-output-filename ~<pathname> ((up to 1023 bytes))

Specifies the absolute pathname of the file to which the generated definition SQL is to be output. If the specified file already exists, HiRDB writes the generated definition SQL by overwriting the existing information; if the specified file does not already exist, HiRDB creates it.

(c) -w work-directory-name ~<pathname>

Specifies the absolute pathname of the directory to be used for temporary storage of the export file that will be created internally by the pddefrev command in order to export the dictionary. When this option is omitted, the command creates the file in the following directory:

-w option pd_tmp_directory operand in the system definition
Specified Omitted
TMPDIR environment variable
Specified Omitted
Specified Directory specified in the -w option
Omitted Directory specified in pd_tmp_directory Directory specified in TMPDIR /tmp directory

The following is the name of the export file that is created:

 
pddefrev.exp.HHMMSS
 

The local time is set in HHMMSS.

(d) -W execution-monitoring-interval ~<unsigned integer> ((0 to 3600))

Specifies (in minutes) the monitoring interval when the execution time of the pddefrev command is to be monitored. For guidelines on the value to specify and details about the resulting operation, see the description of the pd_cmd_exec_time operand in the system common definition in the manual HiRDB Version 9 System Definition.

If 0 is specified in this option, the command's execution time is not monitored.

If this option is omitted, the value of the pd_cmd_exec_time operand in the system common definition takes effect.

(5) Rules

  1. The pddefrev command can be executed only while HiRDB is active.
  2. The pddefrev command must be executed at the server machine containing the single server or the server machine where the system manager is located.
  3. To execute the pddefrev command, you must grant access permissions for the definition SQL output file and work directory to the HiRDB administrator beforehand.

(6) Notes

  1. The results of the pddefrev command can be checked on the basis of the return value and by whether or not there are any error messages. Return code 0 for the pddefrev command indicates normal termination, and return code 8 or 12 indicates abnormal termination.
  2. Only one pddefrev command can be executed at a time. The command cannot be executed while the dictionary import/export utility is executing.
  3. The following table lists the definition SQL statements that are generated by this command:
    Type Index definition Comment definition Definition SQL to be generated
    Base table Defined Defined CREATE TABLE
    CREATE INDEX
    COMMENT
    Not defined CREATE TABLE
    CREATE INDEX
    Not defined Defined CREATE TABLE
    COMMENT
    Not defined CREATE TABLE
    View table -- Defined CREATE VIEW
    COMMENT
    Not defined CREATE VIEW
    Stored procedure -- -- CREATE PROCEDURE
    Trigger -- -- CREATE TRIGGER

    Legend:
    --: Not applicable

  4. The definition SQL statements are generated in the order specified in the control statements file.
  5. A semicolon (;) is added at the end of the line of a generated definition SQL statement so that the definition SQL can be used as an input to the database definition utility. end_proc; is added in the case of CREATE PROCEDURE and CREATE TRIGGER.
  6. Definition SQL statements involving any of the following tables, procedures, or functions are not generated:
    • Table definitions containing abstract data types (CREATE TABLE)
    • Index definitions specifying index types (CREATE INDEX)
    • Function definitions (CREATE FUNCTION and system-defined scalar functions)
    • Procedures specifying an abstract data type as a data type for a parameter in a procedure (CREATE PROCEDURE)
    • Procedures calling another procedure from within the procedure definition (CREATE PROCEDURE)
    • A procedure declared in an abstract data type (CREATE TYPE)
    • Procedures calling a function definition (CREATE FUNCTION or system-defined scalar function) from within the procedure definition
  7. When CREATE PROCEDURE is created, the values of the SQL or extended SQL optimization options are generated in decimal format.
  8. Linefeed is performed on the created definition SQL statement in accordance with a condition. For details about the linefeed condition, see 9.3(3) Rules for definition SQL generation.
  9. If you selected utf-8 or utf-8_ivs as the character encoding in the pdsetup command, you can use a file with a BOM as the control statement file for pddefrev. Note that even when you do this, the BOM is skipped. No BOM is included in the file that is output by pddefrev.
  10. A definition SQL statement cannot be generated for a table for which a CHAR-type column with the UTF-16 character set specified is used as the partitioning key for key range partitioning or matrix partitioning (key range partitioning with a boundary value specified), if the length of the partitioning key exceeds the column's definition length.