ITPub博客

首页 > 数据库 > Oracle > Oracle使用数据泵定时备份多个schema的脚本

Oracle使用数据泵定时备份多个schema的脚本

原创 Oracle 作者:zhenghaishu 时间:2015-06-24 10:07:24 0 删除 编辑

(1)创建导出目录
> sqlplus system/oracle
SQL> create directory dump_dir as '/home/oracle/dump';

Directory created.

(
2)编写脚本

脚本存放位置:/home/oracle/

脚本名称:backup_logic.sh

脚本内容:

#!/bin/bash

 

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1

export ORACLE_SID=zxin

export PATH=$PATH:$ORACLE_HOME/bin

 

EXPFILE=`date '+exp%Y%m%d.dmp'`

LOGFILE=`date '+exp%Y%m%d.log'`

 

expdp system/oracle directory=dump_dir dumpfile=$EXPFILE logfile=$LOGFILE schemas=pingchuan,zte;

 

(3)执行脚本

> cd /home/oracle/

> ./backup_logic.sh

Export: Release 10.2.0.1.0 - 64bit Production on 星期二, 23 6月, 2015 18:26:12

 

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

 

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production

With the Partitioning, OLAP and Data Mining options

Starting "SYSTEM"."SYS_EXPORT_SCHEMA_01":  system/******** directory=dump_dir dumpfile=exp_2015062318.dmp logfile=exp_2015062318.log schemas=pingchuan,zte

Estimate in progress using BLOCKS method...

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 192 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/TABLE/TABLE

Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

. . exported "PINGCHUAN"."TEST_TABLE"                    4.937 KB       1 rows

. . exported "PINGCHUAN"."TEST_TABLE2"                   4.937 KB       1 rows

. . exported "ZTE"."TEST_TABLE3"                         4.929 KB       1 rows

Master table "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded

******************************************************************************

Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:

  /home/oracle/dump/exp_2015062318.dmp

Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at 18:26:18

 

(4)检查结果

> cd /home/oracle/dump

> ls

exp20150623.dmp  exp20150623.log

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29485627/viewspace-1710095/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-02-14

  • 博文量
    112
  • 访问量
    1057345