crontab 定時備份oracle資料失敗的處理方法

來源:互聯網
上載者:User

指令碼:

#!/bin/bash

newfilename=`date +%Y%m%d`.dmp
newlogfilename=`date +%Y%m%d`.log
cd /oracle/backup

exp user/password buffer=102400000 file=/oracle/backup/dump.dmp log=/oracle/backup/dump.log tables=(tablea,table2,table3)

mv dump.dmp $newfilename
mv dump.log $newlogfilename

發現備份失敗.增加錯誤資訊記錄如下

/oracle/10.2/bin/exp user/password buffer=102400000 file=/oracle/backup/dump.dmp log=/oracle/backup/dump.log tables=(tablea,table2,table3) >>exp_msg.log 2>&1

發現提示錯誤如下:

Message 206 not found; No message file for product=RDBMS, facility=EXP: Release 10.2.0.5.0 - Production on Wed Feb 8 13:35:02 2012

Copyright (c) 1982, 2007,

Oracl Invalid format of Export utility name

Verify that ORACLE_HOME is properly set

Export terminated unsuccessfullyEXP-00000: Message 0 not found; No message file for product=RDBMS, facility=EXP

修改後的指令碼:

#!/bin/bash
export ORACLE_BASE=/oracle
export ORACLE_HOME=/oracle/10.2
export ORACLE_SID=DB
newfilename=`date +%Y%m%d`.dmp
newlogfilename=`date +%Y%m%d`.log
cd /oracle/backup

/oracle/10.2/bin/exp user/password buffer=102400000 file=/oracle/backup/dump.dmp log=/oracle/backup/dump.logtables=table1,table2,table3>>exp_msg.log 2>&1

mv dump.dmp $newfilename
mv dump.log $newlogfilename

原因:crontab調度的指令碼中tables選項不能夠使用括弧,但是單獨執行的指令碼則可以有括弧

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.