oracle 备份脚本

[oracle@testdb nfs]$ cat rman_level0.sh
#!/bin/bash
source ~/.bash_profile
rman target / nocatalog log /home/oracle/nfs/rman_full.log append << EOF
run
{allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
backup  filesperset 3 as compressed backupset database format '/home/oracle/nfs/full_data_%d_%T_%s_%p';
sql 'alter system archive log current';
sql 'alter system archive log current';
sql 'alter system archive log current';
sql 'alter system archive log current';
sql 'alter system archive log current';
backup archivelog all format '/home/oracle/nfs/arch_%d_%T_%s_%p' delete input;
backup current controlfile format '/home/oracle/nfs/ctl_%d_%T_%s_%p';
}
EOF
rman target / nocatalog log /home/oracle/nfs/rman_delete.log append << EOF
  allocate channel for maintenance type disk; 
  crosscheck backup; 
  crosscheck archivelog all; 
  delete noprompt expired backup; 
  crosscheck copy; 
  delete noprompt  obsolete;
EOF

原文地址:https://www.cnblogs.com/ss-33/p/8706619.html