Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

ORACLE expdp exports / imports all tables that begin with XX

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Scenario: there are 2 oracle users, userA default tablespace tablespaceA, userB default tablespace tablespaceB.

Now you need to export the system tables in userA (the tables that start with SYS in this user tablespace) into userB, overwriting userB's system tables, but not userB's business tables. The methods are as follows:

Export the table starting with SYS in the userA user schema, using tables=SYS%

Expdp userA/password directory=TMP_BAK dumpfile=userA-170504-expdp-tab.dmp logfile=userA-170504-expdp-tab.log tables=SYS%

If you only need to export a few tables, use tables=table1,table2

Expdp userA/password directory=TMP_BAK dumpfile=userA-170504-expdp-tab02.dmp logfile=userA-170504-expdp-tab02.log tables=table1,table2

Import the exported dmp file into the schema of the userB user.

Note that the TABLESPACE corresponding to the SCHEMA table has changed here, and the SYS table already exists in the tablespace of the original userB. Therefore, the following parameters need to be added when importing:

① remap_schema specifies the source SCHEMA and destination SCHEMA.

② remap_tablespace specifies the source TABLESPACE and destination TABLESPACE.

③ table_exists_action=replace overwrites the renamed table.

Be careful to back up the data of userB before import to avoid data loss caused by export errors.

Expdp userB/password directory=TMP_BAK dumpfile=userB-170504-expdp.dmp logfile=userB-170504-expdp.log

Formally import tables that begin with SYS into userB users.

Impdp userB/password directory=TMP_BAK dumpfile=userA-170504-expdp-tab.dmp remap_schema=userA:userB REMAP_TABLESPACE=tablespaceA:tablespaceB TABLE_EXISTS_ACTION=REPLACE logfile=userB-0504-impdp-tab.log

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report