Database import and export exp, imp

Database import and export are divided into: full database export, with a system administrator, individual user table export table Export (Export table required)

Most cases can be used Oracle data import and export complete backup and restore data (not cause loss of data).
Oracle has the advantage, though your computer is not a server, but you installed the oracle client, and the connection is established
(add the correct service name by Net Configuration Assistant, in fact, you may want to be the client and server-side repair of the road, then the data can be pulled up)
so that you can export the data to a local, although it may be a server far away from you.
You can also import the dmp file from the local to the database server in the distance.
You can use this feature to build two identical databases, one for testing, one for official use.

Execution environment: SQLPLUS.EXE may or DOS (command line) is performed,
the DOS directory due oracle 8i mounted in $ ora10g \ BIN is set to the global path can be performed,
there are the directory EXP.EXE with IMP.EXE file is used to perform import and export.
oracle using java, I think SQLPLUS.EXE, EXP.EXE, IMP.EXE maybe file is the class file is the packaging.
SQLPLUS.EXE call EXP.EXE, IMP.EXE they are wrapped in class to complete import and export functions.

Here are examples of the import and export, import and export to see the examples can be substantially complete, because the simple import and export.
Export Data:
1 TEST database full, user name, password manager system to export to D: \ daochu.dmp in
exp system / manager @ TEST File = D: \ Y daochu.dmp the Full =
2, the database system user and user sys export table
exp System / File Manager @ the TEST = D: \ = daochu.dmp the owner (System, SYS)
. 3 the database tables table1, table2 derived
exp system / manager @ TEST file = d: \ daochu.dmp tables = (table1, table2)
field filed1 4 in the database tables in table1 data "00" starts derived
exp system / manager @ TEST file = d: \ daochu.dmp tables = (table1) query = "where filed1 like ' 00% ''

 上面是常用的导出,对于压缩我不太在意,用winzip把dmp文件可以很好的压缩。
                 不过在上面命令后面 加上 compress=y  就可以了

Imported data
1 D: \ daochu.dmp the data into the TEST database.
imp system / manager @ TEST file = d: \ daochu.dmp
above might be a little problem, because some tables already exist, then it will error, the table will not be imported.
Followed by the ignore = y on it.
2 d: \ daochu.dmp in table table1 introduced
imp system / manager @ TEST file = d: \ daochu.dmp tables = (table1)

Substantially above import and export enough. I will table a number of cases completely remove, and then import.

Note:
You must have sufficient permissions, the permissions it will prompt you enough.
You can connect to the database. You can tnsping TEST TEST able to get the database even.

数据导出:
exp hkb/hkb@boss_14 full=y file=c:\orabackup\hkbfull.dmp log=c:\orabackup\hkbfull.log;

Matters Export Note: The exported data is the current user, and if the current user has permission to DBA, then export all the data!

Import data between users of the same name:
IMP HKB / HKB @ XE File = C: \ orabackup \ hkbfull.dmp log = C: \ orabackup \ Y = Full hkbimp.log

Import data between different name:
IMP System / Test @ XE = FROMUSER HKB TOUSER = hkb_new File = C: \ orabackup \ hkbfull.dmp

log=c:\orabackup\hkbimp.log;

Guess you like

Origin blog.csdn.net/weixin_43671743/article/details/89485641