程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle數據庫基礎 >> 對即將上線的Oracle10g ASM生產數據庫進行備份恢復測試

對即將上線的Oracle10g ASM生產數據庫進行備份恢復測試

編輯:Oracle數據庫基礎
新的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

測試過程,僅供參考.
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved