Configure Controlfile autobackup
I parametri di configurazione di RMAN sono memorizzati nel control file del db target indipendentemente dall'utilizzo del recovery catatlog.
RMAN> show all;
RMAN configuration parameters for database with db_unique_name TEST1 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_TEST1.f'; # default
oppure
RMAN> show controlfile autobackup;
RMAN configuration parameters for database with db_unique_name TEST1 are:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
Per impostare l'autoback a ON eseguire il comando.
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
RMAN> show all;
RMAN configuration parameters for database with db_unique_name TEST1 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_TEST1.f'; # default
Ogni volta che viene effettuato un backup del db o del datafile 1 (system) o del controlfile viene creato sotto la FRA (flash recovery area) la direcorty "autobackup" contente la copia del controfile e del file spfile.
RMAN> backup current controlfile;
Starting backup at 15-JAN-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 15-JAN-19
channel ORA_DISK_1: finished piece 1 at 15-JAN-19
piece handle=/u01/app/oracle/fast_recovery_area/TEST1/TEST1/backupset/2019_01_15/o1_mf_ncnnf_TAG20190115T152649_g3vvfbvh_.bkp tag=TAG20190115T152649 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 15-JAN-19
Starting Control File and SPFILE Autobackup at 15-JAN-19
piece handle=/u01/app/oracle/fast_recovery_area/TEST1/TEST1/autobackup/2019_01_15/o1_mf_s_997630011_g3vvfd53_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 15-JAN-19
Quindi ogni volta che viene effettuato il backup del db o cambiato la struttura fisica del db (come aggiungere o drop tablespace o datafile, mettere online o offline un tablespace, rinominare un datafile o aggiungere un redo log) viene aggiunto sotto la directory autobackup una copia del control file ed spfile.
Per disabilitarlo eseguire
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP OFF;
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
new RMAN configuration parameters are successfully stored
RMAN> show all;
RMAN configuration parameters for database with db_unique_name TEST1 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_TEST1.f'; # default
Se l' autobackup è disabilitato e il datafile 1 (system) viene backupato allora viene effettuata anche una copia del controlfile ma se il datafile 1 non è incluso nel backup, il controlfile non è copiato.
Per questo motivo Oracle raccomanda di abilitare l'autobackup del control file se non si sta usando un recovery catalog.
Se si vuole configurare la directory di autobackup al di fuori della FRA usare questo comando:
RMAN> configure controlfile autobackup format for device type disk to '/tmp/autobackup/controlfile_%F';
Dove %F è la combinazione di DBID, anno, mese, giorno e una squenza.
RMAN> show all;
.........
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/tmp/autobackup/controlfile_%F';
Per reimpostare al valore di default eseguire il comando
RMAN> configure controlfile autobackup format for device type disk clear;
RMAN> show all;
.......
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
RMAN> show all;
RMAN configuration parameters for database with db_unique_name TEST1 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_TEST1.f'; # default
oppure
RMAN> show controlfile autobackup;
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
Per impostare l'autoback a ON eseguire il comando.
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
RMAN> show all;
RMAN configuration parameters for database with db_unique_name TEST1 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_TEST1.f'; # default
Ogni volta che viene effettuato un backup del db o del datafile 1 (system) o del controlfile viene creato sotto la FRA (flash recovery area) la direcorty "autobackup" contente la copia del controfile e del file spfile.
RMAN> backup current controlfile;
Starting backup at 15-JAN-19
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 15-JAN-19
channel ORA_DISK_1: finished piece 1 at 15-JAN-19
piece handle=/u01/app/oracle/fast_recovery_area/TEST1/TEST1/backupset/2019_01_15/o1_mf_ncnnf_TAG20190115T152649_g3vvfbvh_.bkp tag=TAG20190115T152649 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 15-JAN-19
Starting Control File and SPFILE Autobackup at 15-JAN-19
piece handle=/u01/app/oracle/fast_recovery_area/TEST1/TEST1/autobackup/2019_01_15/o1_mf_s_997630011_g3vvfd53_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 15-JAN-19
Quindi ogni volta che viene effettuato il backup del db o cambiato la struttura fisica del db (come aggiungere o drop tablespace o datafile, mettere online o offline un tablespace, rinominare un datafile o aggiungere un redo log) viene aggiunto sotto la directory autobackup una copia del control file ed spfile.
Per disabilitarlo eseguire
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP OFF;
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
new RMAN configuration parameters are successfully stored
RMAN> show all;
RMAN configuration parameters for database with db_unique_name TEST1 are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_TEST1.f'; # default
Se l' autobackup è disabilitato e il datafile 1 (system) viene backupato allora viene effettuata anche una copia del controlfile ma se il datafile 1 non è incluso nel backup, il controlfile non è copiato.
Per questo motivo Oracle raccomanda di abilitare l'autobackup del control file se non si sta usando un recovery catalog.
Se si vuole configurare la directory di autobackup al di fuori della FRA usare questo comando:
RMAN> configure controlfile autobackup format for device type disk to '/tmp/autobackup/controlfile_%F';
Dove %F è la combinazione di DBID, anno, mese, giorno e una squenza.
.........
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/tmp/autobackup/controlfile_%F';
Per reimpostare al valore di default eseguire il comando
RMAN> configure controlfile autobackup format for device type disk clear;
RMAN> show all;
.......
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default