1.imp导入
imp xx/[email protected]:1521/xx file=E:\SQL\xx.dmp ignore=y FULL=Y tablespaces=XX
(ignore忽略错误,tablespaces指定表空间)
2.impdp导入
(1)创建表空间
C表空间创建:
create tablespace C datafile 'E:\app\Administrator\oradata\orcl2\C'size 50M AUTOEXTEND ON NEXT 5M MAXSIZE UNLIMITED;
查询表空间:
select * from user_tables;
--导入时必须先创建文件夹路径
create or replace directory sql_dir as 'd:\oracle\test';
--给使用的用户授权(读写权限)
Grant read,write on directory sql_dir to scot;
(2)impdp xx/[email protected]:1521/xx directory=xx dumpfile=xx.dmp
select * from dba_directories;-->查询逻辑目录
(directory 逻辑目录 dumpfile 逻辑目录下的dmp文件)
3.exp导出
exp xx/[email protected]:1521/orcl file=C:\xx\xxx.dmp owner=(xx)
4.expdp指定表导出
expdp xx/[email protected]:1521/orcl dumpile=xx.dmp DIRECTORY=xx TABLES=(xx,xx)