Oracle Database migration tutorial in heterogeneous environments: Use of exp and imp, expdp and impdp, expdpimpdp

Source: Internet
Author: User

Oracle Database migration tutorial in heterogeneous environments: Use of exp and imp, expdp and impdp, expdpimpdp

Exp/imp can be used in the following scenarios

Transfer Data between two databases

1. versions of the same oracle database

2. Versions of different oracle databases

3. oracle databases between the same or different operating systems

Used for database backup and recovery

Transfer from one database user to another

Transfer from one tablespace to another

Create a tablespace

Create tablespace bank_tbs (Database tablespace) datafile '/oracle/test (data path) bank_data02.dbf (data file name) 'size 5 M autoextend on maxsize 10G;

Specify the tablespace when creating a user

Create user bankuser identified by bankpwd default tablespace bank_tbs;

Use export to export data

Exp bankuser/bankpwd file = '/backup/bankuser. dmp' log = '/backup/bankuserExp. log' format: exp user name/password file = export path and file name

Import data using import

Imp bankuser/bankpwd file =/backup/bankuser. dmp full = y pay attention to the following full = y, which means all imports, you can also specify the table name of a table

To achieve better results, we can first create a table with the bankuser user, then exp, and then go to sqlplus to delete the table. Finally, imp will find that the database has been restored.

If it is in a windows environment, it seems that you still need to add the @ Database Name and ORACLE_SID after the user name/Password

Use expdp to back up the database

Run the command in sqlplus and log on with sysdba because grant permission is involved.

Create or replace directory expdp_dir as '/home/oracle/expdp_dir ';

Grant read, write on directory to dbauser;

Exit sqlplus and go to the oracle Home Directory

Create a folder

Mkdir expdp_dir

Modify permissions

Chmod 777 expdp_dir

Export data

Expdp dbauser/123456 directory = expdp_dir (absolute path no longer needed here) dumpfile = backuptest. dmp logfile = backuptestlog. log

Import Data

Impdp dbauser/123456 directory = expdp_dir (absolute path no longer needed here) dumpfile = backuptest. dmp logfile = backuptestlog. log

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.