Oracle Data Import Export imp / exp

2010-03-29  来源:本站原创  分类:Java  人气:442 

Oracle Data Import Export imp / exp

Function: Oracle Data Import Export imp / exp is quite with the oracle data restore and backup.
Most cases can be completed with the Oracle data import and export of data backup and restore (does not cause data loss).

Oracle has its advantages, though your computer is not a server, but you installed the oracle client, and establish the connection (through net8 assistant in a local - "Service to add the correct service name you can think of actually naming the client and the server end of repair of the road, and then the data can be pulled back all)
This allows you to export the data to a local, although it may be a server far away from you.
You can also put dmp files into the distance from the local database server.
To use this feature you can build both of the same database, one for testing, one for official use.

Implementation of the environment: you can SQLPLUS.EXE or DOS (command line) in the implementation,
DOS can be executed in due to oracle 8i installation directory \ ora81 \ BIN is set to the global path,
The directory under EXP.EXE with IMP.EXE files are used to implement import and export.
oracle using java write, I would like to SQLPLUS.EXE, EXP.EXE, IMP.EXE Zheliang files are packaged class files.
SQLPLUS.EXE call EXP.EXE, IMP.EXE they wrapped the class to complete import and export capabilities.

Here is an instance of import and export, to import and export to see examples of essentially complete, because the import and export is very simple.
Data Export:
TEST total export a database, username, password manager export system to D: \ daochu.dmp in the
exp system / manager @ TEST file = d: \ daochu.dmp full = y
2 will be in the database system user and the sys user to export the table
exp system / manager @ TEST file = d: \ daochu.dmp owner = (system, sys)
3 will be in the database tables table1, table2 Export
exp system / manager @ TEST file = d: \ daochu.dmp tables = (table1, table2)
4 will be in the database table table1 in the field filed1 to "00" starts with the data derived
exp system / manager @ TEST file = d: \ daochu.dmp tables = (table1) query = \ "where filed1 like '00% '\"

The above is commonly used to export, I do not care for the compression, use winzip to dmp files can be a very good compression.
However, in the above command followed by compress = y can be a

Data Import
1 will be D: \ daochu.dmp data into TEST database.
imp system / manager @ TEST file = d: \ daochu.dmp
The above may be a bit problem, because some of the table already exists, then it Baocuo, the table can not be imported.
Followed by the ignore = y on it.
2 will be d: \ daochu.dmp table table1 into
imp system / manager @ TEST file = d: \ daochu.dmp tables = (table1)

Basically, the above import and export enough. A lot of cases I was to completely remove the table, and then import.

Note: Remote export data need to configure a remote data connection to this machine instance E: \ app \ Administrator \ product \ 11.1.0 \ db_1 \ NETWORK \ ADMIN folder have a tnsnames.ora file in which to add

Instance Name: whuorcl =
(ADDRESS_LIST = connect ip port
) Remote Instance Name