Introduction to Computer Science -...

17
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Introduction to Computer Science Transferring Schema and Data in APEX These instructions detail the steps required to transfer a schema in one APEX instance to another. The order in which the steps must be completed for success are described below: Steps: 1. Backup Schema objects to a Script (From original Schema) In this step you will create a Script file containing all of the Schema Objects including the Object Types: o Function, Index, Package, Procedure, Sequence, Synonym, Table, Trigger, View, Database Link, Type, and Materialized View. This can be done using one or several scripts depending on the size of your schema however it is recommended to be completed using one Script. 2. Export Script to Local Storage (From original Schema) In this step you will export the created script from Step 1 to local storage. 3. Backup Table Data (From original Schema) In this step you will backup and save the associated Table data from the Schema exported in Step 2. This step (Step 3) must be repeated for each Table in the exported Schema. 4. Import Script from Local Storage to new Schema In this step you will import the exported script from Step 2 to local storage. 5. Run imported Script in new Schema In this step, you will run the imported script from Step 4 to the new APEX Instance. 6. Restore Table Data in new Schema In this step you load the backed up and saved Table data from Step 3 to the new APEX Instance. This step (Step 6) must be repeated for each Table in the imported Schema. www.oracle.com/academy

Transcript of Introduction to Computer Science -...

Page 1: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Introduction to Computer Science

Transferring Schema and Data in APEX

These instructions detail the steps required to transfer a schema in one APEX instance to another. The order in which the steps must

be completed for success are described below:

Steps:

1. Backup Schema objects to a Script (From original Schema)

In this step you will create a Script file containing all of the Schema Objects including the Object Types:

o Function, Index, Package, Procedure, Sequence, Synonym, Table, Trigger, View, Database Link, Type, and

Materialized View.

This can be done using one or several scripts depending on the size of your schema however it is recommended

to be completed using one Script.

2. Export Script to Local Storage (From original Schema)

In this step you will export the created script from Step 1 to local storage.

3. Backup Table Data (From original Schema)

In this step you will backup and save the associated Table data from the Schema exported in Step 2. This step

(Step 3) must be repeated for each Table in the exported Schema.

4. Import Script from Local Storage to new Schema

In this step you will import the exported script from Step 2 to local storage.

5. Run imported Script in new Schema

In this step, you will run the imported script from Step 4 to the new APEX Instance.

6. Restore Table Data in new Schema

In this step you load the backed up and saved Table data from Step 3 to the new APEX Instance. This step (Step

6) must be repeated for each Table in the imported Schema.

www.oracle.com/academy

Page 2: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Step 1: Backup Schema objects to a Script (from Original Schema)

1. After log in to APEX, select "SQL Workshop."

2. Select "Utilities."

3. Select "Generate DDL."

4. Select "Create Script."

Page 3: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

5. Select the Schema name from the drop down list, and then click "Next."

6. Select the "Check All" check box, the "Save As Script File" radio button, and then click "Next."

7. Select the "Check All" check box, the "Save As Script File" radio button, and then click "Generate DDL."

Page 4: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

8. Give an appropriate name for the Script Name, optionally enter an appropriate Description, and then click

"Create Script."

This step will take a few minutes, depending upon the size of your Schema. Once completed, you will be forwarded to

SQL Scripts within SQL Workshop. You should see the newly created Script in the list, and a Success Message.

Step 2: Export Script to Local Storage (from Original Schema) Once the Script has been successfully created, export it to local storage for importing to another APEX Instance.

1. Select "SQL Workshop."

Page 5: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

2. Select "SQL Scripts."

3. Select "Export" from the Tasks list.

4. Select the Script Owner from the Owner drop down list, select the checkbox for the Script(s) you wish to Export,

and then click "Add to Export."

Page 6: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

5. The selected Script(s) will be added to the "Scripts to Export" list. When you have added all of the scripts you

wish to Export, you can name your Script (in the "File Name" textbox) with a .sql file extension, or accept the

pre-populated default name, and then click "Export All."

6. You will be presented with a File Download dialog. Click Save and navigate to a local storage location on your

computer or external drive.

Page 7: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

7. Once successfully exported, you will receive a "Download Complete" success message.

Step 3: Backup Table Data (from Original Schema)

1. Select "SQL Workshop."

2. Select "Utilities."

Page 8: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

3. Select "Data Workshop."

4. Select "to Text" from "Data Unload."

5. Select the Schema name where the table resides from the Schema drop down List. Select the Table name from

the Table drop down List. Select all of the Columns from the Columns list - once populated (use Shift + Click to

select all columns). Click "Next. "

Page 9: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Example:

6. Select the "Include Column Names" check box, then click "Unload Data."

7. You will be presented with a File Download dialog. Click Save and navigate to a local storage location on your

computer or external drive.

Page 10: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Step 4: Import Script from Local Storage to new Schema Once the Script has been successfully created, export it to local storage for importing to another Schema or APEX

Instance.

1. Select "SQL Workshop" from the new Schema or APEX instance.

2. Select "SQL Scripts."

3. Select "Import" from the Tasks list.

Page 11: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

4. Browse to the stored Script on local storage, and then select the file. Return to the Import Scripts dialog and

click "Next."

5. You will be asked to confirm the import, click "Import Script(s)."

Once completed, you will be forwarded to SQL Scripts within SQL Workshop. You should see the newly imported Script

in the list, and a Success Message.

Page 12: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

Step 5: Run imported Script (in New Schema) To complete the transfer, you must now run the imported Script(s).

1. Select "SQL Workshop."

2. Select "SQL Scripts."

3. Click "Run" beside the name of the Script you wish to run.

Page 13: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

4. You will be asked to confirm running the Script, click "Run Now." (You also have the option to run in the

background for larger Scripts.)

5. Once completed you will be forwarded to "Manage Script Results" within SQL Scripts where you will see the

new script, and can check the results.

Page 14: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

6. To check the results of the script for success or otherwise, click "View Results." Your results should be similar to

the example below.

Step 6: Restore Table Data (in New Schema) To complete the transfer of table data you must now load the saved data.

1. Select "SQL Workshop."

2. Select "Utilities."

Page 15: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

3. Select "Data Workshop."

4. Select "Text Data" from "Data Load."

Page 16: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

5. Select the "Existing Table" radio button, the "Upload file" radio button, and then click "Next."

6. Select the Table Owner (Schema where the Table exists). Select the Table Name (where the data is to be

loaded), and then click "Next."

7. Browse to the stored file containing the Data Backup on local storage, and then select the file. Return to the

Load Data dialog, and click "Next."

Page 17: Introduction to Computer Science - Oracleilearningcontent.oracle.com/.../ICS_APEX_Transfer_Schema_and_Data_v1.pdfCopyright © 2014, Oracle and/or its affiliates. All rights reserved.

Copyright © 2014, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

8. Confirm that the selected file is mapping correctly to the table columns, and then click "Load Data."

Once completed, you will be forwarded to Text Data Load Repository within Data Workshop where you will see the

newly imported file, and can check the results.