当前位置:操作系统 > Unix/Linux >>

ASM上的备份集如何转移到文件系统中

ASM上的备份集如何转移到文件系统中
 
方法有两个。
 
方法一:使用rman,rman是一个非常好的工具,不仅仅是备份的作用,如果你只用rman作备份的话,有些浪费了。
通过rman里的backup backupset可以达到用户的要求。
下面是演示过程。
先准备一个backupset。
这里我备份了单个的archivelog来做演示。
RMAN> backup archivelog sequence 83294;
Starting backup at 06-MAY-10
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set
input archive log thread=1 sequence=83294 recid=83294 stamp=718324431
channel ORA_DISK_1: starting piece 1 at 06-MAY-10
channel ORA_DISK_1: finished piece 1 at 06-MAY-10
piece handle=+DG1/soldb/backup/0dld1gpq_1_1_718324538_20100506 tag=TAG20100506T223536 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 06-MAY-10
 
查看该backupset
RMAN> list backup of archivelog sequence 83294;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
——- ———- ———– ———— —————
8 97.50K DISK 00:00:01 06-MAY-10
BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20100506T223536
Piece Name: +DG1/soldb/backup/0dld1gpq_1_1_718324538_20100506
 
List of Archived Logs in backup set 8
Thrd Seq Low SCN Low Time Next SCN Next Time
—- ——- ———- ——— ———- ———
1 83294 3111066080 06-MAY-10 3111066263 06-MAY-10
 
下面我们使用rman把这个在asm里的备份集做到文件系统上使用
backup backupset就可以了
如下
RMAN> backup backupset 8 format ‘/export/home/oracle/1.dbf’;
 
Starting backup at 06-MAY-10
using channel ORA_DISK_1
input backupset count=13 stamp=718324538 creation_time=06-MAY-10
channel ORA_DISK_1: starting piece 1 at 06-MAY-10
channel ORA_DISK_1: backup piece +DG1/soldb/backup/0dld1gpq_1_1_718324538_20100506
piece handle=/export/home/oracle/1.dbf comment=NONE
channel ORA_DISK_1: finished piece 1 at 06-MAY-10
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-MAY-10
 
下面到文件系统下查看
[oracle@solaris ~]pwd
/export/home/oracle
[oracle@solaris ~]ls -al 1.dbf
-rw-r—– 1 oracle oinstall 100352 May 6 22:40 1.dbf
可以看到backupset已经在文件系统了,这里只有100K,这是我手工archive的一个日志,拿来做实验用的,没必要写满。
 
除了使用rman,我们还可以使用dbms_file_transfer这个包的copy_file来实现同样的过程,下面看看这个过程
先建立directory
SQL> create directory sourcedir as ‘+DG1/soldb/backup/’;
Directory created
 
SQL> create directory destdir as ‘/export/home/oracle/’;/0dld1gpq_1_1_718324538_20100506
Directory created
 
SQL> exec dbms_file_transfer.copy_file(’sourcedir’, ‘0dld1gpq_1_1_718324538_20100506′, ‘destdir’, ‘2.dbf’);
PL/SQL procedure successfully completed
 
这样我们已经完成了我们的目标了。
在目录下查看查看
[oracle@solaris ~]pwd
/export/home/oracle
[oracle@solaris ~]ls -al 2.dbf
-rw-r—– 1 oracle oinstall 100352 May 6 22:45 2.dbf
 
这两种方法都可以达到目的,但是还是有差异的,毕竟前一种方法是用rman的,所以rman里留下了记录
List of Backup Sets
===================
 
BS Key Size
——- ———-
8 97.50K
 
List of Archived Logs in backup set 8
Thrd Seq Low SCN Low Time Next SCN Next Time
—- ——- ———- ——— ———- ———
1 83294 3111066080 06-MAY-10 3111066263 06-MAY-10
 
Backup Set Copy #2 of backup set 8
Device Type Elapsed Time Completion Time Compressed Tag
———– ———— ————— ———- —
DISK 00:00:01 06-MAY-10 NO TAG20100506T223536
 
List of Backup Pieces for backup set 8 Copy #2
BP Key Pc# Status Piece Name
——- — ———– ———-
4 1 AVAILABLE /export/home/oracle/1.dbf
 
Backup Set Copy #1 of backup set 8
Device Type Elapsed Time Completion Time Compressed Tag
———– ———— ————— ———- —
DISK 00:00:01 06-MAY-10 NO TAG20100506T223536
 
List of Backup Pieces for backup set 8 Copy #1
BP Key Pc# Status Piece Name
——- — ———– ———-
3 1 AVAILABLE +DG1/soldb/backup/0dld1gpq_1_1_718324538_20100506
 
这里是没有第二个方法的记录的
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,