RE: Shell script for ASM Metadata

From: Ruel, Chris <Chris.Ruel_at_lfg.com>
Date: Thu, 15 Sep 2016 20:57:16 +0000
Message-ID: <1AFD62082EEAF0448EF1815139687F1369BAE8DE_at_NC2PWEX504.us.ad.lfg.com>



I have this script. I left out some code that sets our environment because it is pretty specific to our company and does a lot of custom stuff. You can just use oraenv by itself.

### Script: asm_metadata_backup.ksh

export ORAENV_ASK=NO
export ORACLE_SID=$1

. /usr/local/bin/oraenv

export ASM_MD_DATE=`date '+%d_%b_%Y_%H%M'`

asmcmd md_backup /backup/oracle/asm/asm_metadata_backup_${ASM_MD_DATE}.bak > ${ORA_LOGS}/asm_metadata_backup_${ASM_MD_DATE}.log

export ECODE=$?

if [ $ECODE -eq 0 ]; then

        echo "`date`" | mailx -s "ASM MetaData Backup Success For Cluster ${ORA_CLUSTER_NAME}" BACKUP_INFO else

        echo "`date`" | mailx -s "ALERT! ASM MetaData Backup FAIL for Cluster ${ORA_CLUSTER_NAME}" BACKUP_ALERT fi

# Remove ASM Metadata Backups Older than 14 days:
find /backup/oracle/asm -mtime +14 -exec rm -f {} \;

This above then runs with an argument from cron:

# Daily ASM Metadata Backup
# 45 03 * * * ~grid/scripts/asm/asm_metadata_backup.ksh +ASM1 1> ~grid/scripts/logs/cron_asm_md_backup_$(date +\%Y_\%m_\%d_\%H\%M).log 2>&1

You’ll might have to hack it a little bit to get it to work for you but I think the basics are clear…

Chris…



Chris Ruel * Oracle Database Administrator * Lincoln Financial Group cruel_at_lfg.com<mailto:cruel_at_lfg.com> * Desk:317.759.2172 * Cell 317.523.8482

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Sanjay Mishra Sent: Thursday, September 15, 2016 4:36 PM To: Oracle-L Freelists
Subject: Shell script for ASM Metadata

Hi

Can anyone please share the shell script you are using to take ASM metadata using md_backup command ?

Thanks
Sanjay
Notice of Confidentiality: **This E-mail and any of its attachments may contain Lincoln National Corporation proprietary information, which is privileged, confidential, or subject to copyright belonging to the Lincoln National Corporation family of companies. This E-mail is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this E-mail, you are hereby notified that any dissemination, distribution, copying, or action taken in relation to the contents of and attachments to this E-mail is strictly prohibited and may be unlawful. If you have received this E-mail in error, please notify the sender immediately and permanently delete the original and any copy of this E-mail and any printout. Thank You.**

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Sep 15 2016 - 22:57:16 CEST

Original text of this message