Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse...

41
Simple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring

Transcript of Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse...

Page 1: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

Simple steps to Implement RMAN

Nanak SawlaniJesse CrewZLB Behring

Page 2: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 2

ZLB Behring Intro

ZLB Behring is a global leader in the plasma therapeutics industry.

The company's broad portfolio of life-saving therapeutics are used in the treatment of individuals with hemophilia, immune deficiency disorders and inherited emphysema.

www.zlbbehring.com

Page 3: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 3

Agenda

RMAN OverviewRMAN Catalog setupBackup procedure and examplesRecovery examplesRMAN ReportingMaintenance of catalogQuestions and Answers

Page 4: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 4

RMAN will not back up

Oracle softwareConfiguration files (tnsnames,sqlnet etc)Pre9i, init.ora will not be back up

(9i allows backup of parameter file, spfile only)RMAN will not perform logical backup

(you can use export and import)/oratab and other system Oracle-related file (startup and shutdown scripts,like /etc/rc3.d..)

Page 5: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 5

RMAN limitations

Cannot use compressed archivelog filesCannot use one script for multiple databasesReporting is not easier for multiple databasesCatalog maintenance is not easier in previous versions.Error messages are difficult to read

Page 6: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 6

RMAN Architecture

t a r g e tD B R M A N

C a ta lo g- -

T a r g e tv e rs io n

c o m p a t ib ler e p o s it o ry

m e d iam a n a g e m e n t

la y e r

ta r g e t h o m eR M A N b in a r y

s e r v e r p r o c e s s e s

c h a n n e ls

Page 7: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 7

Steps to backup using RMAN

Install and configure Media Management softwareLink MML to OracleCreate catalogRegister target database in the catalogBackup the database

Page 8: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 8

Media Management Layer

MML manages the reading and writing of file to and from tape.MML is needed only if backing up to tapeExample of Linking Veritas Netbackup

$ORACLE_HOME/libln –s <install_path>/netbackup/bin/libobk.so.l libobk.somake –f ins_rdbms.mk ioracle

Define Class configuration in the Netbackup

Page 9: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 9

Use of Catalog

Catalog is the metadata about the backupsCatalog is needed if you wish to store scriptsCatalog allows you to restore a DB from previous incarnationCatalog offers enterprise-wide repositoryReporting is easierBy default, RMAN uses NOCATALOG option

Page 10: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 10

Catalog creation/setup

Catalog database should be separate then target

Create tablespace rcvcatCreate user rmanGrant role recovery_catalog_ownerrman rcvcat user/passwd@dbnameRMAN >create catalog tablespace “rcvcat”

Page 11: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 11

Target database

Target database server needs to have an entry in the tnsnames.ora for the Catalog databaseCreate backup user in the target database

grant sysdba privilege

Register the databaseRMAN> connect catalog user/passwd@dbnameRMAN> connect target user/passwd@dbnameregister database;

Page 12: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 12

RMAN terms

backup setsLogical grouping of backup files

Backup pieceA physical binary file created by RMAN

Channel is the server process4 channels (four parallel streams)write or read to one tapeChannels can be allocated for TAPE or DISK

Backup Retention PolicyHow long you want to keep the backups

Page 13: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 13

Incremental backup (levels)

Level 0: incremental base backupLevel 1: RMAN backs up the blocks that have changed since the last backupLevel 2 and so on…

Page 14: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 14

HOT backup

It does not use begin backup/end backupusing RMAN for running hot backup does not impact the volume of redo loggingRMAN reads the data blocks directly from the data file and uses an internal oracle mechanism (read –consistency) exactly as a normal SQL statement.

Page 15: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 15

Hot backup example

run {allocate channel t1 type 'SBT_TAPE'; backuptag hot_db_bk_level0filesperset 1

format 'bk_%s_%p_%t'(database);

sql 'alter system archive log current';backup filesperset 5

format 'al_%s_%p_%t'(archivelog all delete input);

}

Page 16: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 16

Cold backup using RMAN

Even for a cold backup, database needs to be MOUNTED

Page 17: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 17

Cold backup example

run {# Cold database level 0 backup allocate channel t1 type 'SBT_TAPE'; allocate channel t2 type 'SBT_TAPE'; allocate channel t3 type 'SBT_TAPE'; allocate channel t4 type 'SBT_TAPE'; backup incremental level 0tag cold_db_bk_level0filesperset 1

format 'bk_%s_%p_%t'(database);

sql 'alter database open';}

Page 18: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 18

RMAN Commands

resync catalogReads the control file and synchronizes the catalog with database backup information

CrosscheckChecks repository to ensure physical file exists

e.g If you manually remove archive log file using OS commandCrosscheck command does not delete OS file or record from repository.

Page 19: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 19

Restore

Once the restore of data files is complete, recovery can be done via RMAN, SQL*Plus or Server ManagerRestore validate database

Checks the backup set to ensure database is recoverable

Page 20: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 20

Restore all datafiles example

connect target ‘user/passwd@TARGETDB'connect rcvcat ‘rman/passwd@catalogDB'run {# Restore all data filesallocate channel t1 type 'SBT_TAPE'; allocate channel t2 type 'SBT_TAPE'; allocate channel t3 type 'SBT_TAPE'; allocate channel t4 type 'SBT_TAPE'; restore (database);

}

Page 21: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 21

Point in time recovery

run {set until time '2002-05-22:09:45:00';allocate channel t1 type 'SBT_TAPE';allocate channel t2 type 'SBT_TAPE';restore (database);recover database;

sql 'alter database open resetlogs';}

Page 22: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 22

Storing scripts in Catalog

Create script or replace scriptcreate script backup_full{backup database plus archivelog}

Executing a stored scriptrun {execute script full_bak;}

To view stored scriptprint script full_bak

To delete stored scriptdelete script full_bak;

Page 23: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 23

RMAN and Backup of control files

In 9i, configure control file autobackup onControl file will be backed up whenever backup or copy is issued

Backup current control fileManually backup control file

Page 24: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 24

Catalog maintenance

Backup catalog databaseYou can use RMAN to backup catalog databaseFull exportCold backup

Periodically remove the expired backupDelete expired backup

crosscheckIf you perform incomplete recovery and open database with resetlogs option,

issue reset database command in rman catalog

Page 25: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 25

RMAN Reporting

Listlist backuplist backup summarylist expired backup

Reportreport obsoletereport schema- reports the tablespace and associated data filesreport schema at time ‘sysdate-7’Report need backup days=3

show allTo see the configuration setting

Page 26: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 26

How to remove database from Catalog

Removing Database is done via SQL*PlusLogin to catalog database

SQL> select db_id from v$database;select db_key,db_id from db where db_id=output from previous query;execute dbms_rcvcat.unregisterdatabase(db_key,db_id)

Note: Once removed from catalog, RMAN can no longer recover the database

Page 27: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 27

OEM Interface

You can use OEM GUI to perform backup and recoveryOEM will execute the jobs at the target siteOEM will use the rman executables of the target databaseOEM has

Backup wizardMaintenance wizardRecovery wizard

Page 28: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 28

Monitoring RMAN jobs

v$session_longopsProvides progress report on RMAN backup and restore

v$session_waitLists the events for which sessions are waitingIt only lists RMAN events and not media manager events

RMAN viewsrc_database database registered in the catalogrc_tablespace all tablespaces registered in the catalogrc_datafile all data files registered in the catalogrc-stored_script scripts stored in the catalog

Page 29: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 29

Components of RMAN session

RMAN process itselfCatalog connectionInitial connection to the target database- default channelPolling connection to the targetOne target connection corresponding to each allocated channel

Page 30: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 30

Version support Matrix

Metalink note 73431.1

Target Database

RMAN executables

Catalog database

8.1.7 8.1.x 8.1.x

8.1.7.4 8.1.7.4 8.1.x9.0.1 9.0.1 8.1.x

9.2.0 >=9.0.1.3 8.1.x

10.1.0 >=9.0.1.3 >=9.0.1

Page 31: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 31

Catalog upgrade

Login to the Catalog databaseSQL> select * from rcver;

Point to the latest RMAN executablesRMAN > upgrade catalog

Page 32: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 32

Check corruption

backup validate databaseQuery V$DATABSE_BLOCK_CORRUPTION (9i)And v$backup_corruption

Page 33: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 33

RMAN can be used to

Create duplicate databaseCreate Standby databaseEnvironment copy – very useful in SAP implementation

Page 34: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 34

Tuning RMAN

Parallel channel settings – using channels effectivelyMultiplexing

filesperset – how many files be included in a backup setmaxopenfiles – how many data files RMAN can read in parallel

Page 35: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 35

Running SQL commands

You can run SQL commands from the RMAN prompt

RMAN> sql “alter system switch logfile”;

Run Host commands alsoRMAN> host “ls”;

Page 36: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 36

Known problems and Bugs

RMAN uses the large pool during backup and recovery; so properly sizing the large pool is prudent (Note 73354.1)

the RMAN executable must be compatible with the target / auxiliary database.

Note:227398.1- Known RMAN Bugs in Oracle9i

Page 37: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 37

Good practice

Ensure NLS_LANG is set appropriatelyReporting from Veritas is limitedYou might have to create some scripts to check the log file (specially for multiple databases)Verify backups and perform test recoveries periodically

Page 38: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 38

RMAN in 10g

RMAN in 9ican re-start the failed backups or restoresTrial restore

RMAN in 10gDisk based recoveryRemoval of obsolete backup is simplerCompression of backups

Page 39: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 39

Summary

RMAN OverviewRMAN Catalog setupBackup procedure and examplesRecovery examplesMaintenance of catalogThere is more

Trial recoveryRe-starting of failed backups and restoresRMAN in RAC environmentRestoring on another server

Page 40: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 40

Resources

sample RMAN scripts$ORACLE_HOME/rdbms/demo/*.rcv

‘Oracle9i RMAN backup and Recovery’ by Robert Freeman and Matthew hartmetalink.oracle.comTechnical repository on www.ioug.orgOracle RMAN pocket reference by D. Kuhn & S. SchulzeVeritas has lot of sample scripts

Page 41: Simple steps to Implement RMAN - · PDF fileSimple steps to Implement RMAN Nanak Sawlani Jesse Crew ZLB Behring. ... Link MML to Oracle ... e.g If you manually remove archive log file

2004 41

Thank you

Neither ZLB Behring or the author guarantee this document to be error-free. Please provide comments/questions to

Nanak.Sawlani @zlbbehring.comJesse.Crew @zlbbehring.com

Special Thanks to Rich Bernat, ChevronTexaco CorpWilliam Gioioso, Vanguard