Oracle imports and exports data using IMPDP and EXPDP

Source: Internet
Author: User
Tags create directory

1. Exporting data

Before you start exporting data, create a directory, because you need to specify directory when you import, and the exported dump files and logs are saved in the directory corresponding to that directory

SQL> create directory dumpdir as ‘D:\ora\dump‘;

Dumpdir is the directory name, as specifies the local directory corresponding to the directory.

Here I import all the table data of the Shiot user

expdp shiot/123456 directory=dumpdir dumpfile=shiot.dump logfile=shiot.log

Note EXPDP is not executed under the SQL command line, where dumpfile specifies the exported dump file name, logfile specifies the log file name.

If you only need to export some of the table data for a Shiot user, you can specify which tables you want to export by using the tables parameter

expdp shiot/123456 directory=dumpdir dumpfile=shiot.dump logfile=shiot.log tables=test1,test2

Tables specify the table to be exported, there can be multiple, here I export test1 and test2 table

2. Import data

Using IMPDP to import data, be careful to place the dump file you want to import into the directory specified by directory.

Assuming that the imported user already exists, execute the following command to import the data

impdp shiot/123456 directory=dumpdir dumpfile=shiot.dump  table_exists_action=append   # table_exists_action指定表存在时的动作,append表示追加内容

If the table space is different when the data import is exported, you need to do a mapping

impdp shiot/123456 directory=dumpdir dumpfile=shiot.dump  table_exists_action=append remap_tablespace=iot_out:iot    #其中iot_out是导出数据时的表空间,iot是导入数据的表空间

Mapping is also required if the user who imported the export is different

impdp shiot/123456 directory=dumpdir dumpfile=shiot.dump  table_exists_action=append remap_schema=shiot_log:shiot   #其中shiot_log是导出用户,shiot是导入用户

Oracle imports and exports data using IMPDP and EXPDP

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.