免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1900 | 回复: 1
打印 上一主题 下一主题

[备份软件] 在RAC环境中进行多结点的备份以及交叉存储备份集 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-12-20 18:11 |只看该作者 |倒序浏览
结论::
这种交叉存储备份集的方法,不实用!
如果当其中的一个节点掉电,该节点上的一个备份集就不可访问,
那么在正常节点恢复时,该节点也没有完整的备份集,所以不可恢复!


在RAC环境中进行多结点的备份以及交叉存储备份集!

(1)RMAN备份脚本:
脚本关键:a.在各节点分配通道;b.重写默认的自动定位功能,指定从哪里备份文件
run{
allocate channel c1 type disk connect 'sys/sys@game2_rman';
allocate channel c2 type disk connect 'sys/sys@game1_rman';
BACKUP
  tag AAAA
  (DATAFILE 1,2,3 CHANNEL c1)
  (DATAFILE 4,5,6 CHANNEL c2);
BACKUP
  tag BBBB
  (DATAFILE 1,2,3 CHANNEL c2)
  (DATAFILE 4,5,6 CHANNEL c1);
}

注意:tag AAAA是一个完整备份,但分布在了两个节点,tag BBBB也是!

(2)注意要配置net为专有服务器模式:
说明:RMAN连接非常苛刻,必须配置成专有服务器模式,否则报错RMAN-03009和ORA-19550!
配置只需要添加一个专门的RMAN连接就行,如下GAME1_RMAN和GAME2_RMAN就是针对RMAN特意添加的连接项
[oracle@orac1 admin]$ cat tnsnames.ora
# TNSNAMES.ORA Network Configuration File: /opt/oracle/product/9i/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

GAME2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = orac2)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = game)
      (INSTANCE_NAME = game2)
    )
  )

GAME2_RMAN =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = orac2)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = game)
      (INSTANCE_NAME = game2)
    )
  )

GAME1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = orac1)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = game)
      (INSTANCE_NAME = game1)
    )
  )

GAME1_RMAN =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = orac1)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = game)
      (INSTANCE_NAME = game1)
    )
  )

LISTENERS_GAME =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = orac1)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = orac2)(PORT = 1521))
  )

GAME =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = orac1)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = orac2)(PORT = 1521))
      (LOAD_BALANCE = yes)
    )
    (CONNECT_DATA =
      (SERVICE_NAME = game)
    )
  )

(3)在其中一个节点(节点一orac1)执行脚本:
[oracle@orac1 oracle]$ 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 connect 'sys/sys@game2_rman';
3> allocate channel c2 type disk connect 'sys/sys@game1_rman';
4> BACKUP
5>   tag AAAA
6>   (DATAFILE 1,2,3 CHANNEL c1)
7>   (DATAFILE 4,5,6 CHANNEL c2);
8> BACKUP
9>   tag BBBB
10>   (DATAFILE 1,2,3 CHANNEL c2)
11>   (DATAFILE 4,5,6 CHANNEL c1);
12> }

allocated channel: c1
channel c1: sid=19 devtype=DISK

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

Starting backup at 20-DEC-06
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
channel c2: starting full datafile backupset
channel c2: specifying datafile(s) in backupset
input datafile fno=00005 name=/opt/oracle/oradata/game/undotbs02.dbf
input datafile fno=00006 name=/opt/oracle/oradata/game/users01.dbf
input datafile fno=00004 name=/opt/oracle/oradata/game/tools01.dbf
channel c2: starting piece 1 at 20-DEC-06
including current SPFILE in backupset
including current controlfile in backupset
input datafile fno=00001 name=/opt/oracle/oradata/game/system01.dbf
input datafile fno=00002 name=/opt/oracle/oradata/game/undotbs01.dbf
input datafile fno=00003 name=/opt/oracle/oradata/game/indx01.dbf
channel c1: starting piece 1 at 20-DEC-06
channel c1: finished piece 1 at 20-DEC-06
piece handle=/opt/oracle/product/9i/dbs/0di5ebur_1_1 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:36
channel c2: finished piece 1 at 20-DEC-06
piece handle=/opt/oracle/product/9i/dbs/0ei5ebtt_1_1 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:36
Finished backup at 20-DEC-06

Starting backup at 20-DEC-06
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00005 name=/opt/oracle/oradata/game/undotbs02.dbf
input datafile fno=00006 name=/opt/oracle/oradata/game/users01.dbf
input datafile fno=00004 name=/opt/oracle/oradata/game/tools01.dbf
channel c1: starting piece 1 at 20-DEC-06
channel c2: starting full datafile backupset
channel c2: specifying datafile(s) in backupset
including current SPFILE in backupset
including current controlfile in backupset
input datafile fno=00001 name=/opt/oracle/oradata/game/system01.dbf
input datafile fno=00002 name=/opt/oracle/oradata/game/undotbs01.dbf
input datafile fno=00003 name=/opt/oracle/oradata/game/indx01.dbf
channel c2: starting piece 1 at 20-DEC-06
channel c1: finished piece 1 at 20-DEC-06
piece handle=/opt/oracle/product/9i/dbs/0fi5ebvv_1_1 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:27
channel c2: finished piece 1 at 20-DEC-06
piece handle=/opt/oracle/product/9i/dbs/0gi5ebv1_1_1 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:27
Finished backup at 20-DEC-06
released channel: c1
released channel: c2

RMAN>

(4)查看备份集信息:

(4.1)查各节点中的备份集
orac1:
[oracle@orac1 dbs]$ pwd
/opt/oracle/product/9i/dbs
[oracle@orac1 dbs]$ ls -l
total 1962772
-rw-r-----    1 oracle   dba      238419968 Dec 20 13:58 05i5e72v_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 13:58 06i5e72v_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 13:58 07i5e73p_1_1
-rw-r-----    1 oracle   dba      238419968 Dec 20 13:58 08i5e73p_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 14:45 0ai5e9s1_1_1
-rw-r-----    1 oracle   dba      238419968 Dec 20 14:46 0ci5e9sr_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 15:20 0ei5ebtt_1_1
-rw-r-----    1 oracle   dba      238419968 Dec 20 15:21 0gi5ebv1_1_1
-rw-r--r--    1 oracle   dba          1419 Dec 18 22:34 bak_initgame1.ora
-rw-r-----    1 oracle   dba          3584 Dec 18 21:53 bak_spfilegame1.ora
-rw-r--r--    1 oracle   dba          8385 Mar  9  2002 init.ora
-rw-r--r--    1 oracle   dba         12920 Mar  8  2002 initdw.ora
-rw-r--r--    1 oracle   dba            49 Dec 18 22:34 initgame1.ora
-rwSr-----    1 oracle   dba          1536 Dec 20 14:19 orapwgame1
-rw-r-----    1 oracle   dba      12247040 Dec 20 15:21 snapcf_game1.f
[oracle@orac1 dbs]$

orac2:
[oracle@orac2 dbs]$ pwd
/opt/oracle/product/9i/dbs
[oracle@orac2 dbs]$ ls -l
total 987396
-rw-r-----    1 oracle   dba      238419968 Dec 20 14:46 09i5e9sv_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 14:46 0bi5e9tp_1_1
-rw-r-----    1 oracle   dba      238419968 Dec 20 15:21 0di5ebur_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 15:22 0fi5ebvv_1_1
-rw-r--r--    1 oracle   dba          1419 Dec 18 22:35 bak_initgame2.ora
-rw-r-----    1 oracle   dba          3584 Dec 18 21:53 bak_spfilegame2.ora
-rw-r--r--    1 oracle   dba          8385 Mar  9  2002 init.ora
-rw-r--r--    1 oracle   dba         12920 Mar  8  2002 initdw.ora
-rw-r--r--    1 oracle   dba            49 Dec 18 22:36 initgame2.ora
-rwSr-----    1 oracle   dba          1536 Dec 20 14:20 orapwgame2
-rw-r-----    1 oracle   dba      12247040 Dec 20 15:21 snapcf_game2.f
[oracle@orac2 dbs]$

(4.2)查具体的备份信息:
RMAN> list backup summary;


List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Tag
------- -- -- - ----------- --------------- ------- ------- ---
1       B  0  A DISK        18-DEC-06       1       1       INC_L0_ORCL_BACKUP
2       B  0  A DISK        18-DEC-06       1       1       INC_L0_ORCL_BACKUP
3       B  0  A DISK        18-DEC-06       1       1       INC_L0_ORCL_BACKUP
4       B  0  A DISK        18-DEC-06       1       1       INC_L0_ORCL_BACKUP
5       B  F  A DISK        20-DEC-06       1       1       TAG20061220T135751
6       B  F  A DISK        20-DEC-06       1       1       TAG20061220T135751
7       B  F  A DISK        20-DEC-06       1       1       TAG20061220T135817
8       B  F  A DISK        20-DEC-06       1       1       TAG20061220T135817
9       B  F  A DISK        20-DEC-06       1       1       TAG20061220T144521
10      B  F  A DISK        20-DEC-06       1       1       TAG20061220T144521
11      B  F  A DISK        20-DEC-06       1       1       TAG20061220T144547
12      B  F  A DISK        20-DEC-06       1       1       TAG20061220T144547
13      B  F  A DISK        20-DEC-06       1       1       AAAA
14      B  F  A DISK        20-DEC-06       1       1       AAAA
15      B  F  A DISK        20-DEC-06       1       1       BBBB
16      B  F  A DISK        20-DEC-06       1       1       BBBB

RMAN>
说明:Key =13,14,15,16为此次备份

控制文件的备份信息:
RMAN> list backup of controlfile;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Incr 0  11M        DISK        00:00:14     18-DEC-06      
        BP Key: 1   Status: AVAILABLE   Tag: INC_L0_ORCL_BACKUP
        Piece Name: /home/oracle/fullbak/L0_GAME_20061218_01i5a0oe_1_1
  Controlfile Included: Ckp SCN: 1916695      Ckp time: 18-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Incr 0  11M        DISK        00:00:12     18-DEC-06      
        BP Key: 3   Status: AVAILABLE   Tag: INC_L0_ORCL_BACKUP
        Piece Name: /home/oracle/fullbak/L0_GAME_20061218_03i5a0tk_1_1
  Controlfile Included: Ckp SCN: 1916882      Ckp time: 18-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5       Full    11M        DISK        00:00:20     20-DEC-06      
        BP Key: 5   Status: AVAILABLE   Tag: TAG20061220T135751
        Piece Name: /opt/oracle/product/9i/dbs/05i5e72v_1_1
  Controlfile Included: Ckp SCN: 2250036      Ckp time: 20-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8       Full    11M        DISK        00:00:22     20-DEC-06      
        BP Key: 8   Status: AVAILABLE   Tag: TAG20061220T135817
        Piece Name: /opt/oracle/product/9i/dbs/08i5e73p_1_1
  Controlfile Included: Ckp SCN: 2250079      Ckp time: 20-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
9       Full    11M        DISK        00:00:22     20-DEC-06      
        BP Key: 9   Status: AVAILABLE   Tag: TAG20061220T144521
        Piece Name: /opt/oracle/product/9i/dbs/09i5e9sv_1_1
  Controlfile Included: Ckp SCN: 2258524      Ckp time: 20-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
12      Full    11M        DISK        00:00:24     20-DEC-06      
        BP Key: 12   Status: AVAILABLE   Tag: TAG20061220T144547
        Piece Name: /opt/oracle/product/9i/dbs/0ci5e9sr_1_1
  Controlfile Included: Ckp SCN: 2258564      Ckp time: 20-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
13      Full    11M        DISK        00:00:26     20-DEC-06      
        BP Key: 13   Status: AVAILABLE   Tag: AAAA
        Piece Name: /opt/oracle/product/9i/dbs/0di5ebur_1_1
  Controlfile Included: Ckp SCN: 2263477      Ckp time: 20-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
15      Full    11M        DISK        00:00:25     20-DEC-06      
        BP Key: 15   Status: AVAILABLE   Tag: BBBB
        Piece Name: /opt/oracle/product/9i/dbs/0gi5ebv1_1_1
  Controlfile Included: Ckp SCN: 2263523      Ckp time: 20-DEC-06

RMAN>
说明:key=13,15中含有控制文件的备份信息,
分别在orac2:/opt/oracle/product/9i/dbs/0di5ebur_1_1和
orac1:/opt/oracle/product/9i/dbs/0gi5ebv1_1_1

参数文件的备份信息:
RMAN> list backup of spfile;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Incr 0  0          DISK        00:00:14     18-DEC-06      
        BP Key: 1   Status: AVAILABLE   Tag: INC_L0_ORCL_BACKUP
        Piece Name: /home/oracle/fullbak/L0_GAME_20061218_01i5a0oe_1_1
  SPFILE Included: Modification time: 18-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Incr 0  0          DISK        00:00:12     18-DEC-06      
        BP Key: 3   Status: AVAILABLE   Tag: INC_L0_ORCL_BACKUP
        Piece Name: /home/oracle/fullbak/L0_GAME_20061218_03i5a0tk_1_1
  SPFILE Included: Modification time: 18-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5       Full    0          DISK        00:00:20     20-DEC-06      
        BP Key: 5   Status: AVAILABLE   Tag: TAG20061220T135751
        Piece Name: /opt/oracle/product/9i/dbs/05i5e72v_1_1
  SPFILE Included: Modification time: 18-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8       Full    0          DISK        00:00:22     20-DEC-06      
        BP Key: 8   Status: AVAILABLE   Tag: TAG20061220T135817
        Piece Name: /opt/oracle/product/9i/dbs/08i5e73p_1_1
  SPFILE Included: Modification time: 18-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
9       Full    0          DISK        00:00:22     20-DEC-06      
        BP Key: 9   Status: AVAILABLE   Tag: TAG20061220T144521
        Piece Name: /opt/oracle/product/9i/dbs/09i5e9sv_1_1
  SPFILE Included: Modification time: 18-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
12      Full    0          DISK        00:00:24     20-DEC-06      
        BP Key: 12   Status: AVAILABLE   Tag: TAG20061220T144547
        Piece Name: /opt/oracle/product/9i/dbs/0ci5e9sr_1_1
  SPFILE Included: Modification time: 18-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
13      Full    0          DISK        00:00:26     20-DEC-06      
        BP Key: 13   Status: AVAILABLE   Tag: AAAA
        Piece Name: /opt/oracle/product/9i/dbs/0di5ebur_1_1
  SPFILE Included: Modification time: 18-DEC-06

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
15      Full    0          DISK        00:00:25     20-DEC-06      
        BP Key: 15   Status: AVAILABLE   Tag: BBBB
        Piece Name: /opt/oracle/product/9i/dbs/0gi5ebv1_1_1
  SPFILE Included: Modification time: 18-DEC-06

RMAN>
说明:key=13,15中含有参数文件的备份信息,
分别在orac2:/opt/oracle/product/9i/dbs/0di5ebur_1_1和
orac1:/opt/oracle/product/9i/dbs/0gi5ebv1_1_1

[[i] 本帖最后由 tsingsong99 于 2006-12-20 18:15 编辑 [/i]]

论坛徽章:
0
2 [报告]
发表于 2006-12-20 18:14 |只看该作者
(5)恢复测试:
我们使用没有执行备份操作的节点orac2进行恢复;

(5.1)制造故障:关闭数据库;
(5.2)制造故障:让整个数据文件目录丢失;
[oracle@orac1 oradata]$ pwd
/opt/oracle/oradata
[oracle@orac1 oradata]$ ls -l
total 258
drwxr-xr-x    1 oracle   dba        131072 Dec 18 18:29 archived_log
drwxr-xr-x    1 oracle   dba        131072 Dec 10 17:52 game
drwxr-xr-x    1 oracle   dba        131072 Dec 10 17:52 gamedb
[oracle@orac1 oradata]$ mv game game_bak
[oracle@orac1 oradata]$ mkdir game
[oracle@orac1 oradata]$

(5.3)将无关备份集先藏起来
orac1的所有备份信息藏匿:
[oracle@orac1 dbs]$ ls -l
total 1962776
-rw-r-----    1 oracle   dba      238419968 Dec 20 13:58 05i5e72v_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 13:58 06i5e72v_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 13:58 07i5e73p_1_1
-rw-r-----    1 oracle   dba      238419968 Dec 20 13:58 08i5e73p_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 14:45 0ai5e9s1_1_1
-rw-r-----    1 oracle   dba      238419968 Dec 20 14:46 0ci5e9sr_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 15:20 0ei5ebtt_1_1
-rw-r-----    1 oracle   dba      238419968 Dec 20 15:21 0gi5ebv1_1_1
-rw-r--r--    1 oracle   dba          1419 Dec 18 22:34 bak_initgame1.ora
-rw-r-----    1 oracle   dba          3584 Dec 18 21:53 bak_spfilegame1.ora
drwxr-xr-x    2 oracle   dba          4096 Dec 20 15:49 bakset
-rw-r--r--    1 oracle   dba          8385 Mar  9  2002 init.ora
-rw-r--r--    1 oracle   dba         12920 Mar  8  2002 initdw.ora
-rw-r--r--    1 oracle   dba            49 Dec 18 22:34 initgame1.ora
-rwSr-----    1 oracle   dba          1536 Dec 20 14:19 orapwgame1
-rw-r-----    1 oracle   dba      12247040 Dec 20 15:21 snapcf_game1.f
[oracle@orac1 dbs]$ mv 0* bakset/
[oracle@orac1 dbs]$ ls -l
total 12024
-rw-r--r--    1 oracle   dba          1419 Dec 18 22:34 bak_initgame1.ora
-rw-r-----    1 oracle   dba          3584 Dec 18 21:53 bak_spfilegame1.ora
drwxr-xr-x    2 oracle   dba          4096 Dec 20 15:49 bakset
-rw-r--r--    1 oracle   dba          8385 Mar  9  2002 init.ora
-rw-r--r--    1 oracle   dba         12920 Mar  8  2002 initdw.ora
-rw-r--r--    1 oracle   dba            49 Dec 18 22:34 initgame1.ora
-rwSr-----    1 oracle   dba          1536 Dec 20 14:19 orapwgame1
-rw-r-----    1 oracle   dba      12247040 Dec 20 15:21 snapcf_game1.f
[oracle@orac1 dbs]$

orac2的非盖茨备份信息藏匿:
[oracle@orac2 dbs]$ pwd
/opt/oracle/product/9i/dbs
[oracle@orac2 dbs]$ ls -l
total 499712
-rw-r-----    1 oracle   dba      238419968 Dec 20 15:21 0di5ebur_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 15:22 0fi5ebvv_1_1
-rw-r--r--    1 oracle   dba          1419 Dec 18 22:35 bak_initgame2.ora
-rw-r-----    1 oracle   dba          3584 Dec 18 21:53 bak_spfilegame2.ora
drwxr-xr-x    2 oracle   dba          4096 Dec 20 15:52 bakset
-rw-r--r--    1 oracle   dba          8385 Mar  9  2002 init.ora
-rw-r--r--    1 oracle   dba         12920 Mar  8  2002 initdw.ora
-rw-r--r--    1 oracle   dba            49 Dec 18 22:36 initgame2.ora
-rwSr-----    1 oracle   dba          1536 Dec 20 14:20 orapwgame2
-rw-r-----    1 oracle   dba      12247040 Dec 20 15:21 snapcf_game2.f
[oracle@orac2 dbs]$

(5.4)从节点orac2启动数据库,发现报错
[oracle@orac2 oradata]$ pwd
/opt/oracle/oradata
[oracle@orac2 oradata]$ ls
archived_log  game  game_bak  gamedb
[oracle@orac2 oradata]$ cd game
[oracle@orac2 game]$ ls
[oracle@orac2 game]$
[oracle@orac2 game]$ sqlplus '/ as sysdba'

SQL*Plus: Release 9.2.0.4.0 - Production on Wed Dec 20 16:43:48 2006

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

Connected to an idle instance.

SQL> startup
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
SQL> exit
Disconnected
[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> exit


Recovery Manager complete.
[oracle@orac2 game]$
(5.5)为了使用RMAN,添加必要的init文件(控制文件的添加是多余的)
[oracle@orac2 game]$ cd ..
[oracle@orac2 oradata]$ cd game_bak/
[oracle@orac2 game_bak]$ cp control0* ../game   ----添加控制文件:即该测试假设控制文件没有丢失.
[oracle@orac2 game]$ ls -l
total 35882
-rw-r-----    1 oracle   dba      12247040 Dec 20 16:45 control01.ctl
-rw-r-----    1 oracle   dba      12247040 Dec 20 16:45 control02.ctl
-rw-r-----    1 oracle   dba      12247040 Dec 20 16:45 control03.ctl
[oracle@orac2 game]$
[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>  allocate channel c3 type disk;
5>  restore database ;
6>  recover database;
7>  alter database open;
8>  }

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/20/2006 16:49:26
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]$ cp ../game_bak/spfilegame.ora ./  ----添加init文件
[oracle@orac2 game]$
[oracle@orac2 game]$ ls -l
total 35886
-rw-r-----    1 oracle   dba      12247040 Dec 20 16:45 control01.ctl
-rw-r-----    1 oracle   dba      12247040 Dec 20 16:45 control02.ctl
-rw-r-----    1 oracle   dba      12247040 Dec 20 16:45 control03.ctl
-rw-r-----    1 oracle   dba          3584 Dec 20 16:50 spfilegame.ora
[oracle@orac2 game]$
[oracle@orac2 game]$ sqlplus '/ as sysdba'

SQL*Plus: Release 9.2.0.4.0 - Production on Wed Dec 20 16:51:01 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]$

(5.6)再次恢复
[oracle@orac2 game]$ rman target sys/sys@game2_rman

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>  restore database ;
4>  recover database;
5>  alter database open;
6>  }

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

Starting restore at 20-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 00002 to /opt/oracle/oradata/game/undotbs01.dbf
restoring datafile 00003 to /opt/oracle/oradata/game/indx01.dbf
released channel: c1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 12/20/2006 17:01:42
ORA-19505: failed to identify file "/opt/oracle/product/9i/dbs/0gi5ebv1_1_1"
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3

RMAN>

(5.7)还是缺少备份集文件dbs/0gi5ebv1_1_1,只好在orac1中还原.
[oracle@orac1 dbs]$ pwd
/opt/oracle/product/9i/dbs
[oracle@orac1 dbs]$ cd bakset/
[oracle@orac1 bakset]$ ls
05i5e72v_1_1  06i5e72v_1_1  07i5e73p_1_1  08i5e73p_1_1  0ai5e9s1_1_1  0ci5e9sr_1_1  0ei5ebtt_1_1  0gi5ebv1_1_1
[oracle@orac1 bakset]$ ls -l
total 1950752
-rw-r-----    1 oracle   dba      238419968 Dec 20 13:58 05i5e72v_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 13:58 06i5e72v_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 13:58 07i5e73p_1_1
-rw-r-----    1 oracle   dba      238419968 Dec 20 13:58 08i5e73p_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 14:45 0ai5e9s1_1_1
-rw-r-----    1 oracle   dba      238419968 Dec 20 14:46 0ci5e9sr_1_1
-rw-r-----    1 oracle   dba      260472832 Dec 20 15:20 0ei5ebtt_1_1
-rw-r-----    1 oracle   dba      238419968 Dec 20 15:21 0gi5ebv1_1_1
[oracle@orac1 bakset]$ cp 0ei5ebtt_1_1 0gi5ebv1_1_1 ../
[oracle@orac1 bakset]$ cd ../
[oracle@orac1 dbs]$ ls -l
total 499712
-rw-r-----    1 oracle   dba      260472832 Dec 20 17:17 0ei5ebtt_1_1
-rw-r-----    1 oracle   dba      238419968 Dec 20 17:18 0gi5ebv1_1_1
-rw-r--r--    1 oracle   dba          1419 Dec 18 22:34 bak_initgame1.ora
-rw-r-----    1 oracle   dba          3584 Dec 18 21:53 bak_spfilegame1.ora
drwxr-xr-x    2 oracle   dba          4096 Dec 20 15:49 bakset
-rw-r--r--    1 oracle   dba          8385 Mar  9  2002 init.ora
-rw-r--r--    1 oracle   dba         12920 Mar  8  2002 initdw.ora
-rw-r--r--    1 oracle   dba            49 Dec 18 22:34 initgame1.ora
-rwSr-----    1 oracle   dba          1536 Dec 20 14:19 orapwgame1
-rw-r-----    1 oracle   dba      12247040 Dec 20 15:21 snapcf_game1.f
[oracle@orac1 dbs]$

(5.8)由于缺少再现日志文件,做不完全恢复
RMAN>

RMAN>  run{
2>  allocate channel c1 type disk connect 'sys/sys@game2_rman';
3>  allocate channel c2 type disk connect 'sys/sys@game1_rman';
4>  restore database until sequence 28 thread 2;
5>  recover database until sequence 28 thread 2;
6>  alter database open resetlogs;
7>  }

allocated channel: c1
channel c1: sid=18 devtype=DISK

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

Starting restore at 20-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 20-DEC-06

Starting recover at 20-DEC-06

starting media recovery

archive log thread 2 sequence 23 is already on disk as file /opt/oracle/oradata/archived_log/arch2_23.dbf
archive log thread 1 sequence 12 is already on disk as file /opt/oracle/oradata/archived_log/arch1_12.dbf
archive log thread 2 sequence 24 is already on disk as file /opt/oracle/oradata/archived_log/arch2_24.dbf
archive log thread 1 sequence 13 is already on disk as file /opt/oracle/oradata/archived_log/arch1_13.dbf
archive log thread 2 sequence 25 is already on disk as file /opt/oracle/oradata/archived_log/arch2_25.dbf
archive log thread 1 sequence 14 is already on disk as file /opt/oracle/oradata/archived_log/arch1_14.dbf
archive log thread 2 sequence 26 is already on disk as file /opt/oracle/oradata/archived_log/arch2_26.dbf
archive log thread 1 sequence 15 is already on disk as file /opt/oracle/oradata/archived_log/arch1_15.dbf
archive log thread 2 sequence 27 is already on disk as file /opt/oracle/oradata/archived_log/arch2_27.dbf
archive log thread 1 sequence 16 is already on disk as file /opt/oracle/oradata/archived_log/arch1_16.dbf
archive log filename=/opt/oracle/oradata/archived_log/arch1_12.dbf thread=1 sequence=12
archive log filename=/opt/oracle/oradata/archived_log/arch2_23.dbf thread=2 sequence=23
archive log filename=/opt/oracle/oradata/archived_log/arch2_24.dbf thread=2 sequence=24
archive log filename=/opt/oracle/oradata/archived_log/arch1_13.dbf thread=1 sequence=13
archive log filename=/opt/oracle/oradata/archived_log/arch2_25.dbf thread=2 sequence=25
archive log filename=/opt/oracle/oradata/archived_log/arch1_14.dbf thread=1 sequence=14
archive log filename=/opt/oracle/oradata/archived_log/arch2_26.dbf thread=2 sequence=26
archive log filename=/opt/oracle/oradata/archived_log/arch1_15.dbf thread=1 sequence=15
archive log filename=/opt/oracle/oradata/archived_log/arch2_27.dbf thread=2 sequence=27
archive log filename=/opt/oracle/oradata/archived_log/arch1_16.dbf thread=1 sequence=16
media recovery complete
Finished recover at 20-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 Wed Dec 20 17:59:23 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>

结论::
这种交叉存储备份集的方法,不实用!
如果当其中的一个节点掉电,该节点上的一个备份集就不可访问,
那么在正常节点恢复时,该节点也没有完整的备份集,所以不可恢复!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP