For most people out there in the Oracle wild, a standard RMAN might be sufficient. However, in case you have Oracle Restart and ASM in place, I would consider to add a few more files to your backup strategy. Even if OS backup should cover a few things already, I still would consider backing up these files independently.
As a minimum I would consider the following:
- Backup your udev rules (if you have any)
- Oracle Local Registry (OLR) physical backup
- Oracle Local Registry (OLR) logical backup
- ASM metadata backup
- ASM spfile backup
- ASM password file backup
- Backup listener.ora, sqlnet.ora, tnsnames.ora which are in GI_HOME/network/admin/
Maybe, depending how paranoid you are, you might want to backup the ASM audit files as well.
All of these extra backups can be automated quite easily via a shell script. All of them can be run via the Grid Infrastructure owner. (User oracle in my case), except the ocrconfig backup (This one has to be run as root, or sudo).
Attached is a little script that does the job. The script is far away from being perfect, however, you got the idea. 🙂
[oracle@ocm200 bin]$ cat asm_backup.sh #!/bin/bash #------------------------------------------------------------------------------------------------------------------------# #-- Author: William, Pt(78)DB #-- #-- Purpose: Backup relevant ASM data #-- #-- #-- #-- #-- History: #-- Date Version Who What #-- 02.11.2020 Version: 0.1 Pt(78)DB Created initial version #-- #-- #------------------------------------------------------------------------------------------------------------------------# #-- Debugging #-- set -x #------------------------------------------------------------------------------------------------------------------------# #-- Source GRID environment variables . /home/oracle/GRID #-- Some variables BkpDirectory=/u01/app/oracle/admin/+ASM/bkp Date=`date +"%Y%m%d%H%M%S"` #------------------------------------------------------------------------------------------------------------------------# #-- Backup udev rules echo "INFO: Backing up udev rules" cp /etc/udev/rules.d/96-storage-asm.rules ${BkpDirectory}/96-storage-asm.rules.${Date} #------------------------------------------------------------------------------------------------------------------------# #-- Backup Oracle Local Registry (OLR), Physical backup echo "INFO: Backing up physical OLR" sudo /u01/grid/19c/bin/ocrconfig -local -manualbackup BkpOLRFile=`ocrconfig -local -showbackup manual | head -2 | tail -1 | awk '{ print $4 }'` cp ${BkpOLRFile} ${BkpDirectory}/OLR_physical_backup.olr.${Date} #------------------------------------------------------------------------------------------------------------------------# #-- Oracle Local Registry (OLR), Logical backup echo "INFO: Backing up logical OLR" ocrconfig -local -export ${BkpDirectory}/OLR_logical_backup.bkp.${Date} #------------------------------------------------------------------------------------------------------------------------# #-- ASM metadata backup #-- md_backup command creates a backup file containing metadata for one or more disk groups echo "INFO: Backing up ASM metadata" asmcmd -v info --privilege sysdba md_backup ${BkpDirectory}/md_backup_all_diskgroups.bkp.${Date} #------------------------------------------------------------------------------------------------------------------------# #-- ASM spfile backup echo "INFO: Backing up the ASM spfile" ASMSpfileLoc=`asmcmd -v info --privilege sysasm spget` asmcmd -v info --privilege sysasm spbackup ${ASMSpfileLoc} ${BkpDirectory}/ASM_spfile.bkp.${Date} #------------------------------------------------------------------------------------------------------------------------# #-- ASM password file backup echo "INFO: Backing up the ASM password file" ASMPwdLoc=`asmcmd -v info --privilege sysasm pwget --asm` asmcmd -v info --privilege sysasm pwcopy ${ASMPwdLoc} ${BkpDirectory}/ASM_password_file.bkp.${Date} #------------------------------------------------------------------------------------------------------------------------# #-- Backup listener.ora, sqlnet.ora, tnsnames.ora which are in GI_HOME/network/admin/ echo "INFO: Backing up listener.ora, sqlnet.ora, tnsnames.ora" cp $ORACLE_HOME/network/admin/listener.ora ${BkpDirectory}/listener.ora.${Date} cp $ORACLE_HOME/network/admin/sqlnet.ora ${BkpDirectory}/sqlnet.ora.${Date} cp $ORACLE_HOME/network/admin/tnsnames.ora ${BkpDirectory}/tnsnames.ora.${Date} #------------------------------------------------------------------------------------------------------------------------# #-- Maybe, depending how paranoid you are, you might want to backup ASM audit files as well #------------------------------------------------------------------------------------------------------------------------# #-- EOF
You can fire it up manually before you do major changes on your ASM infrastructure, or you can run it via cron to do regular ASM backups.
[oracle@ocm200 bin]$ ./asm_backup.sh INFO: Backing up udev rules INFO: Backing up physical OLR ocm200 2020/11/02 04:50:45 /u01/app/oracle/crsdata/ocm200/olr/backup_20201102_045045.olr 376483838 ocm200 2020/11/02 04:40:15 /u01/app/oracle/crsdata/ocm200/olr/backup_20201102_044015.olr 376483838 ocm200 2020/11/02 04:25:18 /u01/app/oracle/crsdata/ocm200/olr/backup_20201102_042518.olr 376483838 ocm200 2020/11/02 04:21:00 /u01/app/oracle/crsdata/ocm200/olr/backup_20201102_042100.olr 376483838 ocm200 2020/11/02 04:12:57 /u01/app/oracle/crsdata/ocm200/olr/backup_20201102_041257.olr 376483838 INFO: Backing up logical OLR PROTL-58: successfully exported the Oracle Local Registry contents to file '/u01/app/oracle/admin/+ASM/bkp/OLR_logical_backup.bkp.20201102045045' INFO: Backing up ASM metadata Disk group metadata to be backed up: DATA Disk group metadata to be backed up: FRA Current alias directory path: ASM Current alias directory path: CDB/TEMPFILE Current alias directory path: CDB/B2A5A66496D31A24E0550A00277AF8B2 Current alias directory path: ASM/ASMPARAMETERFILE Current alias directory path: CDB/86B637B62FE07A65E053F706E80A27CA/DATAFILE Current alias directory path: CDB/B2A570A6E40F0BD8E0550A00277AF8B2/TEMPFILE Current alias directory path: CDB/B2A5A66496D31A24E0550A00277AF8B2/TEMPFILE Current alias directory path: CDB/DATAFILE Current alias directory path: CDB/B2A570A6E40F0BD8E0550A00277AF8B2 Current alias directory path: CDB/B2A5A66496D31A24E0550A00277AF8B2/DATAFILE Current alias directory path: CDB/86B637B62FE07A65E053F706E80A27CA Current alias directory path: ASM/PASSWORD Current alias directory path: CDB/PARAMETERFILE Current alias directory path: CDB/CONTROLFILE Current alias directory path: CDB Current alias directory path: CDB/ONLINELOG Current alias directory path: CDB/BACKUPSET Current alias directory path: CDB/CONTROLFILE Current alias directory path: CDB/B2A570A6E40F0BD8E0550A00277AF8B2/BACKUPSET/2020_10_27 Current alias directory path: CDB/ONLINELOG Current alias directory path: CDB/AUTOBACKUP/2020_10_27 Current alias directory path: CDB/B2A5A66496D31A24E0550A00277AF8B2 Current alias directory path: CDB/B2A570A6E40F0BD8E0550A00277AF8B2/BACKUPSET Current alias directory path: CDB/B2A5A66496D31A24E0550A00277AF8B2/BACKUPSET/2020_10_27 Current alias directory path: CDB/B2A5A66496D31A24E0550A00277AF8B2/BACKUPSET Current alias directory path: CDB Current alias directory path: CDB/B2A570A6E40F0BD8E0550A00277AF8B2 Current alias directory path: CDB/ARCHIVELOG Current alias directory path: CDB/AUTOBACKUP Current alias directory path: CDB/BACKUPSET/2020_10_27 Current alias directory path: CDB/ARCHIVELOG/2020_10_28 INFO: Backing up the ASM spfile INFO: Backing up the ASM password file copying +DATA/orapwasm -> /u01/app/oracle/admin/+ASM/bkp/ASM_password_file.bkp.20201102045045 INFO: Backing up listener.ora, sqlnet.ora, tnsnames.ora
After running the script, you should see a few files in your backup directory.
[oracle@ocm200 bkp]$ ls -l total 1728 -rw-r--r--. 1 oracle oinstall 1036 Nov 2 04:50 96-storage-asm.rules.20201102045045 -rw-r-----. 1 oracle oinstall 2560 Nov 2 04:50 ASM_password_file.bkp.20201102045045 -rw-r-----. 1 oracle oinstall 1536 Nov 2 04:50 ASM_spfile.bkp.20201102045045 -rw-r--r--. 1 oracle oinstall 548 Nov 2 04:50 listener.ora.20201102045045 -rw-r--r--. 1 oracle oinstall 37800 Nov 2 04:50 md_backup_all_diskgroups.bkp.20201102045045 -rw-------. 1 oracle oinstall 139264 Nov 2 04:50 OLR_logical_backup.bkp.20201102045045 -rw-------. 1 oracle oinstall 1564672 Nov 2 04:50 OLR_physical_backup.olr.20201102045045 -rw-r-----. 1 oracle oinstall 169 Nov 2 04:50 sqlnet.ora.20201102045045 -rw-r-----. 1 oracle oinstall 418 Nov 2 04:50 tnsnames.ora.20201102045045 [oracle@ocm200 bkp]$
Conclusion
Doing RMAN backups of your database is the most important thing, however, in case you run it on ASM, you might want to extend your backup strategy by including some ASM files. Hope you find this blog post helpful.
Cheers
William