Problem Description:
Implementation of the Oracle automatic backup script.
Error tip 1:
Message file RMAN.MSB not found
Verify that Oracle_home is set properly
。。。。。。
Error Reason:
Automatic execution does not recognize the appropriate command and requires an explicit declaration of Oracle's environment variables in an automatic backup script.
Error Tip 2:
Standard in must to be a TTY
。。。。。。
Error Reason:
You cannot use an SU or a pipe operation with Cron, and you must move the SU command to a related shell script.
Error Tip 3:
Argument Value Description
------------------------------------------------------------------------- ----
Target quoted-string connect-string for target database
Catalog quoted-string connect-string for recover Y Catalog
Nocatalog None if specified, then no recovery catalog
Cmdfile quoted-string name of input Comman d file
Log quoted-string name of output message log file
Trace quoted-string name of output debugging Messa GE log file
Append none if specified, log is opened in Append mode
Debug Optional-args Activate Debuggi Ng
Msgno None show rman-nnnn prefix for all messages
Send quoted-string send a command to the media ma Nager
Pipe string building block for pipe names
Timeout integer number of seconds Put
Checksyntax None Check the command file for syntax errors
----------------------------------------------- ------------------------------
Both single and double quotes (' or ") are accepted for a quoted-string. The
quotes are not required unless the string contains embedded.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR Message STACK follows ===============
RMAN-00571: ===========================================================
Rman-00556:could not open cmdfile "BACKUP_AR.RCV"
...
Error Reason:
You need to indicate an absolute path in cmdfile, and you cannot use file names directly or directly using them because the cmdfile that the shell script invokes is in the same directory.
Correct sample code:
1, #cron文件
0 12,18 * * */home/oracle/bak_sh/backup_ar.sh
#表示每天12, 18-point database Archive date to full backup
2, the entrance shell file, FileName: 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 Backup Script
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;
}
Workaround:
1. Two ways
The first is to use root CRONTAB,*/2 * * * * a.sh--"Su-oracle-c a.sh
One is to add Oracle to the A.SH environment.
2, we do the cron test:
Instance:
vi/etc/cron.minly/new.sh
Content:
Su–oracle–c "/home/oracle/mginfo.sh"
vi/home/oracle/mginfo.sh
Content:
EXP Mginfotech/mginfotech file=mginfotech.dmp Log=mginfotech.log
Vi/etc/crontab
Content:
* * * Root run-parts/etc/cron.minly
Executed every 23:59 minutes
Environment variables cannot be read in cron
Show the export environment variables in the shell
Export oracle_home=/opt/ora9/product/9.2
Export Oracle_sid=oracle
Export Nls_lang=xxxxx
and try again.