A detailed explanation of the use of Exp,imp in Oracle
Basic syntax and examples:
1. 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
This allows all objects that the user sonic to be exported to a file.
3. Table mode:
EXP sonic/sonic buffer=64000 file=c:\sonic. DMP owner=sonic tables= (SONIC)
This way the user Sonic table Sonic is exported
2. IMP:
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
This allows all objects sonic by the user to be 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)
This way 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_csd_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_yyyymmdd.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