Oracle数据泵导出导入(expdp/impdp)

一、创建表空间
create tablespace atp
logging
datafile 'D:\oracle\oradata\orcl\atp.dbf'
size 50m
autoextend on
next 50m maxsize 20480m
extent management local;

二、创建用户
-- Create the user
create user ATP
default tablespace ATP
temporary tablespace TEMP
profile DEFAULT
identified by atp;
-- Grant/Revoke role privileges
grant connect to ATP;
grant dba to ATP;
grant resource to ATP;
-- Grant/Revoke system privileges
grant create any view to ATP;
grant select any sequence to ATP;
grant select any table to ATP;
grant unlimited tablespace to ATP;

三、导出
1、创建逻辑目录,该命令不会在操作系统创建真正的目录,最好以system等管理员创建。
create directory expdp_dir as 'D:\home\Oracle\dump';
2、给scott用户赋予在指定目录的操作权限,最好以system等管理员赋予。
grant read,write on directory expdp_dir to scott;
3、在windows中创建目录“D:\home\Oracle\dump”
4、导出命令
1)按用户导出:expdp system/1@orcl directory=expdp_dir dumpfile=0526NETOBDC.dmp logfile=0526NETOBDC.log schemas=netobdc
2)按表名导出:expdp system/1@orcl directory=expdp_dir dumpfile=0526NETOBDC.dmp logfile=0526NETOBDC.log TABLES=emp,dept
3)导出整个数据库:expdp system/1@orcl directory=expdp_dir dumpfile=0526NETOBDC.dmp logfile=0526NETOBDC.log FULL=y

四、导入
1、创建逻辑目录,该命令不会在操作系统创建真正的目录,最好以system等管理员创建。
create directory impdp_dir as 'D:\home\Oracle\impdp_dir';
2、给scott用户赋予在指定目录的操作权限,最好以system等管理员赋予。
grant read,write on directory impdp_dir to scott;
3、在windows中创建目录“D:\home\Oracle\impdp_dir”然后将导出的dmp包拷贝到此目录下
4、导入命令
1)导入到指定用户下:impdp bdc_atp/bdc_atp@orcl directory=impdp_dir dumpfile=0526ATP.dmp logfile=0526ATP.log schemas=bdc_atp
2)导入到不同的用户下:impdp bdc_atp/bdc_atp@orcl directory=impdp_dir dumpfile=0526ATP.dmp logfile=0526ATP.log remap_schema=atp:bdc_atp
3)导入整个数据库:impdp bdc_atp/bdc_atp@orcl directory=impdp_dir dumpfile=0526ATP.dmp logfile=0526ATP.log FULL=y

猜你喜欢

转载自www.cnblogs.com/Tandongmu/p/9111912.html