A detailed explanation of the use of Exp,imp in Oracle

Source: Internet
Author: User

Basic syntax and examples:

I. EXP: There are three main ways (full, user, table)

1, Complete: EXP system/manager buffer=64000 file=c:\full. DMP full=y If you want to perform a full export, you must have special permissions

2, User mode: EXP sonic/sonic buffer=64000 file=c:\sonic. DMP Owner=sonic all Objects SONIC by the user are output to a file.

3, Table mode: EXP sonic/sonic buffer=64000 file=c:\sonic. DMP owner=sonic tables= (SONIC) the User SONIC table SONIC is exported

IMP: There are three modes (full, user, table)

1, Complete: IMP system/manager buffer=64000 file=c:\full. DMP full=y

2, User mode: IMP sonic/sonic buffer=64000 file=c:\sonic. DMP fromuser=sonic touser=sonic All Objects SONIC by the user are imported into the file. You must specify the Fromuser, touser parameter so that data can be imported.

3, Table mode: EXP sonic/sonic buffer=64000 file=c:\sonic. DMP owner=sonic tables= (SONIC) the User SONIC table SONIC is imported.

There are two types of backup methods for Oracle databases.

The first class is a physical backup, which implements a full database recovery, but the database must be run in the back-up mode (the business database runs in non-return mode) and requires a great deal of external storage devices such as a tape library, a second type of backup as a logical backup, a business database in this way, This method does not require that the database be run in the back-up mode, it is simple to backup, and can not require an external storage device.

Database Logical Backup method   

The logical backup of an Oracle database is divided into three modes: Table backup, user backup, and full backup.

Table mode

Backs up the specified object (table) in a user mode. The business database typically uses this backup method.

If you are backing up to a local file, use the following command:

Exp ICDMAIN/ICD rows=y indexes=n compress=n buffer=65536 feedback=100000 volsize=0 file=exp_icdmain_csd_yyyymmdd.dmp Log=exp_icdmain_csd_yyyymmdd.log Tables=icdmain.commoninformation,icdmain.serviceinfo,icdmain.dealinfo

If you are backing up to a tape device directly, use the following command:

Exp ICDMAIN/ICD rows=y indexes=n compress=n buffer=65536 feedback=100000 volsize=0 file=/dev/rmt0 Log=exp_icdmain_cs D_yyyymmdd.log Tables=icdmain.commoninformation,icdmain.serviceinfo,icdmain.dealinfo

Note: In case of disk space permitting, you should back up to the local server before copying to tape. For speed reasons, try not to back up directly to the tape device.

User mode

Backs up all objects in a user mode. The business database typically uses this backup method.

If you are backing up to a local file, use the following command:

Exp ICDMAIN/ICD owner=icdmain rows=y indexes=n compress=n buffer=65536 feedback=100000 volsize=0 file=exp_icdmain_yyyy Mmdd.dmp Log=exp_icdmain_yyyymmdd.log

If you are backing up to a tape device directly, use the following command:

Exp ICDMAIN/ICD owner=icdmain rows=y indexes=n compress=n buffer=65536 feedback=100000 volsize=0 file=/dev/rmt0 log= Exp_icdmain_yyyymmdd.log

Note: If the disk has space, it is recommended that you back up to disk and then copy to tape. If the amount of database data is small, this method can be used for backup.

  The following is a detailed import and export instance:

First, Data export:

1, the database test is fully exported, user Name System Password Manager exported to D:\daochu.dmp

Exp System/[email protected] file=d:\daochu.dmp full=y

2. Export the system user in the database and the SYS user's table

Exp System/[email protected] file=d:\daochu.dmp owner= (System,sys)

3. Export the table table1 and table2 in the database

Exp System/[email protected] file=d:\daochu.dmp tables= (table1,table2)

4. Export the field filed1 in table table1 in the database with the data beginning with "00"

Exp System/[email protected] file=d:\daochu.dmp tables= (table1) query=\ "where filed1 like ' 0% ' \"

The above is a common export, for compression I do not care, with WinZip to the DMP file can be very good compression.

But add compress=y to the upper order.

Second, the import of data

1. Import the data from the D:\DAOCHU.DMP into the test database.

Imp System/[email protected] File=d:\daochu.dmp

There may be a problem, because some tables already exist, and then it is an error, and the table is not imported.

Add Ignore=y to the back.

2 Import the table table1 in D:\daochu.dmp

Imp system/[email protected] file=d:\daochu.dmp tables= (table1)

Basically, the above import and export is enough. In many cases I have completely removed the table and then imported it.

Attention:

You need to have enough permissions, not enough permissions, and it will prompt you.

Database, you can connect to the. You can use tnsping test to get the database test to connect.

A detailed explanation of the use of Exp,imp in Oracle

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.