UNIX下使用EXPDP备份数据库

expdp逻辑备份数据库文件存储到ASM磁盘组中。
经测试,EXPDP导出文件完全可以放在ASM磁盘组中,但是日志文件需要放在文件系统上。

首先建立磁盘组中的Directory:
SQL> create or replace directory obak as '+ORADATA/obak';

Directory created.

将Directory 读写权限分配给导出用户:
SQL> grant read,write on directory obak to eygle;

手工创建目录( 使用ORACLE用户建立该目录,要不然EXPDP识别不到):
[oracle@oracle ~]$ export ORACLE_SID=+ASM1
[oracle@oracle ~]$ asmcmd
ASMCMD> ls
ORADATA/
RECOVER/
ASMCMD> cd ORADATA
ASMCMD> ls
ORADB/
ASMCMD> mkdir obak
ASMCMD> ls
ORADB/
obak/
ASMCMD> exit

如果直接执行导出,会出现错误:

    [oracle@oracledb3 ~]$ expdp eygle/eygle DUMPFILE=eygle.dmp DIRECTORY=OBAK CONTENT=METADATA_ONLY

    Export: Release 10.2.0.5.0 - 64bit Production on Friday, 06 May, 2011 10:49:48

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

    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options
    ORA-39002: invalid operation
    ORA-39070: Unable to open the log file.
    ORA-29283: invalid file operation
    ORA-06512: at "SYS.UTL_FILE", line 536
    ORA-29283: invalid file operation


此时需要找到一个文件系统的路径:

    SQL> select directory_name, directory_path from dba_directories;

    DIRECTORY_NAME
    ------------------------------
    DIRECTORY_PATH
    ---------------------------------------------------------------------------------------------------
    DATA_PUMP_DIR
    /opt/app/oracle/product/10.2.0/db_1/rdbms/log/

    OBAK
    +ORADATA/obak


现在为LOGFILE指定独立的路径,即可导出成功


    [oracle@oracle ~]$ expdp eygle/eygleDUMPFILE=eygle.dmp DIRECTORY=OBAK CONTENT=METADATA_ONLY logfile=DATA_PUMP_DIR:expdp01.log

    Export: Release 10.2.0.5.0 - 64bit Production on Friday, 06 May, 2011 10:53:11

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

    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Data Mining and Real Application Testing options
    FLASHBACK automatically enabled to preserve database integrity.
    Starting "EYGLE"."SYS_EXPORT_SCHEMA_01":  eygle/******** DUMPFILE=eygle.dmp DIRECTORY=OBAK CONTENT=METADATA_ONLY logfile=DATA_PUMP_DIR:expdp01.log
    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/DB_LINK
    Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
    Processing object type SCHEMA_EXPORT/TABLE/TABLE
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
    Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
    Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
    Processing object type SCHEMA_EXPORT/TABLE/COMMENT
    Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION
    Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
    Processing object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION
    Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
    Processing object type SCHEMA_EXPORT/VIEW/VIEW
    Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
    Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    Processing object type SCHEMA_EXPORT/JOB
    Master table "EYGLE"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
    ******************************************************************************
    Dump file set for EYGLE.SYS_EXPORT_SCHEMA_01 is:
      +ORADATA/obak/eygle.dmp
    Job "EYGLE"."SYS_EXPORT_SCHEMA_01" successfully completed at 10:53:40
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值