How to import data to the specified tablespace when using exp/imp

Source: Internet
Author: User

This is often the case where data files are exported from Table A in a database and data needs to be imported to table B due to a certain specification or reason. Oracle does not seem to be able to handle this situation, there are no related options in the exp parameter. When the exported file is opened in a text editor, you can see the name of the original tablespace.

We can now create the same tablespace in the target database. After importing data, we move the table and index to the specified tablespace, but the index of the lob cannot be moved, so the problem cannot be completely solved.

Today, we found a simple method to achieve Simplicity:

  1. First, export the data file according to the normal operation.
  2. Then, use Vim to open the data file. You cannot use a common text editor, emedit, ut, and so on. This will damage the file structure.
  3. Use the following command to replace the tablespace name -- % S/tablespace "A"/tablespace "B"/g
  4. Save launch
  5. Use the IMP command to import data to the target database (the target database must have a tablespace B)

After testing, data can run normally after being imported to table B.

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.