---
title: "expdp备份"
author: "cyqplay"
date: "2014-05-21T17:49:12Z"
tags: []
categories: ["数据库"]
slug: "expdp"
draft: false
lastmod: "2014-05-21T17:49:12Z"
id: 2069295
url: "https://cyqplay.iteye.com/blog/2069295"
---

cd /home/pkg/databasebackup  
chown oracle:asmadmin /home/pkg/databasebackup  
chgrp asmadmin /home/pkg/databasebackup  
create or replace directory dump  as '/home/pkg/databasebackup'  
grant read,write on directory dump to koarac;  
expdp 'ekpdev/"123"'@ekpdev  directory=dump dumpfile =aa.dmp logfile=aa.log

前2句在sqlplus执行  
第3句用oracle用户执行。  
执行过程中，因rollback segment过小，KM\_REVIEW\_MAIN没有导出完毕，因此扩展undo\_retention 由15分钟改为2小时。  
SQL&gt; show parameter undo

NAME                                 TYPE        VALUE  
\------------------------------------ ----------- ------------------------------  
undo\_management                      string      AUTO  
undo\_retention                       integer     900  
undo\_tablespace                      string      UNDOTBS1  
SQL&gt; alter system set undo\_retention=7200 ;

System altered.  
导入方案

--将dump\_scott目录下的schema.dmp导入到scott方案中  
impdp scott/tiger directory=dump\_scott dumpfile=schema.dmp schemas=scott       

--将scott方案中的所有对象转移到system方案中  
impdp system/redhat directory=dump\_scott dumpfile=schema.dmp schemas=scott remap\_schema=scott:system