oracle 导入导出dmp

导出dmp

exp user/pass file=e:\xxx\xxx.dmp  owner=(test)

导入dmp

step 1 - 创建表空间

-- create tablespace

create tablespace PORTAL

logging

datafile 'E:/xxx/xxx/data01.dbf'

size 1024M autoextend on next 50M maxsize unlimited extent management local;


step 2 - 创建用户并分配表空间和权限

-- Create the user

create user test identified by test

  default tablespace PORTAL

  temporary tablespace TEMP

  profile DEFAULT;

-- Grant/Revoke role privileges 7

grant connect to test;

grant dba to test;

grant resource to test;

-- Grant/Revoke system privileges

grant unlimited tablespace to test with admin option;


step 3 - 导入

  imp user/pass@orcl full=y file=d:\xxx.dmp

  imp user/pass@orcl full=y Indexes=n Constraints=n file=d:\xxx.dmp   -- 不导入权限和约束


遇到的问题:

1. 导入命令不能用

但是某台服务器也许是之前装过oracle未卸载干净或者是其他原因,最后把数据库名@orcl去掉才好用

imp user/pass full=y file=d:\xxx.dmp


2. 导出时空表未导出

原因 :  http://blog.sina.com.cn/s/blog_5f0e9ca50101it7n.html

解决方法:

step 1 - 改变 deferred_segment_creation
   sqlplus或者plsql命令窗口执行

         alter system set deferred_segment_creation=false;

step 2 -
  SQL>Select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0 or num_rows is null(注意:很多教程没有这里,这里是有可能位空的)
   上述代码可产生批量的修改表extent的SQL语句(有多少张空表就产生多少条),我们只需要将其生成的所有sql代码全部执行,就可以给每一张已经存在的表来分配segment,就OK了。

猜你喜欢

转载自likaidalian.iteye.com/blog/2201091