网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > 数据库 > Oracle教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
数据库:数据库教程,数据库技巧,Oracle教程,MySQL教程,Sybase教程,Access教程,DB2教程,数据库安全,数据库文摘
本月文章推荐
.oracle8i学习笔记.
.ORA-02019:未找到远程数据库的连.
.ORACLE SQL性能优化系列 (二).
.自己写个 C 程式.
.用ORACLE的高级复制实现内外网数.
.如何学习Oracle.
.高速的导出/导入:Oracle Data P.
.充分利用 Oracle SQL Developer .
.Oracle数据库PL/SQL过程调试的输.
.oracle触发器介绍.
.LILO使用指南(上).
.SQL Server和Oracle并行处理比较.
.PLSQL单行函数和组函数详解.
.Oracle Portal网站开发.
.MYSQL到ORACLE程序迁移需要注意的.
.使用数据字典.
.DataGuard数据库服务器硬盘故障处.
.如何实现自动友情链接.
.如何在Oracle中发送Email.
.Oracle 产品技术文档—Oracle9i.

如何把数据导入不同的表空间?

发表日期:2008-2-9



  很多人在进行数据迁移时,希望把数据导入不同于原系统的表空间,在导入之后却往往发现,数据被导入了原表空间。
  
  本例举例说明解决这个问题:
  
  1.假如缺省的用户具有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.
  
  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.
  
  现在数据被导入到正确的用户表空间中. right">(出处:清风软件下载学院)
上一篇:10g新特性之-expdp与传统exp的速度比较 人气:615
下一篇:使用Oracle9i的blockrecover新特性修复数据库中的坏块 人气:649
浏览全部Oracle教程的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐