szhswl
          宋針還的個(gè)人空間

           問(wèn)題描述:
          oracle自動(dòng)備份腳本的實(shí)現(xiàn)。

          錯(cuò)誤提示1:
          Message file RMAN<lang>.msb not found
           
          Verify that ORACLE_HOME is set properly
           
          。。。。。。

          錯(cuò)誤原因:
          自動(dòng)執(zhí)行的不能夠識(shí)別相應(yīng)的命令,需要在自動(dòng)備份腳本中顯式的聲明oracle的環(huán)境變量。

          錯(cuò)誤提示2:
          standard in must be a tty
           
          。。。。。。

          錯(cuò)誤原因:
          不能在cron使用su或者管道等操作,必須將su命令移動(dòng)到相關(guān)的shell腳本中。

          錯(cuò)誤提示3:
          Argument     Value          Description
          -----------------------------------------------------------------------------
          target       quoted-string  connect-string for target database
          catalog      quoted-string  connect-string for recovery catalog
          nocatalog    none           if specified, then no recovery catalog
          cmdfile      quoted-string  name of input command file
          log          quoted-string  name of output message log file
          trace        quoted-string  name of output debugging message log file
          append       none           if specified, log is opened in append mode
          debug        optional-args  activate debugging
          msgno        none           show RMAN-nnnn prefix for all messages
          send         quoted-string  send a command to the media manager
          pipe         string         building block for pipe names
          timeout      integer        number of seconds to wait for pipe input
          checksyntax  none           check the command file for syntax errors
          -----------------------------------------------------------------------------
          Both single and double quotes (' or ") are accepted for a quoted-string.
          Quotes are not required unless the string contains embedded white-space.
           
          RMAN-00571: ===========================================================
          RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
          RMAN-00571: ===========================================================
          RMAN-00556: could not open CMDFILE "backup_ar.rcv"
           
          。。。。。。


          錯(cuò)誤原因:
          需要在cmdfile中指明絕對(duì)路徑,不能因?yàn)閟hell腳本調(diào)用的cmdfile是在同一個(gè)目錄下就可以直接使用文件名

          或者直接使用./

          正確示例代碼:

          1、#cron文件
          0 12,18 * * * /home/oracle/bak_sh/backup_ar.sh
          #表示每天12,18點(diǎn)對(duì)數(shù)據(jù)庫(kù)歸檔日至進(jìn)行全備份

          2、入口shell文件,文件名:backup_ar.sh
          export ORACLE_HOME=/home/u01/app/oracle/oracle/product/10.2.0/db_1
          export ORACLE_SID=test
          export LANG=en_US.UTF-8
          /home/u01/app/oracle/oracle/product/10.2.0/db_1/bin/rman cmdfile = backup_ar.rcv

          3、rman備份腳本
          connect target /
          connect catalog rman/rman@rman
          run{
          allocate channel d1 device type disk;
          sql 'alter system archive log current';
          backup archivelog all delete input
            format '/opt/rmanback/full_%u_%p_%c.ac' filesperset = 3;
          release channel d1;
          }

          學(xué)習(xí)入口(來(lái)自論壇):
          1、兩種辦法
          一是用root的crontab,*/2 * * * * a.sh --》su - oracle -c a.sh
          一是在a.sh里加上oracle的環(huán)境。


          2、我們做的cron測(cè)試:
          實(shí)例:
          Vi /etc/cron.minly/new.sh
          內(nèi)容:
          Su – oracle –c “/home/oracle/mginfo.sh”

          Vi /home/oracle/mginfo.sh
          內(nèi)容:
          Exp mginfotech/mginfotech file=mginfotech.dmp log=mginfotech.log

          Vi /etc/crontab
          內(nèi)容:
          59 23 * * * root run-parts /etc/cron.minly
          每晚23:59分鐘執(zhí)行


          cron中無(wú)法讀取環(huán)境變量
          在shell中顯示地export環(huán)境變量
          export ORACLE_HOME=/opt/ora9/product/9.2
          export ORACLE_SID=oracle
          export NLS_LANG=xxxxx



          ---------------------------------------------------------------------------------------------------------------------------------
          說(shuō)人之短,乃護(hù)己之短。夸己之長(zhǎng),乃忌人之長(zhǎng)。皆由存心不厚,識(shí)量太狹耳。能去此弊,可以進(jìn)德,可以遠(yuǎn)怨。
          http://www.aygfsteel.com/szhswl
          ------------------------------------------------------------------------------------------------------ ----------------- ---------
          posted on 2007-12-06 19:57 宋針還 閱讀(867) 評(píng)論(0)  編輯  收藏 所屬分類: ORACLE
          主站蜘蛛池模板: 南汇区| 临高县| 临漳县| 梁山县| 永丰县| 洛扎县| 星座| 遂川县| 九龙城区| 阳泉市| 新密市| 泌阳县| 湖北省| 鄢陵县| 竹溪县| 金华市| 县级市| 永德县| 郴州市| 修武县| 仪征市| 土默特左旗| 瑞昌市| 厦门市| 博乐市| 淳化县| 彭泽县| 手机| 昌乐县| 永登县| 万安县| 防城港市| 海安县| 沁阳市| 正安县| 且末县| 句容市| 肇源县| 漳平市| 钟祥市| 吴川市|