[field:fulltitle/]

首页 > 数据库 > Oracle > 正文

对即将上线的Oracle10g ASM生产数据库进行备份恢复测试
2013-11-01 23:52  未知    我要评论

 

新的10g ASM生产数据库即将上线,以下是上线前做的简单的备份恢复测试:
1.首先执行备份

$ rman target / @full_bak.sql        

Recovery Manager: Release 10.1.0.3.0 - 64bit Production

Copyright (c) 1995, 2004, Oracle.  All rights reserved.

connected to target database: MMSDB (DBID=799462343)

RMAN> run {
2> backup database plus archivelog delete all input;    
3> delete obsolete;
4> }
5>

Starting backup at 13-APR-05
current log archived
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=162 devtype=DISK
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=28 recid=2 stamp=555502358
channel ORA_DISK_1: starting piece 1 at 13-APR-05
channel ORA_DISK_1: finished piece 1 at 13-APR-05
piece handle=/msflsh/MMSDB/backupset/2005_04_13/o1_mf_annnn_TAG20050413T101239_15s00ry0_.bkp
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=/msflsh/MMSDB/archivelog/2005_04_13/o1_mf_1_28_15s00pg2_.arc recid=2
stamp=555502358
Finished backup at 13-APR-05

Starting backup at 13-APR-05
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=00001 name=+DATADG/mmsdb/datafile/system.259.3
input datafile fno=00003 name=+DATADG/mmsdb/datafile/sysaux.257.3
input datafile fno=00002 name=+DATADG/mmsdb/datafile/undotbs1.258.3
input datafile fno=00004 name=+DATADG/mmsdb/datafile/users.256.3
channel ORA_DISK_1: starting piece 1 at 13-APR-05
channel ORA_DISK_1: finished piece 1 at 13-APR-05
piece handle=/msflsh/MMSDB/backupset/2005_04_13/o1_mf_nnndf_TAG20050413T101242_15s00thq_.bkp
comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 13-APR-05

Starting backup at 13-APR-05
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=29 recid=3 stamp=555502377
channel ORA_DISK_1: starting piece 1 at 13-APR-05
channel ORA_DISK_1: finished piece 1 at 13-APR-05
piece handle=/msflsh/MMSDB/backupset/2005_04_13/o1_mf_annnn_TAG20050413T101257_15s01bwm_.bkp
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=/msflsh/MMSDB/archivelog/2005_04_13/o1_mf_1_29_15s019mj_.arc recid=3 
stamp=555502377
Finished backup at 13-APR-05

Starting Control File and SPFILE Autobackup at 13-APR-05
piece handle=/msflsh/MMSDB/autobackup/2005_04_13/o1_mf_s_555502380_15s01df2_.bkp 
comment=NONE
Finished Control File and SPFILE Autobackup at 13-APR-05

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 2
using channel ORA_DISK_1
no obsolete backups found

Recovery Manager complete.

 


2.冻结HA,停止数据库进行恢复 
$ id
uid=101(oracle) gid=101(dba)
$ exit
# id
uid=0(root) gid=1(other)
# hagrp -freeze MMSDB -persistent
# su - oracle
Sun Microsystems Inc.   SunOS 5.8       Generic Patch   October 2001
You have new mail.
$ id
uid=101(oracle) gid=101(dba)
$ sqlplus "/ as sysdba"

SQL*Plus: Release 10.1.0.3.0 - Production on Wed Apr 13 10:19:28 2005

Copyright (c) 1982, 2004, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - 64bit Production
With the Partitioning and Data Mining options

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - 64bit Production
With the Partitioning and Data Mining options

 

3.执行恢复 
$ rman target /

Recovery Manager: Release 10.1.0.3.0 - 64bit Production

Copyright (c) 1995, 2004, Oracle.  All rights reserved.

connected to target database (not started)

RMAN> startup mount;

Oracle instance started
database mounted

Total System Global Area    3204448256 bytes

Fixed Size                     1304912 bytes
Variable Size                651957936 bytes
Database Buffers            2550136832 bytes
Redo Buffers                   1048576 bytes

RMAN> restore database;
Starting restore at 13-APR-05
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=160 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +DATADG/mmsdb/datafile/system.259.3
restoring datafile 00002 to +DATADG/mmsdb/datafile/undotbs1.258.3
restoring datafile 00003 to +DATADG/mmsdb/datafile/sysaux.257.3
restoring datafile 00004 to +DATADG/mmsdb/datafile/users.256.3
channel ORA_DISK_1: restored backup piece 1
piece handle=/msflsh/MMSDB/backupset/2005_04_13/o1_mf_nnndf_TAG20050413T101242_15s00thq_.bkp
tag=TAG20050413T101242
channel ORA_DISK_1: restore complete
Finished restore at 13-APR-05

RMAN> recover database;
Starting recover at 13-APR-05
using channel ORA_DISK_1

starting media recovery
media recovery complete

Finished recover at 13-APR-05

RMAN> alter database open;
database opened

RMAN>

 

4.最后不要忘记解冻HA 
$ exit
# id
uid=0(root) gid=1(other)
# hagrp -unfreeze MMSDB -persistent

测试过程,仅供参考.

相关文章:

关键词:

责任编辑:陈华斯