网站首页
JSP空间
动态资讯
开源项目
技术文档
资源下载
J2EE资源
客户论坛
在线支付
 
  技术文档>>数据库技术>>Oracle技术>>Oracle开发>查看文档  
  教你轻松掌握如何把数据导入不同的表空间     
  文章作者:未知  文章来源:赛迪网技术社区  
  查看:144次  录入:管理员--2007-11-15  
 

问:我在进行数据迁移时,本来希望把数据导入到不同于原系统的表空间,在导入之后意外的发现数据却被导入了原表空间。请问应给怎么解决这个问题?

答:我来举一个简单的例子:

首先如果缺省的用户具有dba权限,那么导入时会按照原来的位置导入数据,即导入到原表空间。

$ imp bjbbs/passwd file=bj_bbs.dmp fromuser=jive touser=bjbbs grants=n

import: release 8.1.7.4.0 - production on mon sep 22 11:49:41 2003

(c) copyright 2000 oracle corporation.  all rights reserved.


connected to: oracle8i enterprise edition release 8.1.7.4.0 - 64bit production
with the partitioning option
jserver release 8.1.7.4.0 - 64bit production

export file created by export:v08.01.07 via conventional path

warning: the objects were exported by jive, not by you

import done in zhs16gbk character set and zhs16gbk nchar character set
. . importing table                "hs_albuminbox"         12 rows imported
. . importing table                "hs_album_info"         47 rows imported
. . importing table                   "hs_catalog"         13 rows imported
. . importing table          "hs_catalogauthority"          5 rows imported
. . importing table         "hs_categoryauthority"          0 rows imported
....
. . importing table                 "jiveuserprop"          4 rows imported
. . importing table                    "jivewatch"          0 rows imported
. . importing table                   "plan_table"          0 rows imported
. . importing table                   "tmzolduser"          3 rows imported
. . importing table                  "tmzolduser2"          3 rows imported
about to enable constraints...
import terminated successfully without warnings.

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

$ sqlplus bjbbs/passwd

sql*plus: release 8.1.7.0.0 - production on mon sep 22 11:50:03 2003

(c) copyright 2000 oracle corporation.  all rights reserved.


connected to:
oracle8i enterprise edition release 8.1.7.4.0 - 64bit production
with the partitioning option
jserver release 8.1.7.4.0 - 64bit 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
------------------------------ ------------------------------
tmzolduser2                    users

45 rows selected.

1 2 下一页>>


2.回收用户unlimited tablespace权限即可以导入到用户缺省表空间

sql> create user bjbbs identified by passwd
  2  default tablespace bjbbs
  3  temporary tablespace temp
  4  /

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 0 on users;

user altered.

sql> alter user bjbbs quota unlimited on bjbbs;

user altered.

sql> exit
disconnected from oracle8i enterprise edition release 8.1.7.4.0 - 64bit production
with the partitioning option
jserver release 8.1.7.4.0 - 64bit production

最后重新导入数据

$ imp bjbbs/passwd file=bj_bbs.dmp fromuser=jive touser=bjbbs grants=n

import: release 8.1.7.4.0 - production on mon sep 22 12:00:51 2003

(c) copyright 2000 oracle corporation.  all rights reserved.


connected to: oracle8i enterprise edition release 8.1.7.4.0 - 64bit production
with the partitioning option
jserver release 8.1.7.4.0 - 64bit production

export file created by export:v08.01.07 via conventional path

warning: the objects were exported by jive, not by you

import done in zhs16gbk character set and zhs16gbk nchar character set
. . importing table                "hs_albuminbox"         12 rows imported
. . importing table                "hs_album_info"         47 rows imported
. . importing table                   "hs_catalog"         13 rows imported
. . importing table          "hs_catalogauthority"          5 rows imported
. . importing table         "hs_categoryauthority"          0 rows imported
. . importing table              "hs_categoryinfo"          9 rows imported
. . importing table               "hs_dlf_downlog"          0 rows imported
....
. . importing table                     "jiveuser"        102 rows imported
. . importing table                 "jiveuserperm"         81 rows imported
. . importing table                 "jiveuserprop"          4 rows imported
. . importing table                    "jivewatch"          0 rows imported
. . importing table                   "plan_table"          0 rows imported
. . importing table                   "tmzolduser"          3 rows imported
. . importing table                  "tmzolduser2"          3 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
------------------------------ ------------------------------
tmzolduser2                    bjbbs

45 rows selected.

至此数据即被导入到正确的用户表空间中了。

 
 
上一篇: 教你正确认识oracle数据库的结构组件    下一篇: 实例解析:sqlldr加载数据到不同表的问题
  相关文档
教你快速掌握Oracle中"HINT"的30个用法 09-29
关于Oracle中表外键更名规则详细介绍 04-11
轻松掌握无文件备份、拥有所有归档的恢复 (1) 11-23
建库的过程中dbca报错,错误号为ora-12547 02-27
数据库迁移的几种常用方式及优缺点比较 05-14
深入探讨Oracle数据缓冲区内部机制 04-11
数据库管理员日常工作中必备的sql列表 (1) 05-05
Oracle数据库应用程序性能优化探究 04-11
实例讲解oracle到sql server主键的迁移 05-14
解析:oracle中 限制返回 结果集的大小 11-20
oracle数据库9i dataguard的安装与维护 06-10
几种解决互联网应用程序开发的好方法 (1) 03-28
如何使用sql server数据库嵌套子查询 05-15
存储在数据库中的过程——数据库触发器 09-29
Oracle如何对CLOB行字段来执行全文检索 06-10
Oracle数据库异步调用基本原理及测试 04-11
用简单的方法获取oracle语句的执行时间 05-16
Oracle系统表查询 01-15
实例讲解sql_trace和access path的用法 (1) 04-07
如何处理oracle中temp表空间满的问题 03-03
返回首页 | 关于我们 | J网章程 | JSP空间合租 | 客服中心 | 免责声明 | 常见问题 | 参观机房
本站主机空间代理至厦门市华众网络科技有限公司
《中华人民共和国增值电信业务经营许可证》
编号:闽B2-20050079
@2005-2008福建JSP技术网 版权所有 闽ICP备05000928号
厦门(总部):13616026886 福州:0591-87655121
邮箱:admin@fjjsp.com 站长QQ,点击这里给我发消息