Your browser does not support JavaScript. This help page requires JavaScript to render correctly. Tutorial: Creating an Installation Script File for the Sequence and Tables
Skip Headers
Previous
Previous
 
Next
Next

Tutorial: Creating an Installation Script File for the Sequence and Tables

This tutorial shows how to use the SQL Developer tool Database Export to create an installation script file for the tables and sequence of the sample application, including the constraints, indexes, and triggers associated with the tables.

Note: In the following procedure, you might have to enlarge the SQL Developer windows to see all fields and options.

To create an installation script file for the tables and sequence:

  1. If you have not done so, create the directory C:\my_exports.

  2. In the SQL Developer window, click the menu Tools.

    A drop-down menu appears.

  3. From drop-down menu, select Database Export.

    The Source/Destination window opens.

  4. In the Source/Destination window:

    1. In the File field, type: C:\my_exports\2day_tables.sql.

    2. From the Connections drop-down menu, select hr_conn.

    3. Accept the default DDL Options, Terminator and Pretty Print.

    4. Click Next.

    The Types to Export window appears.

  5. In the Types to Export window:

    1. Deselect all check boxes except Tables, Sequences, Indexes, Constraints, and Triggers.

    2. Click Next.

    The Specify Objects window appears.

  6. In the Specify Objects window:

    1. In the drop-down menu with the value HR, accept that value.

    2. In the drop-down menu with the value All, select the value TABLE.

    3. Click Go.

      A list of the tables in schema HR appears.

    4. Select HR.PERFORMANCE_PARTS, HR.EVALUATIONS, HR.SCORES, and HR.EVALUATIONS_LOG.

    5. Click >.

      The selected tables move from the original column to the other column.

    6. In the drop-down menu with the value TABLE, select the value SEQUENCE.

    7. Click Go.

      A list of the sequences in schema HR appears.

    8. Select HR.EVALUATIONS_SEQ.

    9. Click >.

      HR.EVALUATIONS_SEQ moves from the original column to the other column.

    10. (Optional) In the drop-down menu with the value SEQUENCE, select the value All.

      HR.PERFORMANCE_PARTS, HR.EVALUATIONS, HR.SCORES, HR.EVALUATIONS_LOG and HR.EVALUATIONS_SEQ show.

    11. Click Next.

    The Export Summary window appears.

  7. In the Export Summary window, click Finish.

    The Exporting window opens, showing that exporting is occurring. When exporting is complete, the Exporting window closes, and the SQL Worksheet shows the contents of the file C:\my_exports\2day_tables.sql.

  8. In the installation script file, C:\my_exports\2day_tables.sql, check that referenced objects are created before their dependent objects:

    • The sequence EVALUATIONS_SEQ must be created before the table EVALUATIONS, because EVALUATIONS has a trigger, NEW_EVALUATION_TRIGGER, that uses EVALUATIONS_SEQ.

    • The table EVALUATIONS_LOG must be created before the table EVALUATIONS, because EVALUATIONS has a trigger, EVAL_CHANGE_TRIGGER, that uses EVALUATIONS_LOG.

    • The tables EVALUATIONS and PERFORMANCE_PARTS must be created before the table SCORES, because SCORES has foreign keys to both EVALUATIONS and PERFORMANCE_PARTS.

    If necessary, edit the file in the SQL Worksheet or any text editor.

Related Topics

Creating Tables

Tutorial: Creating a Sequence

Creating an Installation Script File with SQL Developer

Creating Installation Script Files