熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

對Oracle10g ASM生產數據庫備份和恢復

2022-06-13   來源: Oracle 

  新的g ASM生產數據庫即將上線以下是上線前做的簡單的備份恢復測試:
  
  首先執行備份
  
  $ rman target / @full_baksql
  
  Recovery Manager: Release bit Production
  
  Copyright (c) Oracle All rights reserved
  
  connected to target database: MMSDB (DBID=)
  
  RMAN> run {
  > backup database plus archivelog delete all input;
  > delete obsolete;
  > }
  >
  
  Starting backup at APR
  current log archived
  using target database controlfile instead of recovery catalog
  allocated channel: ORA_DISK_
  channel ORA_DISK_: sid= devtype=DISK
  channel ORA_DISK_: starting archive log backupset
  channel ORA_DISK_: specifying archive log(s) in backup set
  input archive log thread= sequence= recid= stamp=
  channel ORA_DISK_: starting piece at APR
  channel ORA_DISK_: finished piece at APR
  piece handle=/msflsh/MMSDB/backupset/__/o_mf_annnn_TAGT_sry_bkp
   comment=NONE
  channel ORA_DISK_: backup set complete elapsed time: ::
  channel ORA_DISK_: deleting archive log(s)
  archive log filename=/msflsh/MMSDB/archivelog/__/o_mf___spg_arc recid=
   stamp=
  Finished backup at APR
  
  Starting backup at APR
  using channel ORA_DISK_
  channel ORA_DISK_: starting full datafile backupset
  channel ORA_DISK_: specifying datafile(s) in backupset
  input datafile fno= name=+DATADG/mmsdb/datafile/system
  input datafile fno= name=+DATADG/mmsdb/datafile/sysaux
  input datafile fno= name=+DATADG/mmsdb/datafile/undotbs
  input datafile fno= name=+DATADG/mmsdb/datafile/users
  channel ORA_DISK_: starting piece at APR
  channel ORA_DISK_: finished piece at APR
  piece handle=/msflsh/MMSDB/backupset/__/o_mf_nnndf_TAGT_sthq_bkp
   comment=NONE
  channel ORA_DISK_: backup set complete elapsed time: ::
  Finished backup at APR
  
  Starting backup at APR
  current log archived
  using channel ORA_DISK_
  channel ORA_DISK_: starting archive log backupset
  channel ORA_DISK_: specifying archive log(s) in backup set
  input archive log thread= sequence= recid= stamp=
  channel ORA_DISK_: starting piece at APR
  channel ORA_DISK_: finished piece at APR
  piece handle=/msflsh/MMSDB/backupset/__/o_mf_annnn_TAGT_sbwm_bkp
  comment=NONE
  channel ORA_DISK_: backup set complete elapsed time: ::
  channel ORA_DISK_: deleting archive log(s)
  archive log filename=/msflsh/MMSDB/archivelog/__/o_mf___smj_arc recid=
  stamp=
  Finished backup at APR
  
  Starting Control File and SPFILE Autobackup at APR
  piece handle=/msflsh/MMSDB/autobackup/__/o_mf_s__sdf_bkp
  comment=NONE
  Finished Control File and SPFILE Autobackup at APR
  
  RMAN retention policy will be applied to the command
  RMAN retention policy is set to redundancy
  using channel ORA_DISK_
  no obsolete backups found
  
  Recovery Manager complete
  
  凍結HA停止數據庫進行恢復
  
  $ id
  uid=(oracle) gid=(dba)
  $ exit
  # id
  uid=(root) gid=(other)
  # hagrp freeze MMSDB persistent
  # su oracle
  Sun Microsystems Inc  SunOS     Generic Patch  October
  You have new mail
  $ id
  uid=(oracle) gid=(dba)
  $ sqlplus / as sysdba
  
  SQL*Plus: Release Production on Wed Apr ::
  
  Copyright (c) Oracle All rights reserved
  
  Connected to:
  Oracle Database g Enterprise Edition Release bit 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 g Enterprise Edition Release bit Production
  With the Partitioning and Data Mining options
  
  執行恢復
  
  $ rman target /
  
  Recovery Manager: Release bit Production
  
  Copyright (c) Oracle All rights reserved
  
  connected to target database (not started)
  
  RMAN> startup mount;
  
  Oracle instance started
  database mounted
  
  Total System Global Area   bytes
  
  Fixed Size           bytes
  Variable Size         bytes
  Database Buffers       bytes
  Redo Buffers          bytes
  
  RMAN> restore database;
  Starting restore at APR
  using target database controlfile instead of recovery catalog
  allocated channel: ORA_DISK_
  channel ORA_DISK_: sid= devtype=DISK
  
  channel ORA_DISK_: starting datafile backupset restore
  channel ORA_DISK_: specifying datafile(s) to restore from backup set
  restoring datafile to +DATADG/mmsdb/datafile/system
  restoring datafile to +DATADG/mmsdb/datafile/undotbs
  restoring datafile to +DATADG/mmsdb/datafile/sysaux
  restoring datafile to +DATADG/mmsdb/datafile/users
  channel ORA_DISK_: restored backup piece
  piece handle=/msflsh/MMSDB/backupset/__/o_mf_nnndf_TAGT_sthq_bkp
  tag=TAGT
  channel ORA_DISK_: restore complete
  Finished restore at APR
  
  RMAN> recover database;
  Starting recover at APR
  using channel ORA_DISK_
  
  starting media recovery
  media recovery complete
  
  Finished recover at APR
  
  RMAN> alter database open;
  database opened
  
  RMAN>
  
  最後不要忘記解凍HA
  
  $ exit
  # id
  uid=(root) gid=(other)
  # hagrp unfreeze MMSDB persistent
  
  測試過程僅供參考
From:http://tw.wingwit.com/Article/program/Oracle/201311/17449.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.