Import and Export

Oracle data import and export imp/exp 

Function: Oracle data import and export imp/exp is equivalent to oracle data restore and backup.

 

Can be executed in SQLPLUS.EXE or DOS (command line)

 

Data output: 

1 Completely export the database TEST, and export the username system password manager to D:\daochu.dmp

Cmd code  

exp system/manager@TEST file=d:\daochu.dmp full=y  

 

 

2 Export the tables of the system user and sys user in the database

Cmd code  

exp system/manager@TEST file=d:\daochu.dmp owner=(system,sys)  

 

 

3 Export the tables table1 and table2 in the database

Cmd code  

exp system/manager@TEST file=d:\daochu.dmp tables=(table1,table2)   

 

4 Export the data starting with "00" in the field filed1 in the table table1 in the database

Cmd code  

exp system/manager@TEST file=d:\daochu.dmp tables=(table1) query=\" where filed1 like  '00%'\"  

 

Add compress=y after the above command to output the compressed data

 

data import

1 Import the data in D:\daochu.dmp into the TEST database.

Cmd code  

imp system/manager@TEST  file=d:\daochu.dmp  

   There may be a problem with the above, because some tables already exist, and 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

Cmd code  

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.

 

Notice: 

1. You must have enough permissions, it will prompt you if the permissions are not enough.

 

2. It can be connected to the database. You can use tnsping TEST to get whether the database TEST can be connected.

 

3.

Cmd code  

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

  

Note on export: the data of the current user is exported. If the current user has DBA authority, all data will be exported!  

  

 

4. Data import between users with the same name:

Cmd code  

imp hkb/hkb@xe  file=c:\orabackup\hkbfull.dmp log=c:\orabackup\hkbimp.log full=y  

 

 

 

5. Data import between different names:

Cmd code  

imp system/test@xe fromuser=hkb touser=hkb_new file=c:\orabackup\hkbfull.dmp log=c:\orabackup\hkbimp.log;  

 

 

Guess you like

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