ITPUX技术网

交流 . 资讯 . 分享
Make progress together!
Oracle数据库DBA高级工程师培训视频
Oracle数据库培训-备份恢复-性能优化-集群容灾
mysql数据库视频教程

Oracle RAC数据库在asm下的备份与恢复

内容发布:paulyi| 发布时间:2014-1-25 13:52:28
oracle rac 在asm下的备份与恢复
oracle 10g rac+asm 的备份与恢复,因为asm 磁盘管理是两个实例都可以访问的,并且是共享的,
归档日志文件也是放在asm磁盘上,所以备份与恢复的操作和单实例差不多,只需要在一个节点上做可以了,
以下是测试过程:
SQL> show parameter log_archive_dest_1
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1 string location=+DISKGROUP
log_archive_dest_10 string

1.备份
[oracle@rac1 ~]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Sat Jan 3 20:30:40 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC (DBID=2257786532)

RMAN> show all;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/oradata/%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/db_1/dbs/snapcf_rac1.f'; # default
RMAN> backup database plus archivelog delete all input;

Starting backup at 03-JAN-09
current log archived
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=46 recid=70 stamp=674701009
input archive log thread=1 sequence=47 recid=73 stamp=674701367
input archive log thread=1 sequence=48 recid=74 stamp=674701585
input archive log thread=1 sequence=49 recid=76 stamp=675201928
input archive log thread=1 sequence=50 recid=79 stamp=675203712
input archive log thread=2 sequence=34 recid=71 stamp=674701052
input archive log thread=2 sequence=35 recid=72 stamp=674701368
input archive log thread=2 sequence=36 recid=75 stamp=674701587
input archive log thread=2 sequence=37 recid=77 stamp=675203284
input archive log thread=2 sequence=38 recid=78 stamp=675203700
channel ORA_DISK_1: starting piece 1 at 03-JAN-09
channel ORA_DISK_1: finished piece 1 at 03-JAN-09
piece handle=/oradata/0lk3tik2_1_1 tag=TAG20090103T203513 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
channel ORA_DISK_1: deleting archive log(s)
archive log filename=+DISKGROUP/rac/archivelog/2008_12_29/thread_1_seq_46.288.674701007 recid=70 stamp=674701009
archive log filename=+DISKGROUP/rac/archivelog/2008_12_29/thread_1_seq_47.281.674701367 recid=73 stamp=674701367
archive log filename=+DISKGROUP/rac/archivelog/2008_12_29/thread_1_seq_48.287.674701585 recid=74 stamp=674701585
archive log filename=+DISKGROUP/rac/archivelog/2009_01_03/thread_1_seq_49.280.675201927 recid=76 stamp=675201928
archive log filename=+DISKGROUP/rac/archivelog/2009_01_03/thread_1_seq_50.282.675203705 recid=79 stamp=675203712
archive log filename=+DISKGROUP/rac/archivelog/2008_12_29/thread_2_seq_34.283.674701051 recid=71 stamp=674701052
archive log filename=+DISKGROUP/rac/archivelog/2008_12_29/thread_2_seq_35.286.674701369 recid=72 stamp=674701368
archive log filename=+DISKGROUP/rac/archivelog/2008_12_29/thread_2_seq_36.279.674701587 recid=75 stamp=674701587
archive log filename=+DISKGROUP/rac/archivelog/2009_01_03/thread_2_seq_37.285.675203283 recid=77 stamp=675203284
archive log filename=+DISKGROUP/rac/archivelog/2009_01_03/thread_2_seq_38.284.675203701 recid=78 stamp=675203700
Finished backup at 03-JAN-09
Starting backup at 03-JAN-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00007 name=/oradata/paul01.dbf
input datafile fno=00003 name=+DISKGROUP/rac/datafile/sysaux.270.669804585
input datafile fno=00005 name=+DISKGROUP/rac/datafile/users.278.672888597
input datafile fno=00002 name=+DISKGROUP/rac/datafile/undotbs1.269.669804571
channel ORA_DISK_1: starting piece 1 at 03-JAN-09
channel ORA_DISK_1: finished piece 1 at 03-JAN-09
piece handle=/oradata/0mk3tikd_1_1 tag=TAG20090103T203524 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=+DISKGROUP/rac/datafile/system.268.669804533
channel ORA_DISK_1: starting piece 1 at 03-JAN-09
channel ORA_DISK_1: finished piece 1 at 03-JAN-09
piece handle=/oradata/0nk3tilq_1_1 tag=TAG20090103T203524 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=+DISKGROUP/rac/datafile/undotbs2.272.669804611
channel ORA_DISK_1: starting piece 1 at 03-JAN-09
channel ORA_DISK_1: finished piece 1 at 03-JAN-09
piece handle=/oradata/0ok3timu_1_1 tag=TAG20090103T203524 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00006 name=+DISKGROUP/rac/datafile/test.277.669863437
channel ORA_DISK_1: starting piece 1 at 03-JAN-09
channel ORA_DISK_1: finished piece 1 at 03-JAN-09
piece handle=/oradata/0pk3tin1_1_1 tag=TAG20090103T203524 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 03-JAN-09
channel ORA_DISK_1: finished piece 1 at 03-JAN-09
piece handle=/oradata/0qk3tin2_1_1 tag=TAG20090103T203524 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
Finished backup at 03-JAN-09
Starting backup at 03-JAN-09
current log archived
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=51 recid=81 stamp=675203822
input archive log thread=2 sequence=39 recid=80 stamp=675203817
channel ORA_DISK_1: starting piece 1 at 03-JAN-09
channel ORA_DISK_1: finished piece 1 at 03-JAN-09
piece handle=/oradata/0rk3ting_1_1 tag=TAG20090103T203703 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_1: deleting archive log(s)
archive log filename=+DISKGROUP/rac/archivelog/2009_01_03/thread_1_seq_51.285.675203823 recid=81 stamp=675203822
archive log filename=+DISKGROUP/rac/archivelog/2009_01_03/thread_2_seq_39.284.675203817 recid=80 stamp=675203817
Finished backup at 03-JAN-09
RMAN>

2.加入测试数据
rac1
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sat Jan 3 20:51:30 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL>
SQL> select count(*) from t;
COUNT(*)
----------
160688
SQL> insert into t select * from t;
160688 rows created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.

rac2
[oracle@rac2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sat Jan 3 20:53:00 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> insert into t select * from t;
321376 rows created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> select count(*) from t;
COUNT(*)
----------
642752

3.恢复:
注意恢复时另外一个节点数据库一定要关闭,
要不然在恢复时会报如下错误:
Recovery Manager complete.
[oracle@rac1 ~]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Sat Jan 3 21:02:48 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup mount;
Oracle instance started
database mounted
Total System Global Area 285212672 bytes
Fixed Size 1267068 bytes
Variable Size 104860292 bytes
Database Buffers 176160768 bytes
Redo Buffers 2924544 bytes
RMAN> restore database;
Starting restore at 03-JAN-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=150 instance=rac1 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to +DISKGROUP/rac/datafile/undotbs1.269.669804571
restoring datafile 00003 to +DISKGROUP/rac/datafile/sysaux.270.669804585
restoring datafile 00005 to +DISKGROUP/rac/datafile/users.278.672888597
restoring datafile 00007 to /oradata/paul01.dbf
channel ORA_DISK_1: reading from backup piece /oradata/0mk3tikd_1_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 01/03/2009 21:06:08
ORA-19870: error reading backup piece /oradata/0mk3tikd_1_1
ORA-19573: cannot obtain exclusive enqueue for datafile 2

以下是关闭另外一个实例后的恢复过程
RMAN>
[oracle@rac1 ~]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Sat Jan 3 21:02:48 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database (not started)
RMAN> startup mount;
Oracle instance started
database mounted
Total System Global Area 285212672 bytes
Fixed Size 1267068 bytes
Variable Size 104860292 bytes
Database Buffers 176160768 bytes
Redo Buffers 2924544 bytes
RMAN> restore database
2> ;
Starting restore at 03-JAN-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to +DISKGROUP/rac/datafile/undotbs1.269.669804571
restoring datafile 00003 to +DISKGROUP/rac/datafile/sysaux.270.669804585
restoring datafile 00005 to +DISKGROUP/rac/datafile/users.278.672888597
restoring datafile 00007 to /oradata/paul01.dbf
channel ORA_DISK_1: reading from backup piece /oradata/0mk3tikd_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/oradata/0mk3tikd_1_1 tag=TAG20090103T203524
channel ORA_DISK_1: restore complete, elapsed time: 00:01:09
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +DISKGROUP/rac/datafile/system.268.669804533
channel ORA_DISK_1: reading from backup piece /oradata/0nk3tilq_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/oradata/0nk3tilq_1_1 tag=TAG20090103T203524
channel ORA_DISK_1: restore complete, elapsed time: 00:01:20
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to +DISKGROUP/rac/datafile/undotbs2.272.669804611
channel ORA_DISK_1: reading from backup piece /oradata/0ok3timu_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/oradata/0ok3timu_1_1 tag=TAG20090103T203524
channel ORA_DISK_1: restore complete, elapsed time: 00:00:37
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00006 to +DISKGROUP/rac/datafile/test.277.669863437
channel ORA_DISK_1: reading from backup piece /oradata/0pk3tin1_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/oradata/0pk3tin1_1_1 tag=TAG20090103T203524
channel ORA_DISK_1: restore complete, elapsed time: 00:00:18
Finished restore at 03-JAN-09
RMAN> recover database;
Starting recover at 03-JAN-09
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 52 is already on disk as file +DISKGROUP/rac/archivelog/2009_01_03/thread_1_seq_52.284.675204727
archive log thread 2 sequence 40 is already on disk as file +DISKGROUP/rac/archivelog/2009_01_03/thread_2_seq_40.285.675204811
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=51
channel ORA_DISK_1: restoring archive log
archive log thread=2 sequence=39
channel ORA_DISK_1: reading from backup piece /oradata/0rk3ting_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/oradata/0rk3ting_1_1 tag=TAG20090103T203703
channel ORA_DISK_1: restore complete, elapsed time: 00:00:08
archive log filename=+DISKGROUP/rac/archivelog/2009_01_03/thread_1_seq_51.279.675206019 thread=1 sequence=51
archive log filename=+DISKGROUP/rac/archivelog/2009_01_03/thread_2_seq_39.286.675206019 thread=2 sequence=39 ---可以看到 两个实例下的归档日志都可以恢复

media recovery complete, elapsed time: 00:00:09
Finished recover at 03-JAN-09
RMAN> alter database open;
database opened
RMAN>


启动另外个节点,验证数据
SQL> startup
ORACLE instance started.

Total System Global Area 285212672 bytes
Fixed Size 1267068 bytes
Variable Size 92277380 bytes
Database Buffers 188743680 bytes
Redo Buffers 2924544 bytes
Database mounted.
Database opened.
SQL>

SQL> select count(*) from t;
COUNT(*)
----------
642752

一致 恢复完成

总结:10g rac+asm的备份与恢复和单实例差不多,很方便管理,
目前我们客户是9irac+裸设备的方式,由于归档日志文件不能放在裸设备上,只能放在文件系统上,
所以备份与恢复相对就麻烦些,必须在各个节点上备份各自的归档日志文件,和相应恢复各自的归档
日志文件


上一篇:Oracle RAC数据库在裸设备下的恢复
下一篇:ORA-04045: errors during recompilation/revalidation of LBACSYS.LBAC_EVENTS
回复

使用道具 举报

1框架
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表