网站首页
JSP空间
动态资讯
开源项目
技术文档
资源下载
J2EE资源
客户论坛
在线支付
 
  技术文档>>数据库技术>>Oracle技术>>Oracle开发>查看文档  
  教你轻松掌握如何把数据导入不同的表空间     
  文章作者:未知  文章来源:赛迪网技术社区  
  查看:143次  录入:管理员--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数据库的结构组件 11-15
解析:物化视图刷新中出现的“约束冲突” 11-15
对外连接的表加上条件后将会使外连接失效 03-07
RMAN备份恢复——配置介质管理器 06-03
oracle11g之初体验 数据中心自动化等功能 09-24
教你如何使用Logmnr方法分析数据库日志 06-03
怎样在数据字典中直接修改oracle表列名 11-15
oracle数据库10g环境下修改vip地址的方法 07-25
oracle 9i和10g安装后的基本环境与服务 (1) 04-30
建库的过程中dbca报错,错误号为ora-12547 02-27
在Oracle 10g中如何获得索引建议 05-13
快速了解Oracle9i中的一个特殊等待事件 09-29
解析:执行drop表操作后数据库无法起动 11-15
用events 跟踪解决不能创建物化试图一例 06-17
使用专用服务进程的Oracle的运行 09-29
redo copy latch未命中率并不需要调整 04-16
oracle数据库中如何使用超过2g的内存 03-31
Oracle的两个重要文件:TNSNAMES.ORA 05-13
oracle数据库专享工具介绍:sql*loader (1) 09-09
查看前五个最占用cpu的oracle会话进程 02-01
返回首页 | 关于我们 | J网章程 | JSP空间合租 | 客服中心 | 免责声明 | 常见问题 | 参观机房
本站主机空间代理至厦门市华众网络科技有限公司
《中华人民共和国增值电信业务经营许可证》
编号:闽B2-20050079
@2005-2008福建JSP技术网 版权所有 闽ICP备05000928号
厦门(总部):13616026886 福州:0591-87655121
邮箱:admin@fjjsp.com 站长QQ,点击这里给我发消息