--將數據庫爲testdb,用戶名爲testuser中默認(users)表空間裏的數據遷移至表空間(newtablespace)
--1.用system用戶登陸testdb數據庫,創建directory(testdir)並將讀、寫權限授予testuser用戶
create or replace directory testdir as 'e:\temp';
grant read, write on directory testdir to testuser;
--使用expdp命令導出testuser用戶的數據
expdp system/aaaaaa@testdb directory=testdir dumpfile=testdb.dmp schemas=testuser;
--2.創建表空間newtablespace
create tablespace newtablespace
logging
datafile 'E:\Oracle\product\10.2.0\oradata\oa\newtablespace.dbf'
size 100m
autoextend on
next 200m maxsize 2048m
extent management local;
--3.將testuser的表空間修改爲newtablespace
alter user testuser default tablespace newtablespace;
--4.將testuser用戶下面的表、序列等刪除
--5.導入數據
impdp system/aaaaaa@testdb directory=testdir dumpfile=testdb.dmp remap_tablespace=users:newtablespace