October 28, 2012

ARCHIVE DESTINATION FULL BACKUP TO TAPE

ARCHIVE LOG BACKUP TO TAPE
--------------------------
ps -ef|grep pmon

ORACLE_SID=`ps -ef | grep asm_smon | grep -v 'grep' | grep -v 'sed' | awk '{printf $8}' | awk 'BEGIN{FS="_"} {printf $3}'`

export ORACLE_SID


sqlplus "/as sysdba"
set pages 9999 lines300
col OPEN_MODE for a10
col HOST_NAME for a10

select name,INSTANCE_NAME,HOST_NAME,OPEN_MODE,DATABASE_STATUS,DATABASE_ROLE, PROTECTION_LEVEL,CONTROLFILE_TYPE,LOGINS,to_char(STARTUP_TIME,'DD-MON-YYYY HH24:MI:SS') "UP TIME"from v$database,Gv$instance;

SET LINESIZE  145
SET PAGESIZE  9999
SET VERIFY    off
COLUMN group_name             FORMAT a20           HEAD 'Disk Group|Name'
COLUMN sector_size            FORMAT 99,999        HEAD 'Sector|Size'
COLUMN block_size             FORMAT 99,999        HEAD 'Block|Size'
COLUMN allocation_unit_size   FORMAT 999,999,999   HEAD 'Allocation|Unit Size'
COLUMN state                  FORMAT a11           HEAD 'State'
COLUMN type                   FORMAT a6            HEAD 'Type'
COLUMN total_mb               FORMAT 999,999,999   HEAD 'Total Size (MB)'
COLUMN used_mb                FORMAT 999,999,999   HEAD 'Used Size (MB)'
COLUMN pct_used     &nb;       allocation_unit_size
&n"sans-serif" verdana="verdana">  , type                             &nbsp1

compute sum label "Grand Total: " of total_mb used_mb on report
SELECT
  , (total_mb - free_mb)   &)*100, 2)  pct_used<;pct_used

FROM

    v\$asm_diskgroup

WHERE

    state = 'MOUNTED'

ORDER BY

    name

/


nohup rman f;">Disk Group            Sector   Block   Allocation

Name               &nb;       type

  , total_mb                                 total_mb

  , (total_mb - free_mb)                     used_mb

  , ROUND((1- (free_mb / total_mb))*100, 2)  pct_used

FROM

    v\$asm_diskgroup

WHERE

    state = 'MOUNTED'

ORDER BY

    name

/


Disk Group            Sector   Block   Allocation

Name                    Size    Size    Unit Size State       Type   Total Size (MB) Used Size (MB) Pct. Used

-------------------- ------- ------- ------ -f archivebackup_dbname_DDMONYY.log


archivebackup.cmd
-----------------
run
{
delete archivelog until time 'sysdate-3' backed up 1 times to sbt_tape;
allocate channel ch1 type 'sbt_tape';
allocate channel ch2 type 'sbt_tape';
allocate channel ch3 type 'sbt_tape';
allocate channel ch4 type 'sbt_tape';
backup archivelog all filesperset 10 delete input;
}

nohup: appending output to `nohup.out'
tail -f archivebackup_dbname_DDMONYY.log
------------------------------------------------------------------------------------------------------------------ls -lrth
rm arch (remove oldest archive if not required)

No comments:

Post a Comment