[oracle@db worksh]$ more rmanback.sh
#!/bin/ksh
#set env
export ORACLE_HOME=/opt/oracle/product/9.2
export ORACLE_SID=test
export NLS_LANG="AMERICAN_AMERICA.zhs16gbk"
export PATH=$PATH:$ORACLE_HOME/bin
echo "-----------------------------start-----------------------------";date
#backup start
$ORACLE_HOME/bin/rman <<EOF
connect target
delete noprompt obsolete;
backup database format '/netappdata1/rmanback/tbdb2/%U_%s.bak' lesperset =
2;
exit;
EOF
echo "------------------------------end------------------------------";date
三、RMAN 的自动配置
Oracle 9i 可以配置一些参数如通道,备份保持策略等信息,通过一次设定可以多次使用,而
且,设置中的信息不影响脚本中的重新设置。RMAN 默认的配置参数,通过 show all 就可以
看出来。
RMAN> show all;
RMAN conguration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE BACKUP OPTIMIZATION OFF;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR TYPE DISK TO '%F';