background image
<< Exporting the Data | Validating the Installation >>
<< Exporting the Data | Validating the Installation >>

Performing the Installation

Performing the Installation
Deploying a Database Application 7-11
To find and enable the constraints used in the
EVALUATIONS
,
PERFORMANCE_
PARTS
, and
SCORES
tables, enter the following statements into a SQL Worksheet
window:
SELECT 'ALTER TABLE '|| TABLE_NAME || ' DISABLE CONSTRAINT '||
CONSTRAINT_NAME ||';'
FROM user_constraints
WHERE table_name IN ('EVALUATIONS','PERFORMANCE_PARTS','SCORES');
SELECT 'ALTER TABLE '|| TABLE_NAME || ' ENABLE CONSTRAINT '||
CONSTRAINT_NAME ||';'
FROM user_constraints
WHERE table_name IN ('EVALUATIONS','PERFORMANCE_PARTS','SCORES');
If you followed the instructions in this guide, the only table to which you added data
was
performance_parts
. Use the Export DDL (and Data) feature to export data, but
this method outputs the DDL along with the data. You can also select a table from
within the tree under Connections in the Connections navigator, and then right-click
and select Export Data, and then
INSERT
. This option enables you to restrict your
export to just select columns and to include a
WHERE
clause to control which data is
exported. This is the method you will use.
To create INSERT statements for the data:
1.
In the Connections navigator in SQL Developer, expand the database connection
that you used for generating scripts (
hr_conn
) for the database objects.
2.
Expand Tables under the
hr_conn
connection.
3.
Right-click the PERFORMANCE_PARTS table name and select Export Data, and
then INSERT.
4.
In the Export dialog box, in the File field, enter
C:\my_exports\2day_
data.sql
to specify the export file name.
5.
Click Apply.
If you need to create
INSERT
statements for another table, rather than exporting the
data for the other tables to separate files, you can also export the data to the Clipboard
and then paste it into your first file. To do this, specify Clipboard for Output, which
causes the statements to be placed on the Clipboard, so that you can add them to a file.
Performing the Installation
At this stage, you now have all the script files necessary to create the objects in another
schema. These scripts must be executed in the following order (the order in which you
created them in this exercise), to ensure that the tables exist before you load the data:
1.
2day_tables.sql
2.
2day_plsql.sql
3.
2day_other.sql
4.
2day_data.sql
If you want, you can create a master script to execute these scripts in the proper order
and log the results to a file. This kind of master script is typically run using SQL*Plus.
The master script for this exercise looks like the following example:
spool my_dir/create_log.txt
@my_dir/2day_tables.sql
@my_dir/2day_plsql.sql