Use PLSQL to import and export Databases

Source: Internet
Author: User
Tags how to use sql import database

This document describes how to use SQL scripts and PL/SQL Developer tools to create tablespaces, create databases, back up databases, export data, and perform Oracle object creation, data import, and other operations, this helps us quickly understand and create the required deployment SQL scripts and database operations. Www.2cto.com 1. Prepare the database creation script [SQL] create tablespace whc_tbs datafile 'e: \ oracle \ oradata \ whcdb \ whc. dbf 'size 100 M; -- drop tablespace whc_tbs including contents and datafiles cascade constraints; create user whc identified by whc default tablespace whc_tbs; grant connect, resource to whc; grant dba to whc; -- Revoke dba from whc; www.2cto.com where the -- Comment statement deletes the namespace and removes the permissions of the DBA user. These scripts are used to create a tablespace and an Oracle database. E: \ oracle \ oradata \ whcdb \ whc. the dbf path is the location where we want to store database data. Therefore, make sure that the path has sufficient space and access permissions. Otherwise, the path will fail. 2. Export database Objects. In the menu Tools => Export User Objects of PL/SQL Developer, a dialog box is displayed. Then, select the Oracle database Objects to be displayed, including tables and sequences, stored Procedures, views, functions, and so on, and specify the name of the exported file. 3. After exporting the table structure and other objects, the next step is to export the table data of the database. The PL/SQL Developer tool supports exporting data to the PL/SQL database script, as shown below. The exported script can be imported in PL/SQL Developer or by using SQL plus. So far, we have completed three scripts, including creating database space and database scripts, creating Oracle database objects (tables, stored procedures, views, sequences, etc) create a script to import data. The last step is how to import database objects and data. 4. You can use the Import Tables operation to Import database objects and data. We specify the database script created in the preceding two steps, then you can create database objects and database data in the new environment. As shown below. The executed data interface is as follows. After completing the above steps, we have everything in the new database environment, and successfully completed the migration of the entire Oracle database object and data.
It is worth noting that when we export Oracle Objects and data above www.2cto.com, The tablespace and Database User Name of the original Oracle database are by default, if we want to specify different tablespace and database user objects in the new database server, we need to replace the generated SQL script and specify a reasonable tablespace and database user in the first step. If it is a database server on the Linux platform, the first step is similar, that is, the path name of the specified tablespace is slightly different, and other operations are not different.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.