Java code for data migration between different oracle tablespaces -- migrate data in the database testdb and the username testuser's default (users) tablespace to the tablespace (newtablespace) -- 1. log on to the testdb database as a system user, create a directory (testdir), and grant the read and write permissions to the testuser user www.2cto.com create or replace directory testdir as 'e: \ temp '; grant read, write on directory testdir to testuser; -- use the expdp command to export data of the testuser. expdp system/aaaaaa @ testdb directory = testdir dumpfile = testdb. dmp schemas = testuser; -- 2. create a tablespace newtablespace www.2cto.com create tablespace newtablespace logging datafile 'e: \ oracle \ product \ 10.2.0 \ oradata \ oa \ newtablespace. dbf 'size 100 m autoextend on next 200 m maxsize 2048 m extent management local; -- 3. change the table space of testuser to newtablespace alter user testuser default tablespace newtablespace; -- 4. delete tables and sequences under the testuser -- 5. import Data impdp system/aaaaaa @ testdb directory = testdir dumpfile = testdb. dmp remap_tablespace = users: newtablespace