Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

RMAN - list only last successful backup via script

Posted on 2010-01-04
7
Medium Priority
?
12,254 Views
Last Modified: 2016-10-21
I would like to compose a script to list backup statuses, but I am having difficulty filtering out all but the last backup from a RMAN> list backup; command.  Optimally, i would like just the last backup's date/time and it's success/failure status.

My databases are all running on Solaris 5, but are a mixture of 9.2.0.7, 10.2.0.4, and 11.1.0.7
0
Comment
Question by:STLOracleDude
7 Comments
 
LVL 11

Accepted Solution

by:
it-rex earned 1000 total points
ID: 26173585
select * from  v$rman_status
where trunc(start_time)=trunc(sysdate-1)

instead of the star(*) use the columns you are interested in.

also;
To include the time information in the RMAN output,set the NLS_DATE_FORMAT=DD-MON-RRRR HH24:MI:SS at the OS level prior to running RMAN. This is useful especially when checking the exact RMAN backup completion date and time as generated in the RMAN log
0
 

Author Comment

by:STLOracleDude
ID: 26180568
is there any way to get just the success or fail status of the backup database command only?  it looks like that view shows every file being copied.  

My rman script is posted below.

Also, is there a similar view in 9i?
connect target
configure default device type to disk;
configure controlfile autobackup on;
configure controlfile autobackup format for device type disk to '/data/orabkup/${DIRECTORY}/%F';
configure channel device type disk format '/data/orabkup/${DIRECTORY}/backup_db_%d_S_%s_P_%p_T_%t' maxpiecesize 2G;
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1;
sql 'alter system archive log current';
backup archivelog all delete all input;
backup database;
sql 'alter system archive log current';

Open in new window

0
 

Author Comment

by:STLOracleDude
ID: 26180575
Here is the output of my v$rman_status query.
SQL> select operation,status,mbytes_processed,start_time,end_time from v$rman_status where trunc(start_time)=trunc(sysdate-1);
DELETE                            COMPLETED                              0 04-JAN-10 04-JAN-10
LIST                              COMPLETED                              0 04-JAN-10 04-JAN-10
LIST                              COMPLETED                              0 04-JAN-10 04-JAN-10
RMAN                              COMPLETED WITH ERRORS                  0 04-JAN-10 04-JAN-10
REPORT                            COMPLETED                              0 04-JAN-10 04-JAN-10
RMAN                              COMPLETED                              0 04-JAN-10 04-JAN-10
LIST                              COMPLETED                              0 04-JAN-10 04-JAN-10
DELETE                            COMPLETED                              0 04-JAN-10 04-JAN-10
BACKUP                            COMPLETED                           2058 04-JAN-10 04-JAN-10
LIST                              COMPLETED                              0 04-JAN-10 04-JAN-10
CONTROL FILE AND SPFILE AUTOBACK  COMPLETED                             11 04-JAN-10 04-JAN-10
REPORT                            COMPLETED                              0 04-JAN-10 04-JAN-10
DELETE                            COMPLETED                              0 04-JAN-10 04-JAN-10
BACKUP                            COMPLETED                           1217 04-JAN-10 04-JAN-10
DELETE                            COMPLETED                              0 04-JAN-10 04-JAN-10
CONTROL FILE AND SPFILE AUTOBACK  COMPLETED                             11 04-JAN-10 04-JAN-10
RMAN                              COMPLETED WITH ERRORS               3297 04-JAN-10 04-JAN-10
RMAN                              COMPLETED                              0 04-JAN-10 04-JAN-10

18 rows selected.

Open in new window

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 6

Assisted Solution

by:peter991
peter991 earned 1000 total points
ID: 26197658
Hi,
Perhaps this will help you.

RMAN> list backup of database completed after 'SYSDATE-30';
0
 

Author Comment

by:STLOracleDude
ID: 26210433
That works.  Is there any way to pull just the portion below from that output or will i have to grep through it manually?  Not that big a deal, I can spool it to a file and grep for disk, I guess.
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
181     Full    134.67M    DISK        00:03:43     04-JAN-10

Open in new window

0
 
LVL 6

Expert Comment

by:peter991
ID: 26281233
I guess spool and grep will do the job.
I don't think "set serveroutput on|off" and "set heading on|off" works in RMAN.

Regards
0
 

Expert Comment

by:terra spardling
ID: 41854874
Good suggestions ! Just to add my thoughts , if your business is requiring a DD 2058 , my colleagues filled a template form here <code>https://goo.gl/vW7Mcb</code>
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Via a live example, show how to take different types of Oracle backups using RMAN.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question