天天看点

oracle导入和导出Dmp文件的一些总结,创建表空间

1.首先要创建一个directory,为后续的dmp文件 存放的位置

select * from dba_directories;    //查看所有的directory

create directory dpdata2 as 'd:\test\dump';     //创建directory

2.不同方式导出dmp文件

1)按用户导

expdp scott/[email protected] schemas=scott dumpfile=expdp.dmp DIRECTORY=dpdata1;

2)并行进程parallel

expdp scott/[email protected] directory=dpdata1 dumpfile=scott3.dmp parallel=40 job_name=scott3

3)按表名导

expdp scott/[email protected] TABLES=emp,dept dumpfile=expdp.dmp DIRECTORY=dpdata1;

4)按查询条件导

expdp scott/[email protected] directory=dpdata1 dumpfile=expdp.dmp Tables=emp query='WHERE deptno=20';

5)按表空间导

expdp system/manager DIRECTORY=dpdata1 DUMPFILE=tablespace.dmp TABLESPACES=temp,example;

6)导整个数据库

expdp system/manager DIRECTORY=dpdata1 DUMPFILE=full.dmp FULL=y;

3.导入dmp文件    REMAP_SCHEMA 是把原用户 导入到新用户里  ,dmp文件在data_pump_dir里

1)、     impdp gcfr_02/[email protected] DIRECTORY=DATA_PUMP_DIR DUMPFILE=GCFR20180305_0522.DMP   REMAP_SCHEMA=GCFR20180305:gcfr_02

2)   impdp gcfr_02/1 DIRECTORY=dpdata2 DUMPFILE=expdp.dmp SCHEMAS=gcfr_02;

4.查询所有表空间 

select * fromdba_data_files;

5.创建表空间

CREATESMALLFILE TABLESPACE test

DATAFILE'E:\oracle\oradata\orcl\test.dbf' SIZE 1024M AUTOEXTEND ON NEXT 256M MAXSIZEUNLIMITED

LOGGINGEXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;

ALTERDATABASE DATAFILE 'E:\oracle\oradata\orcl\test.dbf'

AUTOEXTENDON MAXSIZE Unlimited;

6.创建用户到表空间

createuser test

identifiedby "1"

defaulttablespace test

temporarytablespace TEMP

profileDEFAULT;

这样使用这个用户创建的表就到这个表空间下边了