OracleDatabaseImp/exp commandThe usage is what we will introduce in this article. Next we will introduce these content through examples. For example, export table 1, table 2, and table 3 in Database Service abc, user, and password psd to the Directory d: \ data, and export the file name to test. dmp. The statement is:
- exp user/psd@adc file=d:\data\test.dmp tables=(table1,table2,table3) 。
The restore statement for the above files is:
- exp user/psd@adc full=y file=d:\data\test.dmp.
Note: If you restore all tables in the backup file, you must add full = y. If you only need to restore table 1, the statement is:
- exp user/psd@adc file=d:\data\test.dmp tables=table1。
That is, you must specify the information to be imported, or all or part of the table.
The following is an excerpt from others' experience.
Execution Environment: In SQLPLUS. EXE or doscommand Line). When DOS is executed, the \ ora81 \ BIN directory in oracle 8i is set to a global path, and EXP exists in this directory. EXE and IMP. the EXE file is used for import and export.
Oracle is written in java. SQLPLUS. EXE, EXP. EXE, and IMP. EXE files may be packaged class files.
SQLPLUS. EXE calls the classes encapsulated by EXP. EXE and IMP. EXE to complete the Import and Export function.
The following describes the Import and Export instances.
Data export:
1. Export the database TEST completely. The username "system Password manager" is exported to exp system/manager @ TEST file = D: \ daochu. dmp in d: \ daochu. dmp full = y
2. Export the tables of system users and sys users in the database
Exp system/manager @ TEST file = d: \ daochu. dmp owner = (system, sys)
3. Export the inner_policy and policy_staff_relat tables in the database.
Exp aichannel/aichannel @ TESTDB2 file = d: \ data \ newsmgnt. dmp tables = (inner_policy, policy_staff_relat)
4. Export the data with the field filed1 in table 1 in the database starting with "00"
Exp system/manager @ TEST file = d: \ daochu. dmp tables = (table1) query = \ "where filed1 like '201312 '\"
The above is a commonly used export. For compression, you can use winzip to compress the dmp file.
You can also add compress = y to the command above.
Data Import:
1. import data from D: \ daochu. dmp to the TEST database.
Imp system/manager @ TEST file = d: \ daochu. dmp imp aichannel/aichannel @ HUST full = y file = d: \ data \ newsmgnt. dmp ignore = y may be faulty because some tables already exist and an error is reported.
Add ignore = y to the end.
2. Import table 1 in d: \ daochu. dmp to imp system/manager @ TEST file = d: \ daochu. dmp tables = (table1)
The preceding import and export operations are sufficient. In many cases, you must first completely delete the table and then import it.
Note:
If the operator has sufficient permissions, a prompt is displayed.
Databases can be connected. You can use tnsping TEST to obtain whether the database TEST can be connected.
Appendix 1: grant users the permission to import data
First, start SQL * puls. Second, log on to system/manager. Third, create user username IDENTIFIED BY. If you have already created a user, skip this step)
Fourth, grant create user, drop user, alter user, create any view, drop any view, EXP_FULL_DATABASE, IMP_FULL_DATABASE, DBA, CONNECT, RESOURCE, create session to username, run-cmd-Enter the directory where the dmp file is located. imp userid = system/manager full = y file = *. dmp or imp userid = system/manager full = y file = filename. dmp
Example:
F: \ Work \ Oracle_Data \ backup> imp userid = test/test full = y file = inner_policy.dmp
Screen Display
Import: Release 8.1.7.0.0-Production on Thursday February 16 16:50:05 2006 (c) Copyright 2000 Oracle Corporation. All rights reserved.
Connect to: Oracle8i Enterprise Edition Release 8.1.7.0.0-Production
With the Partitioning option
JServer Release 8.1.7.0.0-Production
EXPORT the files created by EXPORT: V08.01.07 in the normal path.
The ZHS16GBK Character Set and ZHS16GBK NCHAR character set have been imported.
The export server uses the UTF8 NCHAR character set (possible ncharset conversion ).
Importing AICHANNEL objects to AICHANNEL... importing table "inner_policy" 4 rows. Importing preparation to enable constraints... the import is terminated successfully, but a warning is displayed.
Appendix 2: Oracle does not allow direct change of the table owner. Export/Import can be used for this purpose.
Create import9.par first, and then run the following command in use: imp parfile =/filepath/import9.par example import9.par:
- FROMUSER = TGPMS
- TOUSER = TGPMS2 Note: Change the table owner from FROMUSER to TOUSER. Users of FROMUSER and TOUSER can be different)
- ROWS = Y
- INDEXES = Y
- GRANTS = Y
- CONSTRAINTS = Y
- Buffer= 409600
- File =/backup/ctgpc_20030623.dmp log =/backup/import_20030623.log
The usage of the Oracle database imp/exp command is described here. I hope this introduction will be helpful to you!
Source: http://www.examda.com/oracle/zhonghe/20091110/103900415-2.html.