Previous |
Next |
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:
If you have not done so, create the directory C:\my_exports
.
In the SQL Developer window, click the menu Tools.
A drop-down menu appears.
From drop-down menu, select Database Export.
The Source/Destination window opens.
In the Source/Destination window:
In the File field, type: C:\my_exports\2day_tables.sql
.
From the Connections drop-down menu, select hr_conn.
Accept the default DDL Options, Terminator and Pretty Print.
Click Next.
The Types to Export window appears.
In the Types to Export window:
Deselect all check boxes except Tables, Sequences, Indexes, Constraints, and Triggers.
Click Next.
The Specify Objects window appears.
In the Specify Objects window:
In the drop-down menu with the value HR
, accept that value.
In the drop-down menu with the value All
, select the value TABLE.
Click Go.
A list of the tables in schema HR
appears.
Select HR.PERFORMANCE_PARTS, HR.EVALUATIONS, HR.SCORES, and HR.EVALUATIONS_LOG.
Click >.
The selected tables move from the original column to the other column.
In the drop-down menu with the value TABLE
, select the value SEQUENCE.
Click Go.
A list of the sequences in schema HR
appears.
Select HR.EVALUATIONS_SEQ.
Click >.
HR
.EVALUATIONS_SEQ
moves from the original column to the other column.
(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.
Click Next.
The Export Summary window appears.
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
.
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.