# Script: dbb_gen_list.shl # # Parameters: Oracle SID to back up # # Description: Create the list of files matching the given Oracle SID # to be backed up. The files must also end in .ora, .dbf, .ctl, .rdo, # or .arc. You must be logged in as a user that has access rights # to read those files and the directories they are in. # # Get the Oracle SID to back up, if not specified on the command line. # To default to current oracle SID, replace the "then" clause with: # then BACKUP_SID=$ORACLE_SID # # Updates: # 7/25/02 - Also include zipped archive logs. # 5/31/05 - Exclude similar SID directories (such as PPRD2 for PPRD). # if [ $# = 0 ] then echo "Backup SID (will be converted to upper case): \c"; read BACKUP_SID else BACKUP_SID=$1 fi # # Convert the SID to upper case. # echo $BACKUP_SID | tr '[a-z]' '[A-Z]' | read BACKUP_SID # # Find the files with names containing the SID and ending in .ora, .dbf, # .ctl, or .rdo, sorting all except for the first directory level. # (2>/dummy in the find command keeps error messages from being included.) # find / -name "*${BACKUP_SID}*" ! -type d 2>/dummy | grep -v "/[^/]*${BACKUP_SID}[^/].*/" | egrep '(\.ora$|\.dbf$|\.ctl$|\.rdo$)' | sort -t/ -k3 >backup_list.lst # # Add the archivelog files with names containing the SID and ending in .arc # or .arc.gz., sorting all except for the first directory level. (I like to # see the data files first and the archivelog files last. Otherwise, this # could have been combined with the first find.) # find / -name "*${BACKUP_SID}*.arc.gz" ! -type d 2>/dummy | grep -v "/[^/]*${BACKUP_SID}[^/].*/" | sort -t/ -k3 >>backup_list.lst find / -name "*${BACKUP_SID}*.arc" ! -type d 2>/dummy | grep -v "/[^/]*${BACKUP_SID}[^/].*/" | sort -t/ -k3 >>backup_list.lst