How to export data in an Oracle database

Source: Internet
Author: User
Tags command line oracle database sqlplus backup

Oracle Data Import Export IMP/EXP

Features: Oracle data Import Export IMP/EXP is equivalent to Oracle data restore and backup.

In most cases, you can use an Oracle data import export to complete the backup and restore of your data (without causing data loss).

Oracle has a benefit, although your computer is not a server, but you installed the Oracle client, and established a connection

(Add the correct service name through Net Configuration assistant, in fact you can think of the client and server side to fix a road, then the data can be pulled over)

This allows you to export the data locally, although the server may be far away from you.

You can also import DMP files from a local to a remote database server.

With this feature you can build two identical databases, one for testing and one for formal use.

Execution environment: can be executed in SQLPLUS.EXE or DOS (command line),

DOS can be performed because the install directory \ $ora 10g\bin in Oracle 8i is set to the global path,

There are EXP.EXE and IMP.EXE files under this directory that are used to perform import export.

Oracle is written in Java, I would like to SQLPLUS.EXE, EXP. EXE, IMP. EXE these two files are wrapped in the class file.

Sqlplus. EXE call EXP.EXE, IMP. EXE they are wrapped in the class, completing the import export function.

The following is an example of an import export, which is basically done when you look at an instance of an import export, because importing exports is simple.

Data export:

1 completely export database test, user Name System Password Manager exported to D:\daochu.dmp

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

Exp system/manager@test file=d:\daochu.dmp owner= (System,sys)

3 Export the table table1, table2 in the database

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"

Exp system/manager@test file=d:\daochu.dmp tables= (table1) query=\ "where filed1 like ' 0% '"

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/

The above is the common export, for compression I do not care, with WinZip DMP file can be very good compression.

But it's okay to add compress=y to the command behind it.

Data export:

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

Export considerations: Exports the current user's data, and the current user has DBA authority to export all data!

Data import between users with the same name:

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

Data import 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.