Created
June 13, 2017 22:55
-
-
Save haukurk/9343e5519694f7057fed9d0ef87e989b to your computer and use it in GitHub Desktop.
Clean RMAN logs, without doing backup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
INPSID=x850 | |
usage() | |
{ | |
echo "delete some archivelogs ahy!" | |
echo "" | |
echo "./del_archivelogs.sh" | |
echo "\t-h --help" | |
echo "\t--sid=$INPSID" | |
echo "" | |
} | |
while [ "$1" != "" ]; do | |
PARAM=`echo $1 | awk -F= '{print $1}'` | |
VALUE=`echo $1 | awk -F= '{print $2}'` | |
case $PARAM in | |
-h | --help) | |
usage | |
exit | |
;; | |
--sid) | |
INPSID=$VALUE | |
;; | |
*) | |
echo "ERROR: unknown parameter \"$PARAM\"" | |
usage | |
exit 1 | |
;; | |
esac | |
shift | |
done | |
if [[ "$INPSID" = "x850" ]] ; then echo "hey, dont forget to pass me that --sid" ; return 1; fi | |
. /home/oracle/.profile | |
export ORACLE_SID=$INPSID | |
export ORAENV_ASK=NO | |
. /usr/local/bin/oraenv | |
rman target=/ nocatalog log=/tmp/del_arch_log.log <<EOF | |
ALLOCATE CHANNEL FOR MAINTENANCE device type disk; | |
delete force noprompt archivelog all completed before 'sysdate-4/24'; | |
EOF | |
echo `date -u` >> /tmp/del_arch_log.log | |
echo "the end" >> /tmp/del_arch_log.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment