章三十五 EXPDP和IMPDP
EXPDP
conn system/manager
create directory dump_dir as '/DUMP';
grant read, write on directory dump_dir to scott;
导出表
expdp scottt/tiger DIRECTORY=dump_dir DUMPFILE=tab.dmp TALBES=dept, emp
expdp system/manager DIRECTORY=dump_dir TALBES=scott.dept, emp
导出方案
expdp system/manager DIRECTORY=dump_dir DUMPFILE=schema.dmp SCHEMAS=system, scott
导出表空间
expdp system/manager DIRECTORY=dump_dir DUMPFILE=tablespace.dmp TABLESPACE=data01, data02
导出数据库
expdp system/manager DIRECTORY=dump_dir DUMPFILE=full.dmp FULL=y
导出特定时间点的数据
DIRECTORY=dump_dir
DUMPFILE=scott_time.dmp
FLASHBACK_TIME="TO_TIMESTAMP('2009-01-13 19:15:00', 'YY-MM-DD HH24:MI:SS')
expdp scott/tiger parfile=backpath/par.txt
导出对象结构
expdp scott/tiger content=metadata_only dumpfile=metadata.dmp tables=dept, emp
导出部分数据
directory=dump_dir
dumpfile=part.dmp
tables=dept,emp
query="where deptno=10"
expdp scott/tiger parfile=backpath/par.txt
IMPDP
conn system/manager
create or replace directory dump_dir as '/DUMP';
grant read, write on directory dump_dir to scott;
导入表
impdp scott/tiger DIRECTORY=dump_dir DUMPFILE=tab.dmp TALBES=dept, emp
impdp system/manager DIRECTORY=dump_dir DUMPFILE=tab.dmp TALBES=scottdept, scott.emp REMAP_SCHEMA=SCOTT:SYSTEM
导入方案
impdp scott/tiger DIRECTORY=dump_dir DUMPFILE=schema.dmp SCHEMAS=scott
impdp system/manager DIRECTORY=dump_dir DUMPFILE=schema.dmp SCHEMAS=scott REMAP_SCHEMA=SCOTT:SYSTEM
导入表空间
impdp system/manager DIRECTORY=dump_dir DUMPFILE=tablespace.dmp TABLESPACE=data01
导入数据库
impdp system/manager DIRECTORY=dump_dir DUMPFILE=full.dmp FULL=y
导入对象结构
impdp system/manager content=metadata_only dumpfile=metadata.dmp tables=dept, emp
导入部分数据
directory=dump_dir
dumpfile=part.dmp
tables=dept,emp
query="where deptno=10"
expdp scott/tiger parfile=backpath/par.txt
章三十六 EXP和IMP
使用EXP
导出表
exp system/manager TABLES=scott.dept.scott.emp file=backpath/tabl.dmp
exp scott/tiger TABLES=dept.emp file=backpath/tabl.dmp
导出方案
exp system/manager OWNER=scott file=backpath/schema1.dmp
exp scott/tiger file=backpath/schema1.dmp
导出表空间
exp system/manager TABLESPACES=data01 file=backpath/tbs.dmp
导出数据库
exp system/manager FULL=y file=backpath/tbs.dmp
导出特定时间点的数据
file=backpath/scott_time.dmp
flashback_time="TO_TIMESTAMP('2009-01-13 19:15:00','YYYY-MM-DD HH24:MI:SS')"
exp scott/tiger parfile=backpath/par.txt
导出对象结构
exp scott/tiger rows=n file=backpath/stru.dmp tables=dept
导出部分数据
file=backpath/part.dmp
tables=dept,emp
query="where deptno=10"
exp scott/tiger parfile=backpath/par.txt
IMP
导入表
imp scott/tiger file=backpath/tab2.dmp tables=dept, emp
imp system/manager file=backpath/tab2.dmp tables=dept, emp fromuser=scott touser=system
导入方案
imp scott/tiger file=backpath/schema2.dmp fromuser=scott touser=scott
imp system/manager file=backpath/schema2.dmp fromuser=scott touser=system
导入表空间
imp system/manager file=backpath/tbs.dmp tablespace=data01 full=y
导入数据库
imp system/manager file=backpath/full.dmp full=y
导入对象结构
imp scott/tiger rows=n file=backpath/stru.dmp tables=dept
导入对象数据
imp scott/tiger rows=n file=backpath/tab1.dmp ignore=y tables=dept, emp
附录:动态性能视图
NOMOUNT
v$patameter
v$sga
v$option
v$process
v$session
v$version
v$intance
MOUNT
v$thread
v$controlfile
v$database
v$datfile
v$datafile_header
v$logfile
OPEN
v$filestat
v$session_wait
v$waitstat
常用动态性能视图
阅读(839) | 评论(0) | 转发(0) |