Detailed explanation of the use of exp and imp in oracle

Remote export:
exp username/password@IP address: 1521/instance name file=test.dmp log=test.log
The above statement is to export the data of the remote server. To
export the local database data, put the above statement "IP address" :1521/" can be removed.

Basic syntax and examples:
    1. EXP:
      There are three main ways (full, user, table)
      1. Full:
          EXP SYSTEM/MANAGER BUFFER=64000 FILE=C:\FULL.DMP FULL=Y
          If you want to perform a full export, you must With special permissions
      2. User mode:
          EXP SONIC/SONIC BUFFER=64000 FILE=C:\SONIC.DMP OWNER=SONIC
          All objects of user SONIC are output to the file.
      3. Table schema:
          EXP SONIC/SONIC BUFFER=64000 FILE=C:\SONIC.DMP OWNER=SONIC TABLES=(SONIC)
          so that user SONIC's table SONIC is exported
    2. IMP:
      has three modes (full, user, Table)
      1. Completely:
          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 of user SONIC is imported into the file. The FROMUSER and TOUSER parameters must be specified so that data can be imported.
      3. Table mode:
          EXP SONIC/SONIC BUFFER=64000 FILE=C:\SONIC.DMP OWNER=SONIC TABLES=(SONIC)
          In this way, the table SONIC of user SONIC will be imported.


There are two types of backup methods for the ORACLE database. The first type is physical backup, this method realizes the complete recovery of the database, but the database must run in archive mode (the business database runs in non-archive mode), and requires a huge external storage device, such as a tape library; The second type of backup method is logical backup. This method is used for business databases. This method does not require the database to run in archive mode. Not only is the backup simple, but also external storage devices are not required.
  
  Database logical backup method
  
  The logical backup of the ORACLE database is divided into three modes: table backup, user backup and full backup.
  
  Table mode
  
  Backs up objects (tables) specified in a user mode. Business databases usually use this backup method.
  
  To back 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 device, 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: If disk space allows, you should back up to the local server first, and then copy to tape. For speed reasons, try not to back up directly to tape devices.
  
  User Mode
  
  Backs up all objects in a user mode. Business databases usually use this backup method.
  To back 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
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 to back it up to the disk, and then copy it to the tape. If the amount of database data is small, this method can be used for backup.



  The following is a detailed import and export example:

  1. Data export:

  1. Completely export the database TEST, export the user name system password manager to D:\daochu.dmp
  exp system/manager@TEST file=d:\daochu.dmp full =y

  2. Export the table of system user and sys user in the database
  exp system/manager@TEST file=d:\daochu.dmp owner=(system, sys)

  3. Export the tables table1 and table2 in the database
  exp system/manager@TEST file=d:\daochu.dmp tables=(table1, table2)

  4. The field filed1 in the table table1 in the database starts with "00" Data export
  exp system/manager@TEST file=d:\daochu.dmp tables=(table1) query=\" where filed1 like '00%'\"The
  above is a commonly used export, I don't care much about compression, use winzip to dmp files can be compressed well.
  But just add compress=y after the above command.

  2. Data import

  1. Import the data in D:\daochu.dmp into the TEST database.
  imp system/manager@TEST file=d:\daochu.dmp
  may have some problems, because some tables already exist, then it will report an error, and the table will not be imported.
  Just add ignore=y after it.

  2 Import the table table1 in d:\daochu.dmp into
  imp system/manager@TEST file=d:\daochu.dmp tables=(table1)
  Basically, the above import and export is enough. In many cases, I completely delete the table and then import it.

  Note:
  You must have sufficient permissions, it will prompt you if the permissions are not enough.
  can be connected to the database. You can use tnsping TEST to get whether the database TEST can be connected.

    All parameters of EXP (default values ​​of parameters in parentheses):

USERID username/password such as: USERID=duanl/duanl     

FULL export the entire database (N)

BUFFER data buffer size        

OWNER owner username list, which one do you want to export For user objects, use owner=username

FILE to output the file (EXPDAT.DMP)   

TABLES table name list, specify the name of the table to be exported, such as: TABLES=table1,table2

COMPRESS Import an extent (Y)  

RECORDLENGTH IO record length

GRANTS Export permissions (Y)           

INCTYPE Incremental export type

INDEXES Export index (Y)          

RECORD Track incremental export (Y)

ROWS Export data row (Y)       

PARFILE Parameter file name, if you have a lot of exp parameters, you can save it as a parameter file.

CONSTRAINTS Export constraints (Y)   

CONSISTENT Cross-tab consistency

LOG Screen output log file   

STATISTICS Analysis object (ESTIMATE)

DIRECT Direct path (N)             

TRIGGERS Export trigger (Y)

FEEDBACK Show progress every x rows (0)

FILESIZE Maximum size of each dump file

QUERY SELECT A clause that defines a subset of exported tables. The

following keywords are used only for transportable tablespaces.

TRANSPORT_TABLESPACE Exports transportable tablespace metadata (N)

TABLESPACES List of tablespaces to be transported

. ):

USERID username/password          

FULL import the entire file (N)

BUFFER data buffer size        

FROMUSER all user name list

FILE input file (EXPDAT.DMP)   

TOUSER user name list

SHOW only list file content (N)

TABLES table name list

IGNORE ignore creation errors (N)   

RECORDLENGTH IO record length

GRANTS import authority (Y)         

INCTYPE incremental import type

INDEXES import index (Y)         

COMMIT commit array insert (N)

ROWS import data row (Y)      

PARFILE parameter file name

LOG log file for screen output  

CONSTRAINTS import limit ( Y)

DESTROY Overwrite tablespace data files (N)

INDEXFILE Write table/index information to specified file

SKIP_UNUSABLE_INDEXES Skip maintenance of unavailable indexes (N)

ANALYZE Execute ANALYZE statement in dump file (Y)

FEEDBACK Display every x rows (0) Progress

TOID_NOVALIDATE Skip checksum for specified type id

FILESIZE Maximum size of each dump file

RECALCULATE_STATISTICS Recalculate statistics (N)

The following keywords are only used for transportable tablespaces

TRANSPORT_TABLESPACE Import transportable tablespace metadata (N)

TABLESPACES tablespaces

to be transferred to the database DATAFILES data files to be transferred to the database

TTS_OWNERS User who owns the data in the transportable tablespace set

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326644562&siteId=291194637