Oracle数据库数据恢复、性能优化

找回密码
注册
搜索
热搜: 活动 交友 discuz
发新帖

0

积分

1

好友

7

主题
1#
发表于 2014-9-28 16:48:01 | 查看: 3070| 回复: 2
本帖最后由 huziaa 于 2014-9-28 16:50 编辑

问个问题,unix 和redhat linux expdp输出日志格式问题:

测试了如下格式

expdp scott/tiger DIRECTORY=dmpdir DUMPFILE=tab.dmp TABLES=scott.dept,scott.emp logfile=/ebs3/pump/exp$(date +%H).log

expdp scott/tiger DIRECTORY=dmpdir DUMPFILE=tab.dmp TABLES=scott.dept,scott.emp logfile=/ebs3/pump/exp_`date +%H`.log

expdp scott/tiger DIRECTORY=dmpdir DUMPFILE=tab.dmp TABLES=scott.dept,scott.emp logfile=/ebs3/pump/exp_$(`date +%H`).log
这几种格式够测试过,不行。

希望提供一种合适可用的格式。

谢谢
2#
发表于 2014-9-28 17:17:24
FYI

http://askdba.org/weblog/2009/06 ... rent-date-and-time/

Few days back I got a request from development team to generate hourly export dumps of few schemas.

Following were the requirements:

1. Dumpfile name should contain current date and timestamp information.
2. The generated dumpfile should be moved to a specific location.
3. All users should have read privileges on the export dumpfile.
4. The export dump should be taken on hourly basis.

To accomplish this task I generated a shell script and scheduled it in crontab:

#!/bin/ksh
#Script to Perform Datapump Export Every Hour
################################################################
#Change History
#================
#DATE         AUTHOR                       cHANGE
#---------   -----------------------  -------------------
#23-jUN-2009 SAURABH SOOD        New Script Created
#
#
#
################################################################
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
expdp username/password@orcl dumpfile=expdp-`date '+%d%m%Y_%H%M%S'`.dmp directory=DATA_PUMP_DIR logfile=expdp-`date '+%d%m%Y_%H%M%S'`.log schemas=SCHEMA_A,SCHEMA_B
mv /tmp/expdp*.dmp /u01/backup/daily_export_orcl/
mv /tmp/expdp*.log /u01/backup/daily_export_orcl/
chmod o+r /s01/backup/daily_export_orcl/*
This script will do the following:


1. Set the ORACLE_HOME,ORACLE_SID and PATH in the environment settings.
2. Taken the datapump export to /tmp location as DATA_PUMP_DIR points to /tmp location.
3. Move the dump and log file to location /u01/backup/daily_export_orcl/
4. Change the permissions of the dumpfile so that any user can read the file.

The main thing here is to set the dumpfile name format. The following syntax is used for that:

DUMPFILE=expdp-`date ‘+%d%m%y_%H%M%S’`.dmp

The dumpfiles will be generated as expdp-23062009_090000.dmp, means that the export dump was taken on 23rd June 2009 at 9AM.

To schedule it on hourly basis crontab was modified as:
$ crontab -e

##############################################################
#Script Used To Create Hourly Exports Of orcl database Schemas
###############################################################
00 09-18 * * 1-6 /u01/backup/daily_export_orcl/export.sh >/dev/null
It will taken the export at 9AM,10AM,11AM,12AM,13PM,14PM,15PM,16PM,17PM,18PM on everyday except sunday.

回复 只看该作者 道具 举报

3#
发表于 2014-9-28 17:22:27
看到了,谢谢

$ expdp scott/tiger DIRECTORY=dmpdir DUMPFILE=tab.dmp TABLES=scott.dept,scott.emp logfile=exp_$(date +%Y%m%d-%H%M%S).log

Export: Release 11.1.0.7.0 - 64bit Production on Sunday, 28 September, 2014 17:18:36

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
Starting "SCOTT"."SYS_EXPORT_TABLE_02":  scott/******** DIRECTORY=dmpdir DUMPFILE=tab.dmp TABLES=scott.dept,scott.emp logfile=exp_20140928-171836.log
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

回复 只看该作者 道具 举报

您需要登录后才可以回帖 登录 | 注册

QQ|手机版|Archiver|Oracle数据库数据恢复、性能优化

GMT+8, 2024-12-21 02:02 , Processed in 0.047192 second(s), 21 queries .

Powered by Discuz! X2.5

© 2001-2012 Comsenz Inc.

回顶部
TEL/電話+86 13764045638
Email service@parnassusdata.com
QQ 47079569