免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: mountin
打印 上一主题 下一主题

[Veritas NBU] nbu+oracle rac备份脚本 [复制链接]

论坛徽章:
0
11 [报告]
发表于 2006-12-18 17:51 |只看该作者
请问,假设此备份在节点一进行,
结果节点一瘫痪了,在节点二能回复吗???
我怀疑!!!

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
12 [报告]
发表于 2006-12-18 21:22 |只看该作者
原帖由 tsingsong99 于 2006-12-18 17:51 发表
请问,假设此备份在节点一进行,
结果节点一瘫痪了,在节点二能回复吗???
我怀疑!!!

为啥怀疑??!

论坛徽章:
0
13 [报告]
发表于 2006-12-18 23:42 |只看该作者
原帖由 yddll 于 2006-12-18 21:22 发表

为啥怀疑??!


我只是请教:如果在节点一进行备份,而在节点二实施恢复,会报错。大家有没有实践过?

论坛徽章:
0
14 [报告]
发表于 2006-12-19 00:30 |只看该作者

呵呵,RAC中在节点一备份,在节点二恢复是可以的,请看测试:

呵呵,RAC中在节点一备份,在节点二恢复是可以的,请看测试:
两节点有归档日志共享(/opt/oracle/oradata/为共享目录):
[oracle@orac2 archived_log]$ pwd
/opt/oracle/oradata/archived_log
[oracle@orac2 archived_log]$

(1)在节点一作备份
rman target / nocatalog log=/home/oracle/fullbak/full.log <<EOF
run
{
ALLOCATE channel t1 type disk;
ALLOCATE channel t2 type disk;
backup INCREMENTAL LEVEL=0
tag inc_L0_orcl_backup
(database format  '/home/oracle/fullbak/L0_%d_%T_%U' include current controlfile);
release channel t1;
release channel t2;
}
EOF

(2)故障
[oracle@orac2 game]$ ls -l
total 1382513
-rw-r-----    1 oracle   dba      12247040 Dec 10 18:06 control01.ctl
-rw-r-----    1 oracle   dba      12247040 Dec 10 18:06 control02.ctl
-rw-r-----    1 oracle   dba      12247040 Dec 10 18:06 control03.ctl
-rw-r-----    1 oracle   dba      104858112 Dec 10 18:11 game_redo2_2.log
-rw-r-----    1 oracle   dba      26222592 Dec 19 00:09 indx01.dbf
-rw-r-----    1 oracle   dba      104858112 Dec 10 18:06 redo01.log
-rw-r-----    1 oracle   dba      104858112 Dec 10 18:06 redo02.log
-rw-r-----    1 oracle   dba      104858112 Dec 10 18:11 redo03.log
-rw-r-----    1 oracle   dba          3584 Dec 18 22:33 spfilegame.ora
-rw-r-----    1 oracle   dba          3584 Dec 18 21:20 spfilegame.ora.bak
-rw-r-----    1 oracle   dba      262152192 Dec 19 00:09 system01.dbf
-rw-r-----    1 oracle   dba      41951232 Dec 10 18:06 temp01.dbf
-rw-r-----    1 oracle   dba      10493952 Dec 19 00:09 tools01.dbf
-rw-r-----    1 oracle   dba      209723392 Dec 19 00:10 undotbs01.dbf
-rw-r-----    1 oracle   dba      209723392 Dec 19 00:10 undotbs02.dbf
-rw-r-----    1 oracle   dba      199237632 Dec 19 00:10 users01.dbf
[oracle@orac2 game]$ mv indx01.dbf indx01.dbf.bak
[oracle@orac2 game]$ mv system01.dbf system01.dbf.bak
[oracle@orac2 game]$ ls -l
total 1382513
-rw-r-----    1 oracle   dba      12247040 Dec 10 18:06 control01.ctl
-rw-r-----    1 oracle   dba      12247040 Dec 10 18:06 control02.ctl
-rw-r-----    1 oracle   dba      12247040 Dec 10 18:06 control03.ctl
-rw-r-----    1 oracle   dba      104858112 Dec 10 18:11 game_redo2_2.log
-rw-r-----    1 oracle   dba      26222592 Dec 19 00:09 indx01.dbf.bak
-rw-r-----    1 oracle   dba      104858112 Dec 10 18:06 redo01.log
-rw-r-----    1 oracle   dba      104858112 Dec 10 18:06 redo02.log
-rw-r-----    1 oracle   dba      104858112 Dec 10 18:11 redo03.log
-rw-r-----    1 oracle   dba          3584 Dec 18 22:33 spfilegame.ora
-rw-r-----    1 oracle   dba          3584 Dec 18 21:20 spfilegame.ora.bak
-rw-r-----    1 oracle   dba      262152192 Dec 19 00:09 system01.dbf.bak
-rw-r-----    1 oracle   dba      41951232 Dec 10 18:06 temp01.dbf
-rw-r-----    1 oracle   dba      10493952 Dec 19 00:09 tools01.dbf
-rw-r-----    1 oracle   dba      209723392 Dec 19 00:10 undotbs01.dbf
-rw-r-----    1 oracle   dba      209723392 Dec 19 00:10 undotbs02.dbf
-rw-r-----    1 oracle   dba      199237632 Dec 19 00:10 users01.dbf
[oracle@orac2 game]$

(3)在节点二恢复
(3.1)将在节点一的备份集Copy到节点二的相同目录
[oracle@orac1 fullbak]$ pwd
/home/oracle/fullbak
[oracle@orac1 fullbak]$ ls -l
total 487716
-rw-r-----    1 oracle   dba      147898368 Dec 18 23:48 L0_GAME_20061218_03i5a0tk_1_1
-rw-r-----    1 oracle   dba      351019008 Dec 18 23:48 L0_GAME_20061218_04i5a0tk_1_1
-rw-r--r--    1 oracle   dba          1656 Dec 18 23:48 full.log
[oracle@orac1 fullbak]$

[oracle@orac2 oracle]$ cd fullbak
[oracle@orac2 fullbak]$ pwd
/home/oracle/fullbak
[oracle@orac2 fullbak]$ ls -l
total 487716
-rw-r-----    1 oracle   dba      147898368 Dec 18 23:48 L0_GAME_20061218_03i5a0tk_1_1
-rw-r-----    1 oracle   dba      351019008 Dec 18 23:48 L0_GAME_20061218_04i5a0tk_1_1
-rw-r--r--    1 oracle   dba          1656 Dec 18 23:48 full.log
[oracle@orac2 fullbak]$
(3.2)在节点二恢复

[oracle@orac2 game]$ rman target /

Recovery Manager: Release 9.2.0.4.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

connected to target database (not started)

RMAN>  run{
2>  allocate channel c1 type disk;
3>  allocate channel c2 type disk;
4>  restore database ;
5>  recover database;
6>  alter database open;
7>  }

using target database controlfile instead of recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of allocate command at 12/19/2006 00:20:51
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory

RMAN> exit


Recovery Manager complete.

[oracle@orac2 game]$ sqlplus '/ as sysdba'

SQL*Plus: Release 9.2.0.4.0 - Production on Tue Dec 19 00:21:17 2006

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1527847532 bytes
Fixed Size                   453228 bytes
Variable Size             603979776 bytes
Database Buffers          922746880 bytes
Redo Buffers                 667648 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/opt/oracle/oradata/game/system01.dbf'


SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning and Real Application Clusters options
JServer Release 9.2.0.4.0 - Production
[oracle@orac2 game]$ rman target /

Recovery Manager: Release 9.2.0.4.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.

connected to target database: GAME (DBID=4226673132)

RMAN>  run{
2>  allocate channel c1 type disk;
3>  allocate channel c2 type disk;
4>  restore database ;
5>  recover database;
6>  alter database open;
7>  }

using target database controlfile instead of recovery catalog
allocated channel: c1
channel c1: sid=21 devtype=DISK

allocated channel: c2
channel c2: sid=22 devtype=DISK

Starting restore at 19-DEC-06

channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /opt/oracle/oradata/game/system01.dbf
restoring datafile 00003 to /opt/oracle/oradata/game/indx01.dbf
channel c2: starting datafile backupset restore
channel c2: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /opt/oracle/oradata/game/undotbs01.dbf
restoring datafile 00004 to /opt/oracle/oradata/game/tools01.dbf
restoring datafile 00005 to /opt/oracle/oradata/game/undotbs02.dbf
restoring datafile 00006 to /opt/oracle/oradata/game/users01.dbf
channel c1: restored backup piece 1
piece handle=/home/oracle/fullbak/L0_GAME_20061218_03i5a0tk_1_1 tag=INC_L0_ORCL_BACKUP params=NULL
channel c1: restore complete
channel c2: restored backup piece 1
piece handle=/home/oracle/fullbak/L0_GAME_20061218_04i5a0tk_1_1 tag=INC_L0_ORCL_BACKUP params=NULL
channel c2: restore complete
Finished restore at 19-DEC-06

Starting recover at 19-DEC-06

starting media recovery
media recovery complete

Finished recover at 19-DEC-06

database opened
released channel: c1
released channel: c2

RMAN> exit


Recovery Manager complete.
[oracle@orac2 game]$ sqlplus '/ as sysdba'

SQL*Plus: Release 9.2.0.4.0 - Production on Tue Dec 19 00:23:12 2006

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning and Real Application Clusters options
JServer Release 9.2.0.4.0 - Production

SQL> select count(1) from tab;

  COUNT(1)
----------
      2395

SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning and Real Application Clusters options
JServer Release 9.2.0.4.0 - Production
[oracle@orac2 game]$

[[i] 本帖最后由 tsingsong99 于 2006-12-19 00:31 编辑 [/i]]

论坛徽章:
0
15 [报告]
发表于 2006-12-19 08:54 |只看该作者

好贴!支持!

其实自己写脚本做备份与用工具进行备份都能达到同样的效果。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP