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

(1)创建导出目录

> sqlplus system/oracleSQL> 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 KB1 rows

. . exported "PINGCHUAN"."TEST_TABLE2"4.937 KB1 rows

. . exported "ZTE"."TEST_TABLE3"4.929 KB1 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.dmpexp20150623.log

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值