Import and Export dmp files from Oracle databases

Source: Internet
Author: User

First, ask the name and size of the tablespace in the target database, create a tablespace in your oracle database, and then use commands to import and export data.
Supplement:
1. Create a new database;

Importing and exporting Oracle Data imp/exp is equivalent to restoring and backing up oracle data. Exp command

To export data from the remote database server to the local dmp file, the imp command can

To the database server in the distance. This function can be used to build two identical databases.

For testing, and for official use.
For example, import data using the imp command:
Imp username/password @ SID file = XXX. dmp fromuser = XXX touser = XXX tables = (XXX, XXX)
Fromuser refers to the user name of the other database, and touser refers to the user name of your database;

If fromuser has multiple tablespaces, use () to enclose them: fromuser = (a, B );
The touser parameter is similar to the fromuser parameter;
If you only want to import a part of the table, use the tables parameter to include the table to be imported. If you want to import all the tables, you do not need to specify the tables parameter.

The following describes the Import and Export instances.
Data export:
1. Export the database TEST completely, and the username system Password manager is exported to D: \ daochu. dmp.
Exp system/manager @ TEST file = d: \ daochu. 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 the inner_policy and policy_staff_relat tables in the database.
Exp aichannel/aichannel @ TESTDB2 file = d: \ data \ newsmgnt. dmp tables =

(Inner_policy, policy_staff_relat)

The above is a commonly used export. For compression, you can use winzip to compress the dmp file.
You can also add compress = y to the command above.
Data Import
1. import data from D: \ daochu. dmp to the TEST database.
Imp system/manager @ TEST file = d: \ daochu. dmp
Imp aichannel/aichannel @ HUST full = y file = d: \ data \ newsmgnt. dmp

Ignore = y
The above may be a problem, because some tables already exist, and then it will report an error, this table will not be exported

.
Add ignore = y to the end.

2. Import table 1 in d: \ daochu. dmp
Imp system/manager @ TEST file = d: \ daochu. dmp tables = (table1)

The preceding import and export operations are sufficient. In many cases, you must first completely delete the table and then import it.

Note:
If the operator has sufficient permissions, a prompt is displayed.
Databases can be connected. You can use tnsping TEST to obtain whether the database TEST can be connected.

Appendix 1:
Add data import permissions to users
First, start SQL * puls
Second, log in with system/manager
Third, create user username identified by password (if you have already created a user, this step

Can be omitted)
Fourth, grant create user, drop user, alter user, create any view,
Drop any view, EXP_FULL_DATABASE, IMP_FULL_DATABASE,
DBA, CONNECT, RESOURCE, create session to Username
Fifth, run-cmd-to enter the directory where the dmp file is located,
Imp userid = system/manager full = y file = *. dmp
Or imp userid = system/manager full = y file = filename. dmp

Example:
F: \ Work \ Oracle_Data \ backup> imp userid = test/test full = y

File = inner_policy.dmp

Screen Display
Import: Release 8.1.7.0.0-Production on Thursday February 16 16:50:05 2006
(C) Copyright 2000 Oracle Corporation. All rights reserved.

Connect to: Oracle8i Enterprise Edition Release 8.1.7.0.0-Production
With the Partitioning option
JServer Release 8.1.7.0.0-Production

EXPORT the files created by EXPORT: V08.01.07 in the normal path
The ZHS16GBK Character Set and ZHS16GBK NCHAR character set have been imported.
The export server uses the UTF8 NCHAR character set (possible ncharset conversion)
. Importing AICHANNEL object to AICHANNEL
.. Importing table "inner_policy" 4 rows
Prepare to enable constraints...
Import is terminated successfully, but a warning is displayed.

From: http://hi.baidu.com/ooofcu/blog/item/ec5d1f9580d41f007af48077.html

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.