Thursday 11 November 2021

Rman backup commands

Usefull rman backup commands listed below , hope it will help

DB full backup include Archive backup:
RUN
{
  ALLOCATE CHANNEL ch11 TYPE DISK MAXPIECESIZE 10G;
  BACKUP
  FORMAT '/bkp_location/%d_D_%T_%u_s%s_p%p'
  DATABASE
  PLUS ARCHIVELOG
  FORMAT 'bkp_location/%d_A_%T_%u_s%s_p%p';
  RELEASE CHANNEL ch11;
}

Incremental backup:

RUN
{
CONFIGURE DEVICE TYPE disk PARALLELISM 2;
ALLOCATE CHANNEL disk1 DEVICE TYPE disk  FORMAT 'D:\Bkp_Standby\ForStandby_%U' maxpiecesize 40 G;
ALLOCATE CHANNEL disk2 DEVICE TYPE disk  FORMAT 'C:\db_inc_bkp\ForStandby_%U' maxpiecesize 30 G;
BACKUP INCREMENTAL FROM SCN 32079657 DATABASE;
}

Archive Backup:
RUN {
     CONFIGURE DEVICE TYPE disk PARALLELISM 4;
     set archivelog destination to 'bkp_location';
     BACKUP  ARCHIVELOG  from logseq 56782 until logseq
56789 thread 1   format '/bkp_location/%d_D_%T_%u_s%s_p%p';
    }
     
Decrypted encrypted backup:
RMAN> set DECRYPTION identified by 'password';

Point In Time restore and recovery:
RMAN> run {
allocate channel ch01 type 'SBT_TAPE' parms 'ENV=(TDPO_OPTFILE=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
set until time="to_date('2017/10/19 18:00:00', 'yyyy/mm/dd hh24:mi:ss')";
restore database;
recover database;
}

Estimate RMAN Duplicate or Clone Timings:

alter session set nls_date_format = 'DD-MM-YYYY HH24:MI:SS';

select SID, START_TIME,TOTALWORK, sofar, (sofar/totalwork) * 100 done,

   sysdate + TIME_REMAINING/3600/24 end_at

    from gv$session_longops

    where totalwork > sofar

    AND opname NOT LIKE '%aggregate%'

    AND opname like 'RMAN%'; 



No comments:

Post a Comment