From 06100d65de9f91398c0adb0f0b9bd461f84661d2 Mon Sep 17 00:00:00 2001 From: x p k Date: Fri, 7 Oct 2022 10:48:59 +0800 Subject: [PATCH] NEW: archivelog backup scripts --- oracle/rman-archivelog-backup.rcv | 15 +++++++++++++++ oracle/rman-archivelog-backup.sh | 10 ++++++++++ 2 files changed, 25 insertions(+) create mode 100644 oracle/rman-archivelog-backup.rcv create mode 100644 oracle/rman-archivelog-backup.sh diff --git a/oracle/rman-archivelog-backup.rcv b/oracle/rman-archivelog-backup.rcv new file mode 100644 index 0000000..fe285e6 --- /dev/null +++ b/oracle/rman-archivelog-backup.rcv @@ -0,0 +1,15 @@ +connect target / + +run { + ALLOCATE CHANNEL disk1 DEVICE TYPE DISK MAXPIECESIZE 5G; + crosscheck archivelog all; + backup archivelog all not backed up 1 times format '/orabackup/arch/%d_%s_%p_%t'; + release channel disk1 ; +} + +run +{ + delete noprompt archivelog until time = 'sysdate-2' backed up 1 times to device type disk; +} + +exit; diff --git a/oracle/rman-archivelog-backup.sh b/oracle/rman-archivelog-backup.sh new file mode 100644 index 0000000..4c5076f --- /dev/null +++ b/oracle/rman-archivelog-backup.sh @@ -0,0 +1,10 @@ +#!/bin/bash +export ORACLE_BASE=/u01/app/oracle +export ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_home +export PATH=$ORACLE_HOME/bin:$PATH +export LOG_DIR=/orabackup/logs +export DATE=$(date +%d) +for i in bvcprsu1 bvalfpr1 bvcprsw1; do + export ORACLE_SID=$i + rman cmdfile=/orabackup/scripts/rman-archivelog-backup.rcv log=$LOG_DIR/${DATE}_${ORACLE_SID}.log +done