首页 > 代码库 > 【翻译自mos文章】将expdp的dmp文件从asm磁盘组里边放到本地文件系统里边

【翻译自mos文章】将expdp的dmp文件从asm磁盘组里边放到本地文件系统里边

将expdp的dmp文件从asm磁盘组里边放到本地文件系统里边
参考原文:
How To Extract Datapump File From ASM Diskgroup To Local Filesystem? (Doc ID 566941.1)

适用于:
Oracle Database - Enterprise Edition - Version 11.1.0.6 to 11.1.0.7 [Release 11.1]
Information in this document applies to any platform.
Information in this document applies to any platform.

目标:
从11.1.0.6开始, asmcmd 提供了cp命令,该cp命令跟os上的cp命令类似。
你可以使用asmcmd cp命令 copy 出asm磁盘组中的所有文件。

解决方案:
举例:
1)在asm实例中建立一个directory
SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      +ASM

SQL> alter diskgroup FRA add directory ‘+FRA/dumpsets‘;

Diskgroup altered.

2)在数据库实例中建立一个directory--用于存放dmp文件
SQL>  show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------  
instance_name                        string      DB11G

SQL> create directory dumpsets as ‘+FRA/dumpsets‘;

Directory created.

3)在os上建立一个directory并在database 实例中,为此os directory 建立 db中的directory。该 os directory用于存放导出产生的logfile

SQL> ! mkdir /home/oracle/dumpsets

SQL> !ls -ld /home/oracle/dumpsets
drwxr-xr-x  2 oracle oinstall 4096 May  7 10:20 /home/oracle/dumpsets

SQL> create directory logfile_dest as ‘/home/oracle/dumpsets‘;

Directory created.


4)执行expdp导出数据
expdp  userid=system/storage01 directory=‘DUMPSETS‘ dumpfile=expdp_5_5.dat job_name=full_export logfile=logfile_dest:exp5_5.log  

Export: Release 11.1.0.6.0 - Production on Wednesday, 07 May, 2008 10:22:57

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYSTEM"."FULL_EXPORT":  userid=system/******** directory=DUMPSETS dumpfile=expdp_5_5.dat job_name=full_export logfile=logfile_dest:exp5_5.log  
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 320 KB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SYNONYM/SYNONYM
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
.
.
.
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/TRIGGER
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/POST_TABLE_ACTION
Processing object type SCHEMA_EXPORT/POST_SCHEMA/PROCACT_SCHEMA
. . exported "SYSTEM"."REPCAT$_AUDIT_ATTRIBUTE"          6.398 KB       2 rows
. . exported "SYSTEM"."REPCAT$_OBJECT_TYPES"             6.882 KB      28 rows
. . exported "SYSTEM"."REPCAT$_RESOLUTION_METHOD"        5.875 KB      19 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_STATUS"          5.484 KB       3 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_TYPES"           6.289 KB       2 rows
. . exported "SYSTEM"."DEF$_AQCALL"                          0 KB       0 rows
. . exported "SYSTEM"."DEF$_AQERROR"                         0 KB       0 rows
.
.
.
. . exported "SYSTEM"."REPCAT$_SITE_OBJECTS"                 0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_SNAPGROUP"                    0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_OBJECTS"             0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_PARMS"               0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_REFGROUPS"           0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_SITES"               0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_TEMPLATE_TARGETS"             0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_USER_AUTHORIZATIONS"          0 KB       0 rows
. . exported "SYSTEM"."REPCAT$_USER_PARM_VALUES"             0 KB       0 rows
. . exported "SYSTEM"."SQLPLUS_PRODUCT_PROFILE"              0 KB       0 rows
Master table "SYSTEM"."FULL_EXPORT" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.FULL_EXPORT is:
  +FRA/dumpsets/expdp_5_5.dat


5)dmp文件被创建在了+FRA/dumpsets/下。

ASMCMD> ls -l  +FRA/dumpsets/expdp_5_5.dat
Type     Redund  Striped  Time             Sys  Name
                                           N    expdp_5_5.dat => +FRA/DB11G/DUMPSET/SYSTEMFULL_EXPORT_71029_1.303.654085391
                                           
6)将此dmp文件从asm 磁盘组中拷贝到os 的directory中。
ASMCMD> pwd  
+fra/dumpsets
ASMCMD> ls
expdp_5_5.dat
ASMCMD>  cp expdp_5_5.dat /home/oracle/dumpsets/expdp_5_5.dat
source +fra/dumpsets/expdp_5_5.dat
target /home/oracle/dumpsets/expdp_5_5.dat
copying file(s)...
file, /home/oracle/dumpsets/expdp_5_5.dat, copy committed.
ASMCMD> exit
$> ls -l /home/oracle/dumpsets/expdp_5_5.dat
-rw-r-----  1 oracle oinstall 2289664 May  7 11:05 /home/oracle/dumpsets/expdp_5_5.dat