rman 同时备份到磁盘和磁带 disk sbt

APPLIES TO:

Oracle Database - Enterprise Edition - Version 10.2.0.1 to 19.24.0.0.0 [Release 10.2 to 19]
Information in this document applies to any platform.

GOAL

It is not possible to backup a database to both disk and tape simultaneously.
You can however backup to disk first and then make a copy of the disk backup to tape using backup backupset command. This can be done in a single RUN block, using pre-configured channels of both  types and requires only ONE scan of the database to disk first. The disk backupset is then copied to tape.

The backup and restore can be parallelised on both device types for efficiency and as the initial backup is done to disk, unused block compression is used.好处多多,NBU说不支持压缩??

 

SOLUTION

Pre-configure all channels (this example use Symantec Netbackup) to parallise over 2 channels :
 

RMAN> show all;
...
CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE CHANNEL DEVICE TYPE SBT PARMS 'NB_ORA_CLASS=<class>, SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.sl64';


Sample script to backup to disk and then copy the backupsets to tape: 
 

run {
backup device type disk database;
backup device type sbt backupset completed after 'sysdate -1';
}


Any disk backupsets completed within the last 24 hours would be backed up to tape but you could also use from 'tag' to specify which backupsets are to be backed up.


To restore :
 

run {
set until ...;
restore database;
}


As both disk and sbt channels are configured, both types are allocated automatically.
RMAN will attempts first to use the DISK backups - if these are not found then RMAN will automatically failover to use the copy on tape:
 

RMAN> restore database validate;

Starting restore at 24-jan-12 10:07:58
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=27 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=147 device type=DISK
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=141 device type=SBT_TAPE
..
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: SID=144 device type=SBT_TAPE
..
channel ORA_DISK_1: starting validation of datafile backup set
channel ORA_DISK_2: starting validation of datafile backup set
channel ORA_DISK_1: reading from backup piece <PATH>\BACKUPSET\2012_01_20\O1_MF_NNNDF_TAG20120120T123417_.BKP
channel ORA_DISK_2: reading from backup piece <PATH>\BACKUPSET\2012_01_20\O1_MF_NNNDF_TAG20120120T123417_.BKP
channel ORA_DISK_1: ORA-19870: error while restoring backup piece /<PATH>\BACKUPSET\2012_01_20\O1_MF_NNNDF_TAG20120120T123417_.BKP
ORA-19505: failed to identify file "<PATH>\BACKUPSET\2012_01_20\O1_MF_NNNDF_TAG20120120T123417_.BKP"
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified
channel ORA_DISK_1: failover to duplicate backup on device SBT_TAPE
channel ORA_DISK_2: ORA-19870: error while restoring backup piece  <PATH>\BACKUPSET\2012_01_20\O1_MF_NNNDF_TAG20120120T123417_.BKP
ORA-19505: failed to identify file "<PATH>\BACKUPSET\2012_01_20\O1_MF_NNNDF_TAG20120120T123417_7_.BKP"
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) The system cannot find the file specified
channel ORA_DISK_2: failover to duplicate backup on device SBT_TAPE
channel ORA_SBT_TAPE_1: starting validation of datafile backup set
channel ORA_SBT_TAPE_1: reading from backup piece 2pn183ab_1_2
channel ORA_SBT_TAPE_2: starting validation of datafile backup set
channel ORA_SBT_TAPE_2: reading from backup piece 2qn183ac_1_2
channel ORA_SBT_TAPE_1: piece handle=2pn183ab_1_2 tag=TAG20120120T123417
channel ORA_SBT_TAPE_1: restored backup piece 1
channel ORA_SBT_TAPE_1: validation complete, elapsed time: 00:01:05
channel ORA_SBT_TAPE_2: piece handle=2qn183ac_1_2 tag=TAG20120120T123417
channel ORA_SBT_TAPE_2: restored backup piece 1
channel ORA_SBT_TAPE_2: validation complete, elapsed time: 00:01:15
Finished restore at 24-jan-12 10:09:26

---------------命令

backup as backupset keep until time 'sysdate+1' format '+DATA1/cdb/%U' tag 'my_bkup' (database ROOT) (pluggable database 'pdb$seed', pdb );

select handle from v$backup_piece where tag like 'MY_BKUP%';

select distinct tag from v$backup_piece

run {
#allocate channel ch1 device type disk;
backup  device type disk incremental level 0 
as compressed backupset 
database force filesperset=1 plus archivelog ;
delete archivelog all completed before 'sysdate-1' device type disk backed up 1 times to device type disk;
delete noprompt obsolete;
}

list backup of database 'pdb$seed'; 


RMAN> run {
 ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/nfs)";
 backup incremental level 0 
 as compressed backupset 
 database force filesperset=1;
 RELEASE CHANNEL ch00;
 }
 
 
 
run 
{  
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/nfs)";
backup  backupset completed after 'sysdate -1';
RELEASE CHANNEL ch00;
}
CONFIGURE CHANNEL DEVICE TYPE SBT PARMS 'SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/nfs)';

RMAN> CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
RMAN> CONFIGURE CHANNEL DEVICE TYPE SBT PARMS 'SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/nfs)';
 
run {
backup device type disk database;
backup device type sbt backupset completed after 'sysdate -1';
}


ORA-19511: non RMAN, but media manager or vendor specific failure, error text:
   sbtwrite2: I/O error writing to file dh34gcke_1457_1_2, errno = 11
channel ORA_SBT_TAPE_1 disabled, job failed on it will be run on another channel
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_SBT_TAPE_2 channel at 09/08/2024 09:58:03
ORA-27030: skgfwrt: sbtwrite2 returned error
ORA-19511: non RMAN, but media manager or vendor specific failure, error text:
   sbtwrite2: I/O error writing to file di34gcke_1458_1_2, errno = 0
   
  
run {
backup as compressed backupset  device type disk database;
backup device type sbt backupset completed after 'sysdate -1';
}
 
   

run 
{  
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/nfs)";
backup  backupset all ;
RELEASE CHANNEL ch00;
}
 
run 
{  
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS="SBT_LIBRARY=oracle.disksbt,ENV=(BACKUP_DIR=/nfs)";
crosscheck backup;
delete backupset;
RELEASE CHANNEL ch00;
}


run 
{  
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE' PARMS

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值