Tuesday, 23 October 2012

Rman commands


Some RMAN Queries..




FULL DATABASE BACKUP USING RMAN
================================

os> rman connect target /


run {
allocate channel disk_1 type disk;
backup format '/SAN/rman_backup/inc_0_datafiles.dbf' database;
sql 'alter system archive log current';
backup  format '/SAN/rman_backup/archives_backup.arc_bkp'  archivelog all;
backup format '/SAN/rman_backup/cntrl_backup.cntrl_bkp'  current controlfile;
release channel disk_1
     }



With Example

I started to take full rman database backup with the previous commands.

For cheking the status of rman operation, how much it is completed & approximatley when will finish etc.
by using below command.


SQL> alter session set nls_date_format='dd/mm/yy hh24:mi:ss';                              

Session altered.


SQL> select SID, START_TIME,TOTALWORK, sofar, (sofar/totalwork) * 100 PERdone,
          sysdate + TIME_REMAINING/3600/24 Expected_to_end_at
          from v$session_longops
          where totalwork > sofar
          AND opname NOT LIKE '%aggregate%'
          AND opname like 'RMAN%';



will get o/p as like this








For knowing Sesion id and wait time,spid we can use below query

wait time:  Time waiting to get resource
spid       :  os process id, in Linux we can see by "top" command
                If needed we can kill from os level by using "kill -9 spid"



   select
       sid, spid, client_info, event,seconds_in_wait, p1, p2, p3
       from  v$process p, v$session s
       where p.addr = s.paddr
       and client_info like 'rman channel=%';







Inorder to get a over all status of rman backups use the below query


select command_id,operation,status,input_bytes,
mbytes_processed,start_time,output_device_type
from   v$rman_status order by start_time;










No comments:

Post a Comment