Chapter 9 Scripting RMAN. Background Authors felt that scripting was a topic not covered well Authors wanted to cover both Unix/Linux and Windows environments.

Slides:



Advertisements
Similar presentations
INTRODUCTION TO ORACLE Lynnwood Brown System Managers LLC Backup and Recovery Copyright System Managers LLC 2008 all rights reserved.
Advertisements

Chapter 14 Handling Online Redo Log Failures. Background RMAN doesn’t back up online redo logs You don’t use RMAN to recover from online redo log failures.
ITEC474 Control File Maintenance
1 Chapter 17 Troubleshooting RMAN. 2 Background Authors thought this topic was often glazed over or not covered well Knew that every topic can’t be covered,
5 Copyright © 2006, Oracle. All rights reserved. Database Recovery.
Database Backup and Recovery
INTRODUCTION TO ORACLE Lynnwood Brown President System Managers LLC Data Loading & Backup And Recovery Lecture 5 Copyright System Managers LLC 2003 all.
RMAN Restore and Recovery
Backup and Recovery (2) Oracle 10g CAP364 1 Hebah ElGibreen.
Backup and Recovery Part 1.
Chapter 12 Performing Incomplete Recovery. Background Viewed as one of the more difficult chapters to write Thought it was important to put in material.
CHAPTER 16 User-Managed Backup and Recovery. Introduction to User Managed Backup and Recovery Backup and recover is one of the most critical skills a.
Oracle’s Backup and Recovery Tool
Configuring Recovery Manager
4 Copyright © 2008, Oracle. All rights reserved. Configuring Backup Specifications.
Chapter 5 Configuring the RMAN Environment. Objectives Show command to see existing settings Configure command to change settings Backing up the controlfile.
CHAPTER 5 Managing Control Files, Online Redo Logs, and Archiving.
9 Copyright © Oracle Corporation, All rights reserved. Oracle Recovery Manager Overview and Configuration.
CHAPTER 17 Configuring RMAN. Introduction to RMAN RMAN was introduced in Oracle 8.0. RMAN is Oracle’s tool for backup and recovery. RMAN is much more.
Oracle9i Database Administrator: Implementation and Administration
The Oracle Recovery Manager (RMAN)
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
CHAPTER 18 RMAN Backups and Reporting. Introduction to RMAN Backups and Reporting The focus of this chapter is backups of: Datafiles Control files Archived.
Agenda  Overview  Configuring the database for basic Backup and Recovery  Backing up your database  Restore and Recovery Operations  Managing your.
Introduction to Oracle Backup and Recovery
Using RMAN to Perform Recovery
Backup Infrastructure – Additional Information Gordon D. Brown, RAL Carlos Fernando Gamboa, BNL 3D Workshop, CNAF, Bologna, Italy 13 th June 2007.
CHAPTER 16 User-Managed Backup and Recovery. Introduction to User Managed Backup and Recovery Backup and recover is one of the most critical skills a.
13 Copyright © Oracle Corporation, All rights reserved. RMAN Complete Recovery.
Oracle Recovery Manager (RMAN) 10g : Reloaded
PPOUG, 05-OCT-01 Agenda RMAN Architecture Why Use RMAN? Implementation Decisions RMAN Oracle9i New Features.
CHAPTER 21 Automating Jobs. Introduction to Automating Jobs DBAs rely heavily on automating jobs. DBAs cannot be effective without automation. Listed.
Recovery Manager Overview Target Database Recovery Catalog Database Enterprise Manager Recovery Manager (RMAN) Media Options Server Session.
5 Copyright © 2004, Oracle. All rights reserved. Using Recovery Manager.
5 Copyright © 2008, Oracle. All rights reserved. Using RMAN to Create Backups.
Chapter 7 Making Backups with RMAN. Objectives Explain backup sets and image copies RMAN Backup modes’ Types of files backed up Backup destinations Specifying.
11 Copyright © Oracle Corporation, All rights reserved. RMAN Backups.
Backup and Recovery Protects From Data Loss. Backup and Recovery Protects From Data Loss Provides for Media Recovery.
11 Copyright © Oracle Corporation, All rights reserved. RMAN Backups.
15 Copyright © 2005, Oracle. All rights reserved. Performing Database Backups.
Backup & Recovery Backup and Recovery Strategies on Windows Server 2003.
RMAN: Your New Best Friend for Backup and Recovery Ruth Gramolini ORACLE DBA Vermont Department of Taxes.
15 Copyright © 2007, Oracle. All rights reserved. Performing Database Backups.
9 Copyright © 2004, Oracle. All rights reserved. Flashback Database.
A Guide to Oracle9i1 Database Instance startup and shutdown.
17 Copyright © Oracle Corporation, All rights reserved. Recovery Catalog Creation and Maintenance.
Chapter 8Oracle9i DBA II: Backup/Recovery and Network Administration 1 Chapter 8 Complete Recovery with Recovery Manager.
15 Copyright © Oracle Corporation, All rights reserved. RMAN Incomplete Recovery.
14 Copyright © 2005, Oracle. All rights reserved. Backup and Recovery Concepts.
Backup Concepts. Introduction Backup and recovery procedures protect your database against data loss and reconstruct the data, should loss occur. The.
3 Copyright © 2006, Oracle. All rights reserved. Using Recovery Manager.
10 Copyright © Oracle Corporation, All rights reserved. User-Managed Backups.
Overview of Oracle Backup and Recovery Darl Kuhn, Regis University.
12 Copyright © Oracle Corporation, All rights reserved. User-Managed Complete Recovery.
6 Copyright © 2007, Oracle. All rights reserved. Performing User-Managed Backup and Recovery.
2 Copyright © 2007, Oracle. All rights reserved. Configuring for Recoverability.
2 Copyright © 2006, Oracle. All rights reserved. Configuring Recovery Manager.
8 Copyright © 2007, Oracle. All rights reserved. Using RMAN to Duplicate a Database.
3 Copyright © 2007, Oracle. All rights reserved. Using the RMAN Recovery Catalog.
Week 2 Lecture 2 Data Dictionary Views and Control Files.
10 Copyright © 2007, Oracle. All rights reserved. Using RMAN Enhancements.
19 Copyright © 2004, Oracle. All rights reserved. Database Backups.
What is Flashback? Technology that allows you to revert the database to a point in time in the past Several versions of flashback available Different types.
RMAN Maintenance.
RMAN Maintenance.
Recovery Catalog Creation and Maintenance
Performing Tablespace Point-in-Time Recovery
Duplicating a Database
Configuring Backup Settings
Performing Database Recovery
Presentation transcript:

Chapter 9 Scripting RMAN

Background Authors felt that scripting was a topic not covered well Authors wanted to cover both Unix/Linux and Windows environments

Objectives Scripting basics Developing Unix shell scripts Running RMAN within Windows Scheduling O/S jobs (Unix / Windows) Creating local and global scripts Updating stored scripts Commenting stored scripts Displaying script information from catalog Other scripting functions

Scripting RMAN Basics Means storing scripts in RMAN repository RMAN catalog database needed An alternative to O/S shell scripting Ideal for repetitive tasks, such as: – Delete archivelog all – Crosscheck backup – List copy of datafiles Not good at parameter passing

Scripting Basics (cont.) Examples: – Command file – Cmdfile options – Stored scripts

Developing Unix Shell Script Should be run from automated utility (cron) Should have notification methods ( ) Should produce output logs Should be able to back up to multiple mount points Output logs should be stored on central server Should be generic to work for any database Should only be able to run only once at a given time

Developing Shell Script (cont.) Should include three parameter types: – Fixed addresses Central log server – Database specific ORACLE_SID / ORACLE_HOME Type of backup Media type – Derived Determined from previous two parameter types For example, location of rman executable

Scheduling a Unix Shell File One way is via the Unix ‘cron’ facility – ‘crontab –e’ command (edit) – crontab –l’ command (list / read) Crontab format: Sample cron entry to back up database and archivelogs:

Steps to run RMAN via Windows Can run with Windows Batch File – Create RMAN command file – Call the command file from RMAN command line – Utility to send – Prepare batch file – Schedule batch file via scheduler Windows Scheduler ‘at’ command Can run with GUI in Windows

Changing Windows Schedule

Changing Schedule (cont.)

Scheduling - Windows Command Line Done via ‘at’ command To schedule: To view scheduled jobs:

Creating Local-Stored Scripts First, connect to RMAN target database and catalog: Second, create the stored script:

Creating a Global Script Can be called for any target database

Updating Stored Scripts Done via ‘replace script’ command:

Commenting Stored Scripts Done via ‘comment’ command:

Displaying Stored Scripts Done via ‘print script’ command

Getting Listing of Scripts Done via ‘list script’ command:

Dropping Stored Scripts Done via ‘delete script’ command:

Other Scripting Functions Executing like-named scripts (one global, one local) Converting stored scripts to files Creating/Replacing stored script from file Passing parameters to stored scripts Creating parameterized command file script

The Flash Recovery Area Used by database as backup location – Backup sets – Image copies – Archivelogs Automatically deletes unneeded backups Can store redo logs (online/archived and control files Optional backup area Configure in different location than database files

Creating Flash Recovery Area Factors to evaluate before creating: – Where should it be created – How much space should be allocated Basic tasks: – Disable archive destination parameters – Run command to create the FRA:

Writing Backups to FRA Run backup without specifying ‘format’ option Automatically Creates directories under FRA base: – Database name Backupset (for backup sets) Datafile (for image copies) Autobackup (for control files) Flashback (for flashback logs) Archivelog Controlfile onlinelog

What if FRA runs out of space? Increase space Remove restore points (older ones) Disable flashback

Checking FRA Space Usage

Expanding/Shrinking FRA

Placing Archived Logs in FRA Use ‘alter system’: Validate that destination is enabled:

Using Same FRA for Two Databases with Same Name First, find validate unique database name: Then, alter initialization parameter of one database:

Placing Control File in FRA Accomplished three ways: – When database is created – When control file recreated via SQL script when recovering from a failure – When control file is restored from backup Then, reflect in initialization parameter file: – Via control files parameter – Via db_create_file_dest parameter Validate that db_create_online_log_dest_[12] not used

Placing Online Redo Logs in FRA Can be done at database creation via parameters: Can be done when adding a group – Make sure db_recovery_file_dest is set – Make sure db_file_create_dest is NULL – Make sure db_create_online_log_dest_* are NULL – Issue statement to add logfile group:

Sending Image Copies to FRA Two easy steps! – Ensure flash recovery area is configured – Ensure RMAN script has no ‘format’ command in channel configuration

Deleting from the FRA For backup sets: – First, get list of backups with ‘list backupset’ command – Issue ‘delete backupset; command: For archive logs: – First, get list of backed up logs with ‘list archivelog all’ command – Issue ‘delete archivelog command’:

Reinstating Damaged Datafile Check files of database with ‘report schema’ Follow steps to recover file:

Switching Back from Image Copy Check files of database with ‘report schema’ Follow steps to switch file back: – Remove original OS file, if present – Backup copy of file – Take the datafile offline – Issue ‘switch datafile’ command for that datafile – Issue ‘recover datafile’ command for that datafile – Bring datafile back online – Check location once again with ‘report schema’

Backing up the FRA to Tape Done via ‘backup recovery area’ command:

Sizing the FRA Files to be concerned with: – Copy of all datafiles – Incremental backups, if configured – Flashback logs (if enabled) – Online redo logs – Archived redo logs not backed up to tape – Control files – Controlfile autobackups

Sizing the FRA (cont.)