Oracle's EXP/IMP command is used to implement export/import operations on the database;
The EXP command is used to export data from the remote database server to the local, generating DMP files;
The IMP command is used to import local database dmp files from the local to the remote Oracle database.
Data export:
By entering the EXP command and username/password, you can then answer the username/password command:
Routines: Exp Scott/tiger or, you can also control the export by entering the EXP command with various parameters
According to different parameters. To specify a parameter, you can use the keyword:
Format: EXP keyword=value or keyword= (value1,value2,..., Valuen)
Routines: EXP scott/tiger grants=y tables= (emp,dept,mgr) or tables= (T1:P1,T1:P2) If T1 is a partitioned table
USERID must be the first parameter in the command line.
Example
1 completely export database test, user Name System Password Manager exported to D:daochu.dmp
| The code is as follows |
Copy Code |
Exp System/manager@test file=d:daochu.dmp full=y
|
2 Exporting a table from the system user in the database to the SYS user
| The code is as follows |
Copy Code |
Exp system/manager@test file=d:daochu.dmp owner= (System,sys)
|
3 Export the table table1, table2 in the database
| The code is as follows |
Copy Code |
Exp system/manager@test file=d:daochu.dmp tables= (table1,table2)
|
4 Export the fields in the table table1 in the database filed1 with the data beginning with "00"
| The code is as follows |
Copy Code |
Exp system/manager@test file=d:daochu.dmp tables= (table1) query= "where filed1 like ' 0% '"
|
The above is commonly used for export, for compression I do not care, with WinZip DMP file can be very good compression, but in the above command after the addition of compress=y can be
Import of data
Routines: Imp Scott/tiger Alternatively, you can control import by entering IMP commands and various parameters
According to different parameters. To specify a parameter, you can use the keyword:
Format: IMP keyword=value or keyword= (value1,value2,..., Vlauen)
Routine: IMP scott/tiger ignore=y tables= (emp,dept) full=n
1 Import the data from D:DAOCHU.DMP into the test database.
| The code is as follows |
Copy Code |
Imp system/manager@test file=d:daochu.dmp
|
There may be something wrong with it, because some tables already exist, and then it complains, and the table is not imported.
Just add ignore=y to the back.
2 Import the table table1 in D:daochu.dmp
| The code is as follows |
Copy Code |
Imp system/manager@test file=d:daochu.dmp tables= (table1)
|
Basically, the import export above is sufficient. In a lot of cases I was completely removed from the table and then imported