Friday, November 2, 2012

RMAN Debug and Trace

If any RMAN operation fails, then you can use RMAN Debug to collect and diagnosis the failure. The RMAN Debug command generates more extensive output, use debugging for the following purposes.
  •  To see the actual programs generated by RMAN
  •  To determine the failure of RMAN Command
The RMAN debug option can be used trace RMAN session, and it will be very useful to troubleshoot an issue.

The RMAN Debug command will be available in from Oracle 8i onwards.

RMAN Debug Command
$ rman target / debug trace rman.trc log rman.log
$ rman target / catalog xxx/xxxx@rmancat debug trace = /tmp/rman.trc log=/tmp/rman.log

Once you are connected to RMAN, you can run the commands that you want to debug.

The log file will shows how much percentage (%) completed and time left, It will help to estimate the time.

The rman.log file will look like below.
orclsr@oracle> cat rman.log
Recovery Manager: Release - Production on Thu Oct 11 15:21:05 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
RMAN-06005: connected to target database: ORCL (DBID=2284874908408)
RMAN-03090: Starting backup at 11-OCT-12
RMAN-06009: using target database control file instead of recovery catalog
RMAN-08030: allocated channel: ORA_DISK_1
RMAN-08500: channel ORA_DISK_1: SID=618 device type=DISK
RMAN-08008: channel ORA_DISK_1: starting full datafile backup set
RMAN-08010: channel ORA_DISK_1: specifying datafile(s) in backup set
RMAN-08522: input datafile file number=00071 name=/oracle/ORCL/sapdata8/prd_57/prd.data57
RMAN-08522: input datafile file number=00073 name=/oracle/ORCL/sapdata9/prd_59/prd.data59
RMAN-08522: input datafile file number=00078 name=/oracle/ORCL/sapdata9/prd701_8/prd701.data8
RMAN-08522: input datafile file number=00069 name=/oracle/ORCL/sapdata4/prd_55/prd.data55
RMAN-08522: input datafile file number=00006 name=/oracle/ORCL/sapdata1/prd_3/prd.data3
RMAN-08522: input datafile file number=00001 name=/oracle/ORCL/sapdata1/system_1/system.data1
RMAN-08522: input datafile file number=00003 name=/oracle/ORCL/sapdata1/sysaux_1/sysaux.data1
RMAN-08522: input datafile file number=00030 name=/oracle/ORCL/sapdata1/prdusr_1/prdusr.data1
RMAN-08522: input datafile file number=00011 name=/oracle/ORCL/sapdata2/prd_8/prd.data8
RMAN-06731: command backup:1.0% complete, time left 03:27:06
RMAN-06731: command backup:1.9% complete, time left 03:32:09
The trace file will have all information running behind the screen.

The “rman.trc” will look like below

orclsr@oracle> cat rman.trc |more
Recovery Manager: Release - Production on Thu Oct 11 15:21:05 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
ORACLE_HOME = /oracle/ORCL/112_64
System name:    Linux
Node name:      sapORCL
Release:        2.6.18-194.17.1.el5
Version:        #1 SMP Mon Sep 20 07:12:06 EDT 2010
Machine:        x86_64
Starting with debugging set to level=9, types=ALL
DBGMISC:    ENTERED krmksimronly [15:21:06.175]
DBGSQL:      CHANNEL> alter session set events '19737 trace name context forever'
DBGSQL:         sqlcode = 0
DBGSQL:      CHANNEL> select decode(archiver, 'FAILED', 1, 0) into :archstuck from v$instance
DBGSQL:         sqlcode = 0
DBGSQL:          D :archstuck = 0

You can refer mentalink note 375386.1 for more information.

Satishbabu Gunukula, Oracle ACE

1 comment: