您现在的位置是:首页
>
表空间使用情况 如何把数据导入不同的表空间?
如何把数据导入不同的表空间? 很多人在进行数据迁移时 希望把数据导入不同于原系统的表空间 在导入之后却往往发现 数据被导入了原表空间 本例举例说明解决这个问题: 如果缺省的用户具有
如何把数据导入不同的表空间?

很多人在进行数据迁移时 希望把数据导入不同于原系统的表空间 在导入之后却往往发现 数据被导入了原表空间 本例举例说明解决这个问题: 如果缺省的用户具有DBA权限 那么导入时会按照原来的位置导入数据 即导入到原表空间 $ imp bjbbs/passwd file=bj_bbs dmp fromuser=jive touser=bjbbs grants=n Import: Release Production on Mon Sep : : (c) Copyright Oracle Corporation All rights reserved Connected to: Oracle i Enterprise Edition Release bit Production With the Partitioning option JServer Release bit Production Export file created by EXPORT:V via conventional path Warning: the objects were exported by JIVE not by you import done in ZHS GBK character set and ZHS GBK NCHAR character set importing table HS_ALBUMINBOX rows imported importing table HS_ALBUM_INFO rows imported importing table HS_CATALOG rows imported importing table HS_CATALOGAUTHORITY rows imported importing table HS_CATEGORYAUTHORITY rows imported importing table JIVEUSERPROP rows imported importing table JIVEWATCH rows imported importing table PLAN_TABLE rows imported importing table TMZOLDUSER rows imported importing table TMZOLDUSER rows imported About to enable constraints Import terminated successfully without warnings 查询发现仍然导入了USER表空间 $ sqlplus bjbbs/passwd SQL*Plus: Release Production on Mon Sep : : (c) Copyright Oracle Corporation All rights reserved Connected to: Oracle i Enterprise Edition Release bit Production With the Partitioning option JServer Release bit Production SQL> select table_name tablespace_name from user_tables; TABLE_NAME TABLESPACE_NAME HS_ALBUMINBOX USERS HS_ALBUM_INFO USERS HS_CATALOG USERS HS_CATALOGAUTHORITY USERS HS_CATEGORYAUTHORITY USERS HS_CATEGORYINFO USERS HS_DLF_DOWNLOG USERS JIVEWATCH USERS PLAN_TABLE USERS TMZOLDUSER USERS TABLE_NAME TABLESPACE_NAME TMZOLDUSER USERS rows selected 回收用户unlimited tablespace权限 这样就可以导入到用户缺省表空间 SQL> create user bjbbs identified by passwd default tablespace bjbbs temporary tablespace temp / User created SQL> grant connect resource to bjbbs; Grant succeeded SQL> grant dba to bjbbs; Grant succeeded SQL> revoke unlimited tablespace from bjbbs; Revoke succeeded SQL> alter user bjbbs quota on users; User altered SQL> alter user bjbbs quota unlimited on bjbbs; User altered SQL> exit Disconnected from Oracle i Enterprise Edition Release bit Production With the Partitioning option JServer Release bit Production 重新导入数据 $ imp bjbbs/passwd file=bj_bbs dmp fromuser=jive touser=bjbbs grants=n Import: Release Production on Mon Sep : : (c) Copyright Oracle Corporation All rights reserved Connected to: Oracle i Enterprise Edition Release bit Production With the Partitioning option JServer Release bit Production Export file created by EXPORT:V via conventional path Warning: the objects were exported by JIVE not by you import done in ZHS GBK character set and ZHS GBK NCHAR character set importing table HS_ALBUMINBOX rows imported importing table HS_ALBUM_INFO rows imported importing table HS_CATALOG rows imported importing table HS_CATALOGAUTHORITY rows imported importing table HS_CATEGORYAUTHORITY rows imported importing table HS_CATEGORYINFO rows imported importing table HS_DLF_DOWNLOG rows imported importing table JIVEUSER rows imported importing table JIVEUSERPERM rows imported importing table JIVEUSERPROP rows imported importing table JIVEWATCH rows imported importing table PLAN_TABLE rows imported importing table TMZOLDUSER rows imported importing table TMZOLDUSER rows imported About to enable constraints Import terminated successfully without warnings SQL> select table_name tablespace_name from user_tables; TABLE_NAME TABLESPACE_NAME HS_ALBUMINBOX BJBBS HS_ALBUM_INFO BJBBS HS_CATALOG BJBBS HS_CATALOGAUTHORITY BJBBS JIVETHREAD BJBBS JIVETHREADPROP BJBBS JIVEUSER BJBBS JIVEUSERPERM BJBBS JIVEUSERPROP BJBBS JIVEWATCH BJBBS PLAN_TABLE BJBBS TMZOLDUSER BJBBS TABLE_NAME TABLESPACE_NAME TMZOLDUSER BJBBS rows selected 现在数据被导入到正确的用户表空间中 lishixinzhi/Article/program/Oracle/201311/18548
很赞哦! (1042)