|
| 1 | +# oradb-rman |
| 2 | + |
| 3 | +Manages RMAN Backups |
| 4 | + |
| 5 | +This role is written by Thorsten Bruhns <thorsten.bruhns@opitz-consulting.com> |
| 6 | +There is no warranty for any error in the scripts. Please test the Backup/Recovery after setup with ansible-oracle! |
| 7 | +This role used rman_backup.sh from https://github.com/Rendanic/oracleToolbox/blob/master/rman/linux/rman_backup.sh |
| 8 | + |
| 9 | +# Backup Strategies |
| 10 | +The role has templates for 3 different strategies. Please do not edit this templates, because patches for this role could create conflicts. You can create your own templates and use them within rman_jobs. |
| 11 | + |
| 12 | + |
| 13 | +* Online Backup to NFS |
| 14 | + |
| 15 | + Use the following names in rman_jobs: |
| 16 | + |
| 17 | + * archivelog |
| 18 | + * online_level0 |
| 19 | + * online_level1 |
| 20 | + |
| 21 | +* Backup compressed to Recovery-Area and then to NFS |
| 22 | + |
| 23 | + Use the following names in rman_jobs: |
| 24 | + |
| 25 | + * archivelog_fra_disk |
| 26 | + * online_level0_fra_disk |
| 27 | + * online_level1_fra_disk |
| 28 | + |
| 29 | + |
| 30 | +* Offline Backup to NFS |
| 31 | + |
| 32 | + Use the following names in rman_jobs: |
| 33 | + |
| 34 | + * offline_level0 |
| 35 | + * offline_level1 |
| 36 | + |
| 37 | +# Example Playbook |
| 38 | + |
| 39 | +You need root permissions for executing the role! |
| 40 | + |
| 41 | +``` |
| 42 | + - hosts: servers |
| 43 | + roles: |
| 44 | + - roles/oradb-rman |
| 45 | +``` |
| 46 | + |
| 47 | +# Configuration |
| 48 | +## Description of rman_jobs |
| 49 | +Cronjobs are only created when day, weekday, hour and minute are defined. |
| 50 | + |
| 51 | +* name |
| 52 | + |
| 53 | + Defines the name of the used template from roles/oradb-rman/templates |
| 54 | +* disabled |
| 55 | + |
| 56 | + Defines the state of cron entry. The cronentry is only disabled but not removed! |
| 57 | +* immediate |
| 58 | + |
| 59 | + This allows an immediate execution of RMAN for the named script. Please be aware thatt the order of elements defines the executionorder of the scripts. The RMAN is NOT executed in ASYNC mode of Ansible. This parameter is most used for the 1st configuration of the parameter. |
| 60 | + |
| 61 | +* service |
| 62 | + |
| 63 | + This parameter is only used in RAC Environments! |
| 64 | + rman_backup.sh will only start a backup when the service is active on te current node. This allows a cronjob on every clusternode with a failoverservice to make sure, that a backup is running when the 'normal' node has failed. The services must be added with srvctl add service for the Database. |
| 65 | + |
| 66 | +* day / weekday / hour / minute |
| 67 | + |
| 68 | + Variables for the cronjob. |
| 69 | + |
| 70 | +* rman_retention_policy |
| 71 | + |
| 72 | + This could be used to overwrite the global default of `rman_retention_policy`at database level. |
| 73 | + |
| 74 | +* |
| 75 | +## Example |
| 76 | + |
| 77 | +The backup is configured in oracle_databases with rman_jobs: |
| 78 | + |
| 79 | +``` |
| 80 | + oracle_databases: |
| 81 | + - home: db_home1 |
| 82 | + oracle_db_name: TEST |
| 83 | +
|
| 84 | + rman_jobs: |
| 85 | + - name: parameter |
| 86 | + - name: archivelog |
| 87 | + disabled: False |
| 88 | + day: "*" |
| 89 | + weekday: "*" |
| 90 | + hour: "*" |
| 91 | + minute: "10" |
| 92 | + - name: online_level0 |
| 93 | + disabled: False |
| 94 | + day: "*" |
| 95 | + weekday: "0" |
| 96 | + hour: "02" |
| 97 | + minute: "30" |
| 98 | + - name: online_level1 |
| 99 | + disabled: False |
| 100 | + day: "*" |
| 101 | + weekday: "1-6" |
| 102 | + hour: "02" |
| 103 | + minute: "30" |
| 104 | +``` |
| 105 | + |
| 106 | +## Variables |
| 107 | +The following variables are global. They are not part of oracle_databases! |
| 108 | + |
| 109 | +* rman_cronfile |
| 110 | + |
| 111 | + Defines the name of the cronfile in /etc/cron.d. Setting rman_cronfile: "" will use the cron of the oracle_user instead of /etc/cron.d |
| 112 | + |
| 113 | +* rman_cron_logdir |
| 114 | + |
| 115 | + Destination for cron execution which is redirected with `>> rman_cron_logdir 2>&1` |
| 116 | + Default is `/var/log/oracle` |
| 117 | + |
| 118 | +* rman_retention_policy |
| 119 | + |
| 120 | + Use rman_retention_policy_default when not defined. This variable could be used inside rman_jobs for individual retention policies for every Database. |
| 121 | + |
| 122 | +* rman_channel_disk |
| 123 | + |
| 124 | + This parameter must be defined. Otherwise the assert of the role will fail, because there is no usable default for this directory. |
| 125 | + |
| 126 | +* rman_retention_policy_default |
| 127 | + |
| 128 | + This values is used when rman_retention_policy is not defined inside rman_jobs:. |
| 129 | + `Default: "RECOVERY WINDOW OF 14 DAYS"` |
| 130 | + |
| 131 | +* rman_channel_disk_default |
| 132 | + |
| 133 | + `Default value: "DISK FORMAT '/u10/rmanbackup/%d/%d_%T_%U'"` |
| 134 | + |
| 135 | +* rman_controlfile_autobackup_disk_default |
| 136 | + |
| 137 | + This parameter must be defined. Otherwise the assert of the role will fail, because there is no usable default for this directory. |
| 138 | + |
| 139 | +## Howtos |
| 140 | +### How to configure the RMAN scripts? |
| 141 | +The role copies the templatefiles from role/oradb-rman/templates to $ORACLE_BASE/admin/<DB_NAME>/rman. The name in the list defines the name of the template with .j2 as extension. |
| 142 | + |
| 143 | +### How to configure the cron? |
| 144 | + |
| 145 | +The dictionary elements name, disabled, day, weekday, hour, minute are mandatory. The creation of cron only starts when every element is defined. |
| 146 | + |
| 147 | +### How to use custom RMAN scripts? |
| 148 | +Copy the script into the template directory `role/oradb-rman/templates` and add a `- name: <filename>` at `rman_jobs`. The filename must end with `.rman.j2` regardless of Junja2 in the file. You could use your own variables in the custom files and add entries to `rman_jobs`. They will be added as item.1.<dictionaryelement> to the template. |
| 149 | +Please do not edit existing files. They could be changed in future releases of oradb-rman. |
| 150 | + |
0 commit comments