Skip to main content

RMAN - Configuration, Metadata and Catalogues


Control file





In this post I approach RMAN Configuration, Metadata, Catalogues





  • RMAN always stores its metadata in the target database control file
  • Whether you use or not the Recovery Catalog Oracle stores metadata into the targer database control file
  • RMAN info on control file is is aged based on CONTROL_FILE_RECORD_KEEP_TIME
  • Single point control ( control file)
  • Does not required another DB




Recovery Catalog





  • keep info for long time
  • single point to store many databases
  • RESYNC CATALOG, syncronize the control file metadata with the recover catalog
  • Can store "RMAN backup scripts" in the catalog ... is not possible do it on the control file
  • Recovery Catalog control views
    • RC_*
    • Allow history commands
    • BACKUP .. KEEP UNTIL TIME - keep the backup until point that referrers the configured retention police
  •  BACKUP ... KEEP FOREVER - keep the backup forever, until manually removed
  • REPORT SCHEMA ... AT - show the structure at specific time period




Create a RMAN Catalog





--1 create tablespace 
SQL> create tablespace rman_ts datafile '/u01/app/oracle/oradata/orcl/rman_ts.bdf' size 125m autoextend on;
Tablespace created.

--2 create create user
SQL> create user rc_owner identified by rc_owner default tablespace rman quota unlimited on rman_ts;
User created.

--3  grant grant recovery_catalog_owner to user
SQL> grant recovery_catalog_owner to rc_owner;
Grant succeeded.




4 ) create catalog and (un)register a database






$ rman target / catalog rc_owner/rc_owner

Recovery Manager: Release 11.2.0.1.0 - Production on Sun Feb 3 18:38:16 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (DBID=1272537938)
connected to recovery catalog database
  
RMAN>  create catalog;
recovery catalog created

RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN> unregister database;
database name is "ORCL" and DBID is 1272537938

Do you really want to unregister the database (enter YES or NO)? yes
database unregistered from the recovery catalog




Resync catalog





  • sync the control file metadata with the catalog metadata
  • Situations:
  • backup failed because the catalog database is down, rman saves the metadata only into the control file
  • backup system tablespace => automatic backup control file




RMAN> resync catalog;
starting full resync of recovery catalog
full resync complete




START WITH 
To load/save the backups out of FRA you can use the start START WITH option.





# catalog start with '/path';
# catalog start with '+DATA2';
catalog start with '/u01/app/oracle/rman_backup';




Virtual Private Catalog





  • delegate admin    (traditional)
  • each virtual private catalog is a logical partition of the base catalog
  • each virtual private catalog owner relies on a separate Oracle oracle account and several views and
  • synonyms in the recovery catalog





-- create user
SQL> create user v_priv_catalog1 identified by v_priv_catalog1
default tablespace users quota unlimited on users;

SQL> grant recovery_catalog_owner to v_priv_catalog1;

# give catalog grants

OS$ rman target / catalog rc_owner/rc_owner

RMAN> grant catalog for database orcl to v_priv_catalog1;

RMAN> grant register database to v_priv_catalog1;

#create virtual catalog

OS$ rman target / catalog v_priv_catalog1/v_priv_catalog1

RMAN> create virtual catalog;
found eligible base catalog owned by RMAN
created virtual catalog against base catalog owned by RMAN

RMAN> register database;
RMAN> list encarnation;




Reporting views





  • rc_stored_script
  • rc_rman_status
  • rc_rman_configurations
  • rc_database




Backup the catalog
 It should include in the regular backup strategy  





Retention Policy





  • Setting to specify how long to keep backups
  • Any backups that are not needed to support this recovery window are marked as OBSOLETE and are automatically removed by RMAN if you are using a flash recovery area, if you are no user FRA  the deletion need to be done Manually
  •  Applies to full back up only (level 0) not to level 1
  • Backups can be automatically retained and managed using one of two methods: 
    • Redundancy : 
      • X number of backups
      • Default !!

    • Recovery Window : 
      • X number of days
      • Recommended by Oracle






RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ORCL 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/Database/11.2.0/orcl/dbs/snapcf_orcl.f'; # default

RMAN>  show retention policy;

RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

RMAN> configure retention policy to recovery window of 10 days;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 10 DAYS;
new RMAN configuration parameters are successfully stored

RMAN> show retention policy;

RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 10 DAYS;




Recommendations





  • Don’t create the catalog on the target database
  • Set the ARCHIVELOG mode
  • Set RETENTION POLICY to REDUNDANCY grater then 1
  • Backup the catalog to DISK and TAPE
  • Use BACKUP DATABASE PLUS ARCHIVELOG
  • Set CONFIGURE CONTROLFILE AUTOBACKUP ON

Comments

Popular posts from this blog

DB - How to monitor Oracle datapump jobs

These days there is lot of work around database migrations not only but mainly to cloud providers. One of the ways to migrate Oracle databases is using data pump (expdp/impdp). In general works fine, it allows an easy way to bring the database even different OS. It is always good to monitor the progress, to know where we are and estimate how long we are from the end. In this post, I am sharing some queries to help with database monitoring progress. The queries can be easily tailed to various scenarios. Starting with a simple one - the track the number of objects loaded during an import operation. When there is a massive amount of errors during the import. Drop and run the import again. The bellow query can be useful also to monitor the number of objects if we are dropping the users. Here, I’m making the assumption there were no other database activity in progress on the last 24 hours. select owner, count(0) from dba_objects where owner in ( select username from dba_users where created...

VM - Partilhar Pastas Windows - Linux

Neste post escrevo como partilhar pastas entre Windows (Host) e uma VM Guest, neste caso Linux. Ha algumas formas de fazer isto, esta parece me a mais facil. Seleccionar a Pasta Windows Na consola Virtual Box > Devices > Shared Folder Seleccionar a pasta windows para partilhar no Linux   O   Montar a pasta Windows na VM Ha duas opcoes : 1) Reiniciar a VM (Auto-mount) 2) Linha de comando [root@host ~]# mkdir -p /u01/stage/win_ebs_sw [root@host ~]# chmod 777 /u01/stage/win_ebs_sw [root@host ~]# mount -t vboxsf Oracle_EBS /u01/stage/win_ebs_sw/ [root@host ~]# ls /u01/stage/win_ebs_sw ebs_weblogic_webtier [root@host ~]# df -h /u01/stage/win_ebs_sw Filesystem Size Used Avail Use% Mounted on Oracle_EBS 895G 494G 401G 56% /u01/stage/win_ebs_sw Guardar a Configuracao no /etc/fstab para tornar as alteracoes permanentes. [root@host ~]# echo "Oracle_EBS /u01/stage/win_ebs_sw vboxsf defaults 0 0" >> /etc/fstab [root@host ~]# cat /etc/fstab # /etc/...

DB – How to monitor Oracle database long ops ?

As DBAs, some questions we are often asked and to be fair we ask ourselfs when we are doing massive operations, are : Is the database doing something? How long the database takes to complete the task? There a data dictionary view, GV$SESSION_LONGOPS whom is really usefull for monitoring and to provide estimated time to get the task done. Starting with a first example, a query for general propose . set lines 240 col message form a100 col opname form a50 select * from ( select round(l.sofar/l.totalwork*100,2) as complete, --l.* l.sid, --l.opname, l.message, l.start_time, l.time_remaining/60 "minuts remaining", l.elapsed_seconds from gv$session_longops l where totalwork !=0 ) where complete < 100; The view is also usefull on specific operations such as Oracle Recovery Manager (RMAN) jobs monitoring, this query returns information about backup,restore and recovery. select sid, serial#,opname, context, sofar, totalwork, round(sofar/totalwork*100,2) "%_complet...