Monday 26 May 2014

Spool file in RMAN prompt

This will be very useful when you quickly need a huge output from RMAN.

Check 2 examples

Below is the example  1
=====================

testhost1 $
testhost1 $ ls -lrt list_bkp_controlfile_sysdate
list_bkp_controlfile_sysdate: No such file or directory
testhost1 $ rman target /

Recovery Manager: Release 11.2.0.2.0 - Production on Tue May 27 01:44:12 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL1 (DBID=394612220)

RMAN> spool log to 'list_bkp_controlfile_sysdate';
RMAN> list backup of controlfile  completed after 'sysdate-1';
RMAN> exit
testhost1 $ ls -lrt list_bkp_controlfile_sysdate
-rw-------   1 oracle   dba         5788 May 27 01:45 list_bkp_controlfile_sysdate
testhost1 $ head list_bkp_controlfile_sysdate

Spooling started in log file: list_bkp_controlfile_sysdate

Recovery Manager11.2.0.2.0

RMAN>
using target database control file instead of recovery catalog

List of Backup Sets
===================
testhost1 $ tail list_bkp_controlfile_sysdate
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
56974   Full    68.75M     SBT_TAPE    00:00:46     26-MAY-14
        BP Key: 56974   Status: AVAILABLE  Compressed: NO  Tag: TAG20140526T221945
        Handle: ctrl_u78p99lc1_s60648_p1_t848622785   Media: U00880
  Control File Included: Ckp SCN: 11076235186143   Ckp time: 26-MAY-14

RMAN>

Recovery Manager complete.
testhost1 $ cat list_bkp_controlfile_sysdate |wc -l
     106
     










Below is the example  2
=====================
     
Remember this spool syntax will overright the file if already exists in present working directory 

you may use APPEND(From 10g onwards) to append on the existing file. use below syntax


testhost1 $ rman target /

Recovery Manager: Release 11.2.0.2.0 - Production on Tue May 27 01:46:00 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL1 (DBID=394612220)

RMAN> spool log to 'list_bkp_controlfile_sysdate' append;
RMAN>  list backup of controlfile  completed after 'sysdate-2';
RMAN> exit
testhost1 $ ls -lrt list_bkp_controlfile_sysdate
-rw-------   1 oracle   dba        17127 May 27 01:46 list_bkp_controlfile_sysdate
testhost1 $ head list_bkp_controlfile_sysdate

Spooling started in log file: list_bkp_controlfile_sysdate

Recovery Manager11.2.0.2.0

RMAN>
using target database control file instead of recovery catalog

List of Backup Sets
===================
testhost1 $ tail list_bkp_controlfile_sysdate
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
56974   Full    68.75M     SBT_TAPE    00:00:46     26-MAY-14
        BP Key: 56974   Status: AVAILABLE  Compressed: NO  Tag: TAG20140526T221945
        Handle: ctrl_u78p99lc1_s60648_p1_t848622785   Media: U00880
  Control File Included: Ckp SCN: 11076235186143   Ckp time: 26-MAY-14

RMAN>

Recovery Manager complete.
testhost1 $
testhost1 $ cat list_bkp_controlfile_sysdate |wc -l
     303
testhost1 $

No comments:

Post a Comment