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 imports data from one user to another (data pump)

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

Share

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

192.168.0.1--server1

1. Export data

[expdp version]

Before using expdp, you need to build directory in Oracle now.

1. Create directory dump as'/ u01CompDump`

Grant users read/write permissions on directory

2 、 grant read,write on directory dump to [wyb]

Users need the permission of resource or dba to expdp

3 、 grant resource to [wyb]

4 、 expdp wyb/123456 dumpfile= dump1.dmp logfile=expdp.log directory=dump1

192.168.0.1_server2

Clear all objects of the target user before import

The easiest way is to delete and rebuild the target user, or create a new one.

1. Drop user sam cascade; deletes tablespace data at the same time

Then create user / / create temporary tablespace / / grant permissions

2. CREATE TABLESPACE sam DATAFILE 'sam.dbf'

SIZE 200M AUTOEXTEND ON EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO

3 、 CREATE USER sam IDENTIFIED BY 123456 DEFAULT TABLESPACE sam

4 、 grant connect,dba to [sam]

Import data

[impdp version]

Similarly, before using impdp, you need to build directory in Oracle now. If you have directory, you do not need to create

1. Create directory dump as'/ u01CompDump`

Grant users read/write permissions on directory

2 、 grant read,write on directory dump to [sam]

Grant user dba permission

Grant dba to [sam]

Impdp user/password dumpfile=temp.dmp directory=dump remap_tablespace= [old _ table_space]: [new_table_space]; old refers to the tablespace_name,new on the server1 machine refers to the server2

Impdp sam/123456 dumpfile=wyb-15032501.dmp directory=dump1 remap_tablespace=wyb:sam remap_schema=wyb:sam logfile=wyb-15032501.log

/ / cancel the DBA permission after importing the data

Revoke dba from [sam]

/ / List directories

SELECT * FROM dba_directories

If tablespace exists, delete the tablespace first

DROP TABLESPACE xxb0001 INCLUDING CONTENTS AND DATAFILES

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