-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbck_minimize_load
73 lines (59 loc) · 2.32 KB
/
bck_minimize_load
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
### This script will be sourced into the rman_bck.sh script and is responsible for creating the rman backup command string
###
### Created to allow backups with the "backup duration ... minimize load" clause
debugmsg 1 "Start of external script ${EXTERNAL_SCRIPT}"
CMD_STR="
ORACLE_HOME=$ORACLE_HOME ; export ORACLE_HOME
ORACLE_SID=$ORACLE_SID ; export ORACLE_SID
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH ; export LD_LIBRARY_PATH
NLS_DATE_FORMAT='DD/MM/YYYY HH24:MI:SS' ; export NLS_DATE_FORMAT
$RMAN msglog $RMAN_LOG_FILE append << EOF
$TARGET_CONNECT_STR
$CATALOG_CONNECT_STR
set echo on
### Enable the controlfile autobackup
### This is not realy necessary as we are using an rman database catalog
configure controlfile autobackup format for device type 'SBT_TAPE' to '%F';
configure controlfile autobackup on;
### Set the channel configuration
configure device type sbt parallelism $PARALLELISM;
configure default device type to sbt;
configure channel device type sbt format '%U' PARMS='ENV=(NB_ORA_CLIENT=$NB_ORA_CLIENT, NB_ORA_POLICY=$NB_ORA_POLICY, NB_ORA_SCHED=$APPLICATION_SCHEDULE)';
### Output the configuration
show all;
### Remove the expired backups from the recovery catalog
### Do this before taking the backup as this may influence the incremental level actually used
allocate channel for maintenance device type 'SBT_TAPE';
send 'NB_ORA_CLIENT=$NB_ORA_CLIENT';
crosscheck backup;
delete force noprompt expired backup;
release channel;
### Backup the database plus archivelogs
### Remove the archivelogs after the backup
run
{ backup
$BACKUP_OPTIONS
tag $BACKUP_TAG
archivelog all delete all input;
backup
$BACKUP_OPTIONS
tag $BACKUP_TAG
duration 6:00
minimize load
database
include current controlfile
;
sql \"alter system archive log current\";
backup
$BACKUP_OPTIONS
tag $BACKUP_TAG
archivelog all delete all input;
}
### Clear the channel configuration
configure device type sbt clear;
configure default device type clear;
configure channel device type sbt clear;
EOF
"
debugmsg 2 " CMD_STR: $CMD_STR"
debugmsg 1 "End of external script ${EXTERNAL_SCRIPT}"