ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 保留最近的2个归档

保留最近的2个归档

原创 Linux操作系统 作者:perfychi 时间:2012-11-01 17:47:03 0 删除 编辑
#!/bin/bash

. /home/oracle/.bash_profile

keep=2
seq=`sqlplus  -S / as sysdba <
set pagesize 0  feedback off linesize 200 echo off termout off trimspool on
select max(sequence#)-$keep from v\\$archived_log;
exit
EOF`

rman target / <
delete noprompt archivelog  until sequence $seq;
exit;
<
----------------------------------------------------------------------------------


#!/bin/bash

. /home/oracle/.bash_profile

keep=2
seq=`sqlplus  -S / as sysdba <
set pagesize 0  feedback off linesize 200 echo off termout off trimspool on
select max(sequence#)-$keep from v\\$archived_log;
exit
EOF`

rman target / <
delete noprompt archivelog  high sequence $seq;
exit;


-----------------------------------------------------------------


#!/bin/bash

. /home/oracle/.bash_profile

keep=2
seq=`sqlplus  -S / as sysdba <
set pagesize 0  feedback off linesize 200 echo off termout off trimspool on
select max(sequence#)-$keep from v\\$archived_log;
exit
EOF`

rman target / <
delete noprompt archivelog  high logseq $seq;
exit;
<

--------------------------------------------------------------


#!/bin/bash

. /home/oracle/.bash_profile

keep=2
seq=`sqlplus  -S / as sysdba <
set pagesize 0  feedback off linesize 200 echo off termout off trimspool on
select max(sequence#)-$keep from v\\$archived_log;
exit
EOF`

rman target / <
delete noprompt archivelog  until logseq $seq;
exit;
<

-----------------------------------------------------------

 上面都是可以的,综上所述: ("<=>" 表示等价)
logseq  <=> sequence
low <=> from   (low与high成对出现,from与until成对出现)
high <=> until

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/27042095/viewspace-748116/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论