Oracle Database Import and Export commands

Source: Internet
Author: User

Oracle Data Import and Export imp/exp function: Oracle Data Import and Export imp/exp is equivalent to oracle data restoration and backup. In most cases, you can use Oracle data import and export to back up and restore data (without causing data loss ). Oracle has a benefit. Although your computer is not a server, you have installed an oracle client and established a connection (add the correct service name through Net Configuration Assistant, in fact, you can think of a path between the client and the server, and then the data can be pulled.) in this way, you can export the data locally, although the server may be far away from you. You can also import the dmp file locally to a database server in a distance. With this function, you can build two identical databases, one for testing and the other for formal use. Execution Environment: In SQLPLUS. execute in EXE or DOS (command line). When DOS can be executed, because the installation directory \ $ ora10g \ BIN in oracle 8i is set to a global path, this directory contains EXP. EXE and IMP. the EXE file is used for import and export. Oracle is written in java. I think the SQLPLUS. EXE, EXP. EXE, and IMP. EXE files are packaged class files. SQLPLUS. EXE calls EXP. EXE and IMP. EXE to complete the import and export functions. The following describes the Import and Export instances. You can import and export instances to the Import and Export instances, because the import and export operations are very simple. Data export: 1 completely export the database TEST, and the user name system password manager is exported to D: \ daochu. exp system/manager @ TEST file = d: \ daochu in dmp. 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 tables table1 and table2 in the database exp system/manager @ TEST file = d: \ daochu. dmp tables = (table1, table2) 4. Export the filed1 field in table 1 in the database with the data Header "00" exp system/manager @ TEST file = d: \ daochu. dmp tables = (table1) query = \ "where Filed1 like '000000' \ "is commonly used for export. I am not very concerned about compression. You can use winzip to compress dmp files. However, add compress = y to the command above.

Import data 1: import data from D: \ daochu. dmp to the TEST database. Imp system/manager @ TEST file = d: \ daochu. dmp may be faulty because some tables already exist, and an error is reported, so the table will not be imported. Add ignore = y to the end. 2. Importing table 1 in d: \ daochu. dmp to imp system/manager @ TEST file = d: \ daochu. dmp tables = (table1) is sufficient. In many cases, I completely delete the table and then import it. Note: if you have sufficient permissions, the system will prompt you. Databases can be connected. You can use tnsping TEST to obtain whether the database TEST can be connected.

 

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

Note: The data of the current user is exported. If the current user has DBA permissions, all data is exported!

Import data between users with the same name: imp hkb/hkb @ xe file = c: \ orabackup \ hkbfull. dmp log = c: \ orabackup \ hkbimp. log full = y

Import data between different names: imp system/test @ xe fromuser = hkb touser = hkb_new file = c: \ orabackup \ hkbfull. dmp

Log = c: \ orabackup \ hkbimp. log;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.