After you complete this method document, you should be able to understand:
- How to export data to various file formats using SQL Developer
- How to export an object definition in a schema
Directory
- 1. Introduction
- 2. Software Requirements
- 3. Exporting data
- 4. Export object Definitions
- 5. Other Resources
1. Introduction
Oracle SQL Developer provides utilities that you can use to export the object definitions in the schema and the data stored in those objects.
In this method document , we will export the data first and then export the object definition.
2. Software Requirements
- Oracle SQL Developer 1.0
- Oracle database 9.2.0.1 or later
- have access to the sample user account HR (see Step 2nd of the Oracle SQL Developer Guide)
3. Exporting data
SQL Developer can export user data into various formats: CSV, XML, LOADER, TEXT, and INSERT
1. |
To export data from a table, you can use SQL Worksheet and write SQL queries to retrieve the data you want (see Step 5th of the Oracle SQL Developer Guide), or click the Data tab of the table definition. We will use this method later. Expand the Connections Navigator and Tables nodes. Click Departments. Select the Data tab. |
2. |
Right-click anywhere in the data to invoke the context menu. Select INSERTfrom the EXPORT context menu. This will generate a file that contains the Insert statement. |
3. |
Select the appropriate directory and name the file. You can also fine-tune the exported content by selecting a column and adding a WHERE clause to reduce the number of records returned. In this case, we will accept all the default records and columns. |
4. |
Click Apply to create the file. |
5. |
View the files that were created. You can repeat these steps for each file format to observe the different formats provided. |
4. Export object Definitions
SQL Developer can export some or all of the object definitions to a script file. You can use these script files as backups of object definitions,
or run them in other modes. In this example, you will export 2 tables.
1. |
From the main menu, select Tools, Export. |
2. |
In the first tab, make sure that the directory and file name are provided. Note that you can choose to add the constraint inline, or use the constraint as the "Alter" TABLE command. |
3. |
Toggle the tab and select the desired object definition. I have chosen EMPLOYEES and departments. Click Apply. |
4. |
View the files that were created. |
5. Other Resources
- There are many SQL examples in the database documentation on OTN.
- This method document can be discussed in the OTN SQL Developer Forum.
How to export data using SQL Developer