Demos - Workshop. -- Configure the RMAN



Similar documents
RMAN What is Rman Why use Rman Understanding The Rman Architecture Taking Backup in Non archive Backup Mode Taking Backup in archive Mode

If you have not multiplexed your online redo logs, then you are only left with incomplete recovery. Your steps are as follows:

HOW TO. RMAN Restore for Standby 10gR2

Configuring Backup Settings. Copyright 2009, Oracle. All rights reserved.

RMAN BACKUP & RECOVERY. Recovery Manager. Veeratteshwaran Sridhar

Oracle 12c Recovering a lost /corrupted table from RMAN Backup after user error or application issue

Getting all the pieces: Reliable Backup/Recovery

Oracle 10g Feature: RMAN Incrementally Updated Backups

Oracle 11gR2 : Recover dropped tablespace using RMAN tablespace point in time recovery

Oracle Database Backups and Disaster Autodesk

This appendix describes the following procedures: Cisco ANA Registry Backup and Restore Oracle Database Backup and Restore

RMAN for Commando DBAs. By Charles Kim

Using RMAN to restore a database to another server in an ASM environment

Agenda. Overview Configuring the database for basic Backup and Recovery Backing up your database Restore and Recovery Operations Managing your backups

12. User-managed and RMAN-based backups.

The safer, easier way to help you pass any IT exams. Exam : 1Z Upgrade Oracle9i/10g/11g OCA to Oracle Database 12c OCP.

Database Disaster Recovery using only RMAN Backups

Oracle Database 11g: Administration Workshop II DBA Release 2

Database Recovery For Newbies

HP LeftHand SAN Solutions

Oracle Database 11g: Administration Workshop II DBA Release 2

BrightStor ARCserve Backup

MAX_RMAN_08137_IGNORE=5 DISK_RETENTION_POLICY='RECOVERY WINDOW OF 7 DAYS'

Oracle Database 11g: Administration Workshop II Release 2

Strategies for Oracle Database Backup and Recovery: Case Studies. Mingguang Xu

! " # #$ " " %" & "'( " "' ( ) " * ""! ). " / ( * ( "# 0! " ). '

Oracle Database 10g: Backup and Recovery

Configuring Backup Settings Configuring and Managing Persistent Settings for RMAN Configuring Autobackup of Control File Backup optimization

TECHNICAL REPORT. Nimble Storage Oracle Backup and Recovery Guide

<Insert Picture Here> RMAN Configuration and Performance Tuning Best Practices

Use RMAN to relocate a 10TB RAC database with minimum downtime. Tao Zuo tao_zuo@npd.com NPD Inc. 9/2011

11. Oracle Recovery Manager Overview and Configuration.

Backup/Restore Oracle 8i/9i/10g

How to Best Configure, Size, and Monitor the Oracle Database Fast Recovery Area

Restore and Recovery Tasks. Copyright 2009, Oracle. All rights reserved.

D78850GC10. Oracle Database 12c Backup and Recovery Workshop. Summary. Introduction. Prerequisites

Oracle Backup and Recover 101. Osborne Press ISBN

Oracle 11g Database Administration

Oracle TDE Tablespace Encryption

Backup and Recovery. Oracle RMAN 11 g. Oracle Press ORACLG. Matthew Hart. Robert G. Freeman. Mc Graw Hill. Lisbon London Madrid Mexico City Milan

Oracle Database 10g: Administration Workshop II Release 2

Oracle Database 12c Recovery Manager New Features

D12CBR Oracle Database 12c: Backup and Recovery Workshop NEW

Oracle Recovery Manager

Oracle 11g DBA Training Course Content

DOCUMENTATION ORACLE BACKUP & RESTORE OPERATIONS

Performing Database and File System Backups and Restores Using Oracle Secure Backup

ORACLE CORE DBA ONLINE TRAINING

Oracle Database B

Oracle9i Database: Advanced Backup and Recovery Using RMAN

Oracle Recovery Manager 10g. An Oracle White Paper November 2003

RMAN in the Trenches: To Go Forward, We Must Backup

Recover Oracle Database upon losing all Control Files

Oracle Backup and Recovery Best Practices Dell Compellent Storage Center. Dell Compellent Technical Best Practices

WHITE PAPER. Oracle RMAN Design Best Practices with Data Domain. Storage. Deduplication

Oracle. Brief Course Content This course can be done in modular form as per the detail below. ORA-1 Oracle Database 10g: SQL 4 Weeks 4000/-

Recreate Physical Standby Database after Recovery of Primary Database

Using Recovery Manager with Oracle Data Guard in Oracle Database 10g. An Oracle White Paper April 2009

Oracle Database B

Oracle Database 10g: Backup and Recovery 1-2

Oracle Database 11g: Administration And Backup & Recover

Oracle Data Recovery Advisor

Backup Types. Backup and Recovery. Categories of Failures. Issues. Logical. Cold. Hot. Physical With. Statement failure

Using Recovery Manager with Oracle Data Guard in Oracle9i. An Oracle White Paper January 2007

Migrate Topaz databases from One Server to Another

EMC NetWorker Module for Oracle Release 5.0

Oracle Database Cross Platform Migration Lucy Feng, DBAK

Oracle Database 11g: Administration Workshop II

Using HP StoreOnce Backup systems for Oracle database backups

Best Practices White Paper Using Oracle Database 10g Automatic Storage Management with FUJITSU Storage

ASM and for 3rd Party Snapshot Solutions - for Offhost. Duane Smith Nitin Vengurlekar RACPACK

Zen Internet. Online Data Backup. Zen Vault Professional Plug-ins. Issue:

Oracle Database Backup-and-Recovery Best Practices and New Features

11. Configuring the Database Archiving Mode.

Oracle DBA Course Contents

An Oracle White Paper March Backup and Recovery Strategies for the Oracle Database Appliance

Objectif. Participant. Prérequis. Pédagogie. Oracle Database 11g - Administration Workshop II - LVC. 5 Jours [35 Heures]

EMC Data Domain Boost for Oracle Recovery Manager (RMAN)

Oracle Database. Backup and Recovery Basics 10g Release 1 (10.1) Part No. B

Clonación de una Base de Datos Oracle 11gR2 Activa usando RMAN. CLONACIÓN DE UNA BASE DE DATOS ORACLE 11gR2 ACTIVA USANDO RMAN

RMAN Recipes for Oracle Database 11g : A Problem-Solution Approach by Darl Kuhn, Sam Alapati and Arup Nanda Apress. (c) Copying Prohibited.

UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

Restoring To A Different Location With EBU And RMAN An AppsDBA Consulting White Paper

OCP: Oracle Database 12c Administrator Certified Professional Study Guide. Exam 1Z0-063

AV-004: Administering and Programming with ORACLE

Implementing an Enterprise Class Database Backup and Recovery Plan

EMC Data Domain Boost for Oracle Recovery Manager (RMAN)

Oracle Database 12c: New Features for Administrators

D12C-AIU Oracle Database 12c: Admin, Install and Upgrade Accelerated NEW

Oracle Backup, Recovery, and Performance Tuning using EMC Avamar and Oracle RMAN

Best Practices. Using IBM InfoSphere Optim High Performance Unload as part of a Recovery Strategy. IBM Smart Analytics System

Percona Server features for OpenStack and Trove Ops

LOGGING OR NOLOGGING THAT IS THE QUESTION

Oracle Database 12c: Admin, Install and Upgrade Accelerated

PRM For Oracle Database 3.1 GUI:

Feature. Database Backup and Recovery Best Practices

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle Data Guard for High Availability and Disaster Recovery

Transcription:

Demos - Workshop -- Configure the RMAN configure device type disk backup type to compressed backupset; configure channel 1 device type disk format '/home/oracle/app/oracle/backup/bck_orcl_%u'; configure channel 1 device type disk maxpiecesize 200m maxopenfiles 8 rate 150m; configure backup optimization on; configure controlfile autobackup on; configure controlfile autobackup format for device type disk to '/home/oracle/app/oracle/backup/ctl_orcl_%f'; configure retention policy to recovery window of 1 days; configure archivelog deletion policy to backed up 1 times to disk; configure encryption for database off; set encryption on identified by backuppwd only; (valid only for the rman session) set decryption on identified by backuppwd; (valid only for the rman session) -- Backup Database select algorithm_name from v$rman_encryption_algorithms; configure encryption algorithm 'AES128'; backup database plus archivelog; -- Obsolete report obsolete; delete obsolete; -- Monitoring the backup (mon_backup) select sid, serial#, context, sofar, totalwork, round(sofar/totalwork*100,2) "%_COMPLETE" from v$session_longops where opname like 'RMAN%' and opname not like '%aggregate%' and totalwork!=0 and sofar <> totalwork / -- FRA -- Check times of Redo switches alter session set nls_date_format='dd/mm/yyyy hh24:mi:ss'; select sequence#, first_time log_started, lead(first_time, 1,null) over (order by first_time) log_ended from (select distinct sequence#, first_time from dba_hist_log

where archived='yes' and sequence#!=0 order by first_time) order by sequence#; -- Check for FRA alerts select reason from dba_outstanding_alerts; -- Check FRA Usage (fra_usage) set pagesize 300 set linesize 300 column name format a35 alter system switch logfile; select * from v$recovery_file_dest; select * from v$flash_recovery_area_usage; -- Check for FRA alerts select reason from dba_outstanding_alerts; -- Creating RMAN Catalog -- Creating Catalog User create tablespace catalog_tbs datafile '/home/oracle/app/oracle/oradata/ts_catalog_bck_01.dbf' size 100M autoextend on maxsize 200M extent management local uniform size 512K; create user catalog_bck identified by rmancatalog default tablespace catalog_tbs; grant connect, resource, recovery_catalog_owner to catalog_bck; -- Creating Recovery Catalog rman catalog=catalog_bck/rmancatalog@orcl create catalog tablespace catalog_tbs; -- Register your DB in the Recovery Catalog rman target=backup_admin/bckpwd catalog=catalog_bck/rmancatalog register database; report schema; -- Create a Virtual Private Catalog -- SQL*Plus create user fmunoz identified by alvarez default tablespace catalog_tbs; grant recovery_catalog_owner to fmunoz; rman catalog=catalog_bck/rmancatalog

grant catalog for database orcl to fmunoz; grant register database to fmunoz; rman catalog=fmunoz/alvarez create virtual catalog; --if 10g sqlplus fmunoz/alvarez EXEC catalog_bck.dbms_rcvcat.create_virtual_catalog; -- If do you want to remove privileges revoke catalog for database orcl from fmunoz; revoke register database from fmunoz; -- if 11g rman catalog=fmunoz/alvarez drop catalog; -- if 10g sqlplus fmunoz/alvarez EXEC catalog_bck.dbms_rcvcat.drop_virtual_catalog; -- 11g have now IMPORT CATALOG rman catalog=catalog_bck2/rmancatalog import catalog catalog_bck2@orcl; -- Catalog Views -- See Archived Log generated by the DB target set pagesize 200 set linesize 200 column name format a50 column completion_time format a25 alter session set nls_date_format= 'DD-MON-YYYY:HH24:MI:SS'; select name, sequence#, status, completion_time from CATALOG_BCK.rc_archived_log; -- See the control file backups alter session set nls_date_format= 'DD-MON-YYYY:HH24:MI:SS'; select file#, creation_time, resetlogs_time blocks, block_size, controlfile_type from v$backup_datafile where file#=0;

column completion_time format a25 column autobackup_date format a25 alter session set nls_date_format= 'DD-MON-YYYY:HH24:MI:SS'; select db_name, status, completion_time, controlfile_type, autobackup_date from CATALOG_BCK.rc_backup_controlfile; set pagesize 200 set linesize 200 select creation_time, block_size, status,completion_time,autobackup_date, autobackup_sequence from CATALOG_BCK.rc_backup_controlfile; -- See list of corruption that exists in datafile backups select db_name, piece#, file#, block#, blocks, corruption_type from CATALOG_BCK.rc_backup_corruption where db_name='orcl'; -- See Block Corruption in the Db, populated when a backup or backup validade select file#, block#, corruption_type from v$database_block_corruption; -- See all RMAN configuration (equivalent to show all) column value format a60 select db_key,name, value from CATALOG_BCK.rc_rman_configuration; -- Monitore backups select output from v$rman_output order by stamp; -- Offline backups rman target / catalog=catalog_bck/rmancatalog shutdown immediate startup mount backup as compressed backupset database; alter database open; -- offile backup without using configured defaults shutdown startup mount run { allocate channel c1 device type disk format '/DB/u02/backups/other/bck1/orcl_%U'; allocate channel c2 device type disk format '/DB/u02/backups/other/bck2/orcl_%U';

backup as compressed backupset database; backup current controlfile; } --Block change tracking file alter database enable block change tracking using file '/home/oracle/app/oracle/ bctf01.btr'; select status from v$block_change_tracking; -- Incremental backup backup incremental level=0 database plus archivelog delete input; backup incremental level=1 database plus archivelog delete input; backup incremental level=1 cumulative database; -- Multisection Backups (New 11G) backup section size 10M tablespace users; -- Compression at 11G configure compression algorithm 'DEFAULT'; configure compression algorithm 'HIGH'; configure compression algorithm 'MEDIUM'; configure compression algorithm clear; LOW corresponds to LZO (11gR2) smallest compression ratio, fastest MEDIUM corresponds to ZLIB (11gR1) good compression ratio, slower than LOW HIGH corresponds to unmodified BZIP2 (11gR2) highest compression ratio, slowest BASIC (which is free) corresponds to BZIP2 (10g style compression) compression ratio in the range of MEDIUM, but slower -- Limiting Backup Impacts backup duration 00:30 database; backup duration 00:30 partial minimize time database; backup duration 00:30 partial minimize load_database; -- Modifying Retention Policy for a Backup Set -- In 11g the keep command override the default criteria, this cannot use the FRA backup database keep forever; backup database format '/DB/u02/backups/other/bck1/orcl_%U' keep untiltime='sysdate+180' tag keep_backup;

-- Archivelog Deletion Policy configure archivelog deletion policy to backed up 2 times to device type disk; -- Use RMAN to scan DB for physical and logical error without do the backup backup validate check logical database; -- Configuring Tablespaces for Exclusion from Whole Database Backups CONFIGURE EXCLUDE FOR TABLESPACE example; BACKUP DATABASE; # backs up the whole database, including cwmlite and example BACKUP DATABASE NOEXCLUDE; BACKUP TABLESPACE example; # backs up only example CONFIGURE EXCLUDE FOR TABLESPACE example CLEAR; -- Skipping offline, inaccessible or read only datafiles backup database skip readonly; backup database skip offline; backup database skip inaccessible; backup database skip readonly skip offline skip inaccessible; -- Forcing backups of Read only Datafiles backup database force; -- Backup of newly added datafiles backup database not backed up; -- Backup files not backed up in a specific period backup database not backed up since time='sysdate-2'; backup archivelog all not backed up 1 times; backup as compressed backupset database plus archivelog not backed up 1 times delete input; -- General backups backup tablespace users include current controlfile plus archivelog; backup datafile 2; backup archivelog all; backup archivelog from time 'sysdate-1'; backup archivelog from sequence xxx; backup archivelog all delete input;

backup archivelog from sequence xxx delete input; backup archivelog not backed up 3 times; backup archivelog until time 'sysdate - 2' delete all input; -- Backup Copies, RMAN will use FRA if it is configurated backup as copy database; backup as copy tablespace users; backup as copy dafafile 1; backup as copy archivelog all; Session 5 - Advanced RMAN -- Information about full completed backups select /*+ RULE */ session_key, session_recid, start_time, end_time, output_bytes, elapsed_seconds from v$rman_backup_job_details where start_time >= sysdate-180 and status='completed' And input_type='db FULL'; -- A summary of the active session history might help (make sure you are licensed!) select sid, serial#, program from v$session where lower(program) like '%rman%'; Set lines 132 Set pagesize 300 Set linesize 300 Column session_id format 999 heading SESS ID Column session_serial# format 9999 heading SESS SER # Column event format a40 Column total_waits format 9,999,999,999 heading TOTAL TIME WAITED MICRO Select session_id, session_serial#, Event, sum(time_waited) total_waits From v$active_session_history Where session_id session_serial# in (1885, 452777, 476759,583459,661183,733783,766073) And sample_time > sysdate -1 And program like '%rman%' And session_state='waiting' And time_waited > 0 Group by session_id, session_serial#, Event Order by session_id, session_serial#, total_waits desc;

-- How Long will it takes? select sid, serial#, program from v$session where lower(program) like '%rman%'; Select sid, serial#, opname, time_remaining From v$session_longops Where sid serial# in (1885, 452777, 476759,583459,661183,733783,766073) And time_remaining > 0; -- V$BACKUP_ASYNC_IO column filename format a60 select sid, serial, effective_bytes_per_second, filename from V$BACKUP_ASYNC_IO Where sid serial# in (128138,134178,138267); SELECT LONG_WAITS/IO_COUNT, FILENAME FROM V$BACKUP_ASYNC_IO WHERE LONG_WAITS/IO_COUNT > 0 Where sid serial# in (128138,134178,138267) ORDER BY LONG_WAITS/IO_COUNT DESC; -- Tablespace Point in Time Recovery -- Check if tablespace is fully self-contained SELECT ts1_name, ts2_name, reason FROM SYS.TS_PITR_CHECK WHERE ( TS1_NAME IN ('EXAMPLE' ) AND TS2_NAME NOT IN ('EXAMPLE') ) OR ( TS1_NAME NOT IN ('EXAMPLE') AND TS2_NAME IN ('EXAMPLE') ); -- Looking for object that will be lost during the recovery SELECT OWNER, NAME, TABLESPACE_NAME, TO_CHAR(CREATION_TIME, 'YYYY-MM-DD:HH24:MI:SS') FROM TS_PITR_OBJECTS_TO_BE_DROPPED WHERE TABLESPACE_NAME IN ('USERS') AND CREATION_TIME > TO_DATE('07-OCT-08:22:35:30','YY-MON-DD:HH24:MI:SS') ORDER BY TABLESPACE_NAME, CREATION_TIME; -- Here is a script that displays databases that are registered in the catalog and the last date they were backed up (full backup or level 0) Select a.db_key, a.dbid, a.name db_name, b.backup_type, b.incremental_level,

b.completion_time, max(b.completion_time) over (partition by a.name, a.dbid) max_completion_time from catalog_bck.rc_database a, catalog_bck.rc_backup_set b where b.status = 'A' and b.backup_type = 'D' and b.db_key = a.db_key; -- Example of rmanrestoredatafiles.sql cd $ORACLE_BASE/cfgtoollogs/dbca/orcl vi rmanrestoredatafiles.sql -- Example of recover.bsq cd $ORACLE_HOME/rdbms/admin vi recover.bsq -- Duplex Backup configure datafile backup copies for device type disk to 2; configure archivelog backup copies for device type disk to 2; backup datafile 1 format '/DB/u02/backups/bck_orcl_%U','/Data/backup/bck_orcl_%U' plus archivelog; -- Check if Backup are recoverable -- Restore Preview restore database preview; -- Recover advisors create tablespace test datafile '/home/oracle/app/oracle/oradata/ts_test_01.dbf' size 50M autoextend on maxsize 200M extent management local uniform size 512K; create user test identified by test default tablespace test; grant connect, resource to test; ALTER USER test QUOTA UNLIMITED ON test; CREATE TABLE TEST.EMPLOYEE2 ( EMP_ID NUMBER(10) NOT NULL, EMP_NAME VARCHAR2(30), EMP_SSN VARCHAR2(9), ) / EMP_DOB DATE mv ts_test_01.dbf /home/oracle/app/oracle/ts_test_01.dbf echo > ts_test_01.dbf

ls lrt insert into test.employee2 values (2, 'test', '12345 ', '20-JUN-73'); RMAN> LIST FAILURE; RMAN> ADVISE FAILURE; RMAN> REPAIR FAILURE PREVIEW; RMAN> REPAIR FAILURE; -TTIPR alter system switch logfile; CREATE TABLE hr.employee5 ( EMP_ID NUMBER(10) NOT NULL, EMP_NAME VARCHAR2(30), EMP_SSN VARCHAR2(9), EMP_DOB DATE ) / alter system switch logfile; backup database plus archivelog; recover tablespace users ultil logseq 2400 thread 1 auxiliary detination '/Data/data'; backup tablespace users; alter tablespace users online;