Oracle rman 指令碼

j04212發表於2014-02-13


1、shell指令碼

1)vi rman_backup.cmd
#rman_backup.cmd
connect target /
run
{
  allocate channel d1 device type disk;
  backup database format='/u01/backup/%T_%d_%s.bak' plus archivelog;
  sql 'alter system archive log current';
  backup current controlfile format='/u01/backup/%T_%d_%s.ctl';
  release channel d1;
}


2)vi rman_backup.sh

#!/bin/bash
rman @'/u01/rman_backup.cmd'


3)sh rman_backup.sh

[oracle@serv11 u01]$ sh rman_backup.sh


2、rman指令碼
1)vi backup.rman
#backup.rman
run
{
  allocate channel d1 device type disk;
  backup database format='/u01/backup/%T_%d_%s.bak' plus archivelog;
  sql 'alter system archive log current';
  backup current controlfile format='/u01/backup/%T_%d_%s.ctl';
  release channel d1;
  sql 'alter system archive log current';

}


2)在rman中手動呼叫指令碼

RMAN> @/u01/backup.rman

注意:語句後面不能加分號

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27633655/viewspace-1080634/,如需轉載,請註明出處,否則將追究法律責任。

相關文章