exp导入到不同表空间

很多人在进行数据迁移时,希望把数据导入不同于原系统的表空间,在导入之后却往往发现,数据被导入了原表空间。

本例举例说明解决这个问题:
1.如果缺省的用户具有DBA权限
那么导入时会按照原来的位置导入数据,即导入到原表空间
$ imp boson/passwd file=boson.dmp fromuser=test touser=boson grants=n

查询发现仍然导入了USER表空间

$ sqlplus boson/*
SQL> select table_name,tablespace_name from user_tables;

TABLE_NAME TABLESPACE_NAME
—————————— ——————————
HS_ALBUMINBOX USERS
HS_ALBUM_INFO USERS
45 rows selected.

2.回收用户unlimited tablespace权限
这样就可以导入到用户缺省表空间
SQL> create user boson identified by passwd
2 default tablespace boson

3 temporary tablespace temp
4 /
User created.

SQL> grant connect,resource to boson;
Grant succeeded.
SQL> grant dba toboson;
Grant succeeded.
SQL> revoke unlimited tablespace from  boson ;
SQL> alter user boson quota 0 on users;
SQL> alter user boson quota unlimited on boson;

重新导入数据
$ imp boson/passwd file=boson.dmp fromuser=test touser=boson grants=n
SQL> select table_name,tablespace_name from user_tables;
45 rows selected.

现在数据被导入到正确的用户表空间中.



评论暂缺

(Required)
(Required, will not be published)