数据库备份与恢复,oracle11g数据库逻辑备份与恢复

用户需要角色exp_full_database和imp_full_database
一、逻辑备份expdp
1.创建目录对象
create directory dump_dir as ‘/oracle/datapump/dumps’;
2.授权目录对象
授权为所有用户可读写
grant read,write _disibledevent=>

expdp system/passwd full=y dumpfile=dump_dir:full%U.dmp filesize=2G parallel=2 logfile=dump_dir:full.log job_name=alldb_export
5.对象模式导出
expdp system/passwd dumpfile=dump_dir:hugwww.dmp logfile=dump_dir:hugwww.log schemas=hugwww
6.表方式导出
expdp system/passwd dumpfile=dump_dir:hugwww_tables.dmp nologfile=y content=metadata_only tables=hugwww.info,hugwww.dept
7.表空间方式导出
expdp system/passwd dumpfile=dump_dir:hugwww_tbs.dmp logfile=dump_dir:hugwww_tbs.log tablespaces=hugwww,hugwww2
二、逻辑恢复impdp
1.导入表
impdp scott/tiger directory=dump_dir dumpfile=tab.dmp tables=dept,emp
impdp system/manage directory=dump_dir dumpfile=tab.dmp tables=scott.dept,scott.emp remap_schema=SCOTT:SYSTEM
第一种方法表示将DEPT和EMP表导入到SCOTT方案中,第二种方法表示将DEPT和EMP表导入的SYSTEM方案中。
注意,如果要将表导入到其他方案中,必须指定REMAP SCHEMA选项。
2.导入方案
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
3.导入表空间
impdp system/manager directory=dump_dir dumpfile=tablespace.dmp tablespaces=hugwww
4.导入数据库
impdp system/manager directory=dump_dir dumpfile=full.dmp full=y
三、监控作业进度
1.命令行操作
数据泵导入/导出执行后,按ctrl+c进入交互模式,输入:
status
2.查询dba_datapump_jobs
select owner_name,job_name,operation,state from dba_datapump_jobs;
3.EXPDP/IMPDP的停止与重启动
1)停止任务
按ctrl+c进入交互模式
status
stop_job
2)重新启动任务
expdp hugwww/passwd attach=alldb_export
start_job
完成!
Tags:  数据库备份恢复 数据库备份与恢复

延伸阅读

最新评论

发表评论