HELPLIB.HLB  —  RMU72  Load  Database  Examples
    Example 1

    This command loads the data from the RMS file, names.unl, into
    the newly created RETIREES table of the mf_personnel database.
    The record structure of RETIREES is in the file names.rrd. The
    names.unl and names.rrd files were created by a previous RMU
    Unload command. The unload operation unloaded data from a view
    derived from a subset of columns in the EMPLOYEES table.

    $ RMU/LOAD/RECORD_DEFINITION=FILE=NAMES.RRD -
    _$ MF_PERSONNEL RETIREES NAMES.UNL

    Example 2

    This command restarts an aborted load operation that was loading
    the newly created RETIREES table of the mf_personnel database
    from the names.unl file. The columns being loaded are EMPLOYEE_
    ID, LAST_NAME, and FIRST_NAME. The original load operation
    had committed 25 records. Beginning with the 26th record, the
    restarted load operation commits the transaction at every record
    until it reaches the original point of failure.

    $ RMU/LOAD/FIELDS=(EMPLOYEE_ID, LAST_NAME, FIRST_NAME) -
    _$ /COMMIT_EVERY=1/SKIP=25 MF_PERSONNEL RETIREES NAMES.UNL

    Example 3

    This example loads a new table, PENSIONS, into the mf_personnel
    database by using record definitions located in the data
    dictionary.

    This example assumes that you have first defined a temporary
    view, TEMP_PENSIONS, combining appropriate columns of the
    EMPLOYEES and SALARY_HISTORY tables. You must also create a
    permanent table, PENSIONS, into which you will load the data.

    Unload the TEMP_PENSIONS view by using the RMU Unload command
    with the Record_Definition=File=name qualifier to create both
    an .rrd file containing the column definitions and a data.unl
    file containing the data from the TEMP_PENSIONS view. Load the
    new record definitions from the pensions.rrd file into the data
    dictionary by using the @ command at the CDO prompt. Then you
    can load the data into the PENSIONS table of the mf_personnel
    database by using the RMU Load command.

    $ RMU/UNLOAD/RECORD_DEFINITION=FILE=PENSIONS.RRD MF_PERSONNEL -
    _$ TEMP_PENSIONS DATA.UNL
    $ DICTIONARY OPERATOR
    Welcome to CDO V7.0
    The CDD/Repository V7.0 User Interface
    Type HELP for help
    CDO> @PENSIONS.RRD
    CDO> EXIT
    $ RMU/LOAD/RECORD_DEFINITION=PATH=PENSIONS MF_PERSONNEL PENSIONS -
    _$ DATA.UNL

    Example 4

    The following command loads the audit records for the mf_
    personnel database from the security audit journal file into
    the AUDIT_TABLE table in the mf_personnel database. Note that if
    the AUDIT_TABLE table does not exist, the RMU Load command with
    the Audit qualifier creates it with the columns shown in Columns
    in a Database Table for Storing Security Audit Journal Records.

    $ RMU/LOAD/AUDIT MF_PERSONNEL AUDIT_TABLE -
    _$ SYS$MANAGER:SECURITY.AUDIT$JOURNAL
    %RMU-I-DATRECREAD,  12858 data records read from input file.
    %RMU-I-DATRECSTO,   27 data records stored.

    Example 5

    The following command loads the audit records for the mf_
    personnel database from the security audit journal file into
    the AUDIT_TABLE table into the audit_db database. Note that the
    AUDIT_TABLE table is not created when the database is created.
    In this case, the RMU Load command with the Audit=Database_
    File qualifier creates it with the columns shown in Columns in
    a Database Table for Storing Security Audit Journal Records.

    $ RMU/LOAD/AUDIT=DATABASE_FILE=MF_PERSONNEL AUDIT_DB AUDIT_TABLE -
    _$ SYS$MANAGER:SECURITY.AUDIT$JOURNAL

    Example 6

    This example loads a new table, COLLEGES, into the mf_personnel
    database by using record definitions located in the data
    dictionary. A commit operation occurs after every record is
    stored. The Log_Commits qualifier prints a message after each
    commit operation.

    $ RMU/LOAD/RECORD_DEFINITION=FILE=COLLEGES.RRD /COMMIT_EVERY=1 -
    _$ /LOG_COMMIT MF_PERSONNEL COLLEGES RMU.UNL
    %RMU-I-DATRECSTO, 1 data records stored
    %RMU-I-DATRECSTO, 2 data records stored
    %RMU-I-DATRECSTO, 3 data records stored
    %RMU-I-DATRECSTO, 4 data records stored
    %RMU-I-DATRECSTO, 4 data records stored
    $

    Example 7

    The following example shows how a date stored in the .unl file as
    16-character collatable text can be converted to VMS DATE format
    when loaded into the database by using the RMU Load command.
    (The form of the .unl date is yyyymmddhhmmsscc, whereas the form
    of the VMS DATE is dd-mmm-yyyy:hh:mm:ss.cc. In both cases, y is
    the year, m is the month, d is the day, h is the hour, m is the
    minute, s is the second, and c is hundredths of a second. However
    in the .unl format, the month is expressed as an integer, whereas
    in the VMS DATE format the month is expressed as a 3-character
    string.)

    The example assumes that the default SYS$LANGUAGE is ENGLISH.

    SQL> --
    SQL> -- Show the definition of the TEST table, in which the
    SQL> -- COL1 column is the VMS DATE data type:
    SQL> --
    SQL> SHOW TABLE DATETEST;

    Columns for table DATETEST:
    Column Name                     Data Type        Domain
    -----------                     ---------        ------
    COL1                            DATE VMS

       .
       .
       .
    $ !
    $ ! Show the .unl file that will be loaded into the TEST table:
    $ !
    $ TYPE TEST.UNL
    $ !
    1991060712351212
    $ !
    $ ! Note that the .rrd file shows a data type of TEXT of 16
    $ ! characters.  These 16 characters are the number of characters
    $ ! specified for the date in the test.unl file:
    $ !

    $ TYPE TEST.RRD
    DEFINE FIELD COL1 DATATYPE IS text size is 16.
    DEFINE RECORD TEST.
       COL1 .
    END TEST RECORD.
    $ !
    $ ! Load the data in test.unl into the DATETEST table:
    $ !
    $ RMU/LOAD/RMS=FILE=TEST.RRD TEST.RDB DATETEST TEST.UNL
    %RMU-I-DATRECREAD,  1 data records read from input file.
    %RMU-I-DATRECSTO, 1 data records stored.
    $ !
    $ SQL
    SQL> ATTACH 'FILENAME TEST';
    SQL> SELECT * FROM DATETEST;
     COL1
      7-JUN-1991 12:35:12.12
    1 row selected

    Example 8

    The following example shows how a date stored in the .unl file
    as 22-character collatable text can be converted to TIMESTAMP
    format when loaded into the database by using the RMU Load
    command. The correct format for the .unl TIMESTAMP value is yyyy-
    mm-dd:hh:mm:ss.cc, where y,m,d,h,m,s,and c represent the same
    elements of the date and time format as described in Example 7.

    This example also shows the use of an exception file to trap data
    that cannot be stored.

    $ ! Create a column in the mf_personnel database with a
    $ ! TIMESTAMP datatype:
    $ SQL
    SQL> ATTACH 'FILENAME MF_PERSONNEL.RDB';
    SQL> CREATE TABLE NEWTABLE (COL1 TIMESTAMP);
    SQL> SHOW TABLE (COLUMN) NEWTABLE;
    Information for table NEWTABLE
    Columns for table NEWTABLE:
    Column Name                     Data Type        Domain
    -----------                     ---------        ------
    COL1                            TIMESTAMP(2)

    SQL> COMMIT;
    SQL> EXIT
    $ !
    $ ! Create a .unl file with the data you want to load.  Note that
    $ ! the second value is a valid TIMESTAMP specification, the first
    $ ! value is not.
    $ !
    $ CREATE TEST.UNL
    06-14-1991:12:14:14.14
    1991-06-14:12:14:14.14

    $ !
    $ ! Create an .rrd file that defines the TIMESTAMP field
    $ ! as a TEXT field:
    $ !
    $ CREATE TEST.RRD
    DEFINE FIELD COL1 DATATYPE IS TEXT SIZE 22.
    DEFINE RECORD NEWTABLE.
        COL1.
    END NEWTABLE RECORD.
    $ !
    $ ! Attempt to load the data in the .unl file. Oracle RMU returns an
    $ ! error on the first data record because the date was incorrectly
    $ ! specified.  The first record is written to the exception file,
    $ ! BAD.DAT.
    $ !

    $ RMU/LOAD/RMS=(FILE=TEST.RRD,EXCEPT=BAD.DAT) MF_PERSONNEL.RDB -
    _$ NEWTABLE TEST.UNL
    %RMU-I-LOADERR, Error loading row 1.
    %RDB-E-CONVERT_ERROR, invalid or unsupported data conversion
    -COSI-F-IVTIME, invalid date or time
    %RMU-I-DATRECREAD,  2 data records read from input file.
    %RMU-I-DATRECSTO, 1 data records stored.
    %RMU-I-DATRECREJ, 1 data records rejected.
    $ !
    $ ! Type BAD.DAT to view the incorrect data record
    $ !
    $ TYPE BAD.DAT
    06-14-1991:12:14:14.14
    $ !
    $ ! Fetch the data record that stored successfully.
    $ !

    $ SQL
    SQL> ATTACH 'FILENAME MF_PERSONNEL.RDB';
    SQL> SELECT * FROM NEWTABLE;
     COL1
     1991-06-14:12:14:14.14
    1 rows selected

    Example 9

    Using the RMU Load command, you can load a table in a database by
    placing the fields in a different order in the database than they
    were in the input file.

    The jobs.unl file contains the following:

    000001000000000190001Rdb Demonstrator    DEMO

    The jobs.rrd file contains the following:

    DEFINE FIELD J_CODE   DATATYPE IS TEXT SIZE IS 4.
    DEFINE FIELD WAGE_CL  DATATYPE IS TEXT SIZE IS 1.
    DEFINE FIELD J_TITLE  DATATYPE IS TEXT SIZE IS 20.
    DEFINE FIELD MIN_SAL  DATATYPE IS TEXT SIZE 10.
    DEFINE FIELD MAX_SAL  DATATYPE IS TEXT SIZE 10.
    DEFINE RECORD JOBS.
       MIN_SAL.
       MAX_SAL.
       WAGE_CL.
       J_TITLE.
       J_CODE.
    END JOBS RECORD.

    The JOBS table has the following structure:

    Columns for table JOBS:
    Column Name                     Data Type        Domain
    -----------                     ---------        ------
    JOB_CODE                        CHAR(4)          JOB_CODE_DOM
    WAGE_CLASS                      CHAR(1)          WAGE_CLASS_DOM
    JOB_TITLE                       CHAR(20)         JOB_TITLE_DOM
    MINIMUM_SALARY                  INTEGER(2)       SALARY_DOM
    MAXIMUM_SALARY                  INTEGER(2)       SALARY_DOM

    Notice that:

    o  The ordering of the columns is different for the JOBS table in
       the database and in the input RMS file.

    o  The names in the .rrd file are also different from the names
       in the database.

    o  The data types of the salary fields are different (Oracle Rdb
       will do the conversion).

    To load the RMS file correctly, you must use the following
    command:

    $ RMU/LOAD MF_PERSONNEL JOBS JOBS/RMS=FILE=JOBS -
    _$ /FIELDS=(MINIMUM_SALARY,MAXIMUM_SALARY,WAGE_CLASS,JOB_TITLE, -
    _$ JOB_CODE)

    Notice that the Fields qualifier uses the names of the columns in
    the JOBS table (not the field names in the .rrd file), but in the
    order of the RMS file.

    The names in the .rrd file are immaterial. The purpose of the
    Fields qualifier is to load the first field in the RMS file into
    the MINIMUM_SALARY column of the JOBS table, load the second
    field in the RMS file into the MAXIMUM_SALARY column of the JOBS
    table, and so forth.

    The results:

 SQL> SELECT * FROM JOBS WHERE JOB_CODE = 'DEMO';

 JOB_CODE  WAGE_CLASS  JOB_TITLE          MINIMUM_SALARY   MAXIMUM_SALARY
 DEMO      1           Rdb Demonstrator   $10,000.00       $19,000.00

    Example 10

    The following example shows the sequence of steps used to sort
    a file into placement order by using the Place qualifier and the
    Place_Only option and then to load the file by using the Commit_
    Every qualifier:

    $ RMU/LOAD/PLACE -
    _$ /RECORD_DEFINITION=(FILE=NAMES.RRD,PLACE_ONLY=PLACED_NAMES) -
    _$ MF_PERSONNEL EMPLOYEES UNLOADED_NAMES.UNL

    $ RMU/LOAD/RECORD_DEFINITION=(FILE=NAMES.RRD) -
    _$ /COMMIT_EVERY=30 MF_PERSONNEL -
    _$ EMPLOYEES PLACED_NAMES.UNL
    %RMU-I-DATRECREAD,  100 data records read from input file.
    %RMU-I-DATRECSTO,   100 data records stored.

    Example 11

    The following example requests that statistics be displayed
    at a regular interval of every minute. It loads the data from
    the RMS file, names.unl, into the EMPLOYEES table of the mf_
    personnel database. The record structure of EMPLOYEES is in the
    file names.rrd. The names.rrd file was created by a previous RMU
    Unload command that unloaded data from a subset of columns in the
    EMPLOYEES table.

    $ RMU/LOAD/STATISTICS=(INTERVAL=60) -
    _$ /RECORD_DEFINITION=(FILE=NAMES) -
    _$ /FIELDS=(EMPLOYEE_ID, LAST_NAME) -
    _$ MF_PERSONNEL EMPLOYEES NAMES.UNL

    Example 12

    The following example uses the Exception_File option to the
    Record_Definition qualifier to tell Oracle RMU the name of
    the file to hold the exception records. Oracle RMU returns
    informational messages to alert you to any data records rejected.

    $ RMU/LOAD/FIELDS=(EMPLOYEE_ID, LAST_NAME) -
    _$ /RECORD_DEFINITION=(FILE=TEXT_NAMES,EXCEPTION_FILE=FILE.UNL) -
    _$ MF_PERSONNEL EMPLOYEES NAMES.UNL
    %RMU-I-LOADERR, Error loading row 1.
    %RDB-E-NO_DUP, index field value already exists; duplicates not
     allowed for EMPLOYEES_HASH
    %RMU-I-LOADERR, Error loading row 17.
    %RDB-E-NO_DUP, index field value already exists; duplicates not
     allowed for EMPLOYEES_HASH
    %RMU-I-LOADERR, Error loading row 33.
    %RDB-E-NO_DUP, index field value already exists; duplicates not
     allowed for EMPLOYEES_HASH
    %RMU-I-LOADERR, Error loading row 155.
    %RDB-E-NO_DUP, index field value already exists; duplicates not
     allowed for EMPLOYEES_HASH
    %RMU-I-DATRECREAD,  200 data records read from input file.
    %RMU-I-DATRECSTO,   196 data records stored.
    %RMU-I-DATRECREJ,   4 data records rejected.

    Example 13

    The following is an example of the format in which you can
    provide input data to the RMU Load command when you use the
    Format=Delimited_Text option with the Record_Definition
    qualifier. This is followed by the RMU Load command you use to
    load this data.

    "99997","ABUSHAKRA","CAROLINE","S","5 CIRCLE STREET","BOX 506",
    "CHELMSFORD", "MA", "02184", "1960061400000000"#
    "99996","BRADFORD","LEO","M","4 PLACE STREET","BOX 555",
    "NASHUA","NH", "03060", "1949051800000000"#

    $ RMU/LOAD/FIELDS=(EMPLOYEE_ID, LAST_NAME, FIRST_NAME, -
    _$ MIDDLE_INITIAL, ADDRESS_DATA_1, ADDRESS_DATA_2,  -
    _$ CITY, STATE, POSTAL_CODE, BIRTHDAY) -
    _$ /RECORD_DEFINITION=(FILE= NAMES.RRD, -
    _$ FORMAT=DELIMITED_TEXT, -
    _$ TERMINATOR="#" ) -
    _$ MF_PERSONNEL EMPLOYEES NAMES.UNL
    %RMU-I-DATRECREAD,  2 data records read from input file.
    %RMU-I-DATRECSTO,   2 data records stored.

    Example 14

    The following is an example of the format in which you must
    provide input data to the RMU Load command when you specify the
    Format=Text option with the Record_Definition qualifier. This is
    followed by the RMU Load command you use to load this data.

    09166Watts         Leora     F
    09190Margolis      David     M
    09187McDonald      Lois      F

    $ RMU/LOAD/FIELDS=(EMPLOYEE_ID, LAST_NAME, FIRST_NAME, SEX) -
    _$ /RECORD_DEFINITION=(FILE=TEXT_NAMES.RRD, FORMAT=TEXT) -
    _$ MF_PERSONNEL EMPLOYEES NAMES.UNL
    %RMU-I-DATRECREAD,  3 data records read from input file.
    %RMU-I-DATRECSTO,   3 data records stored.
Close Help