Oracle中exp,imp的TableSpace表空间问题

我就是我 2022-08-24 01:53 499阅读 0赞

当用EXP导出表,其表的表空间和需要导入的表空间不一致时,有两种处理方法。

1.修改该表的表空间语句。

如有表T1,所在表空间为USER。直接修改其表空间必须先删除此表数据,而且当有几百张表时,直接修改起来也是一件麻烦的事情。所以采用以下处理方法比较明智。

step1:直接导出dump。

exp /@servicename file= owner=ownername rows=y tables=

step2:利用导出的dump,得到indexfile。

imp /< password>@servicename file= indexfile = full=y

step3: 利用EDIT工具快速修改tablespace语句并保存index.sql

Find: 'REM<space>' Replace: <nothing>

Find: '"<source_tablespace>"' Replace: tablespace name

Find: '...' Replace: 'REM ...'

Find: 'CONNECT' Replace: 'REM CONNECT'

step4: 在目标数据库中执行index.sql

nbsp;sqlplus /@servicename @index.sql </span

step5:把step1导出的dump导入到目标数据库,step4只是创建了表结构

imp /@servicename file= fromuser= touser=ignore=y

2.把导入到的用户的表空间默认为表需要导入的表空间

当不具unlimited tablespace权限时,用户的表空间范围被限制在配额内
当具有unlimited tablespace权限时,即使设置了表空间的配额,用户实际也能突破配额限制

step1:收回要导入用户的无限制表空间权限

revoke unlimited tablespace from username;

转自http://blog.csdn.net/rogerjava/article/details/6977579

  1. <span style="font-size:14px;">revoke unlimited tablespace from username;</span>

step2:将希望导入的表空间设为目的用户的默认表空间,并添加配额

alter user default tablespace quota unlimited on ;

  1. <span style="font-size:14px;">alter user <username> default tablespace <tablespace name>quota unlimited on <username>;</span>

step3:导入dmp到目标用户即可,此时导入的表的表空间会设置为用户的表空间即需要导入的表空间

发表评论

表情:
评论列表 (有 0 条评论,499人围观)

还没有评论,来说两句吧...

相关阅读