当前位置导航:炫浪网>>网络学院>>编程开发>>Oracle教程

RMAN的备份及恢复-丢失所有控制文件


  1.数据库基本信息
  
  [oracle@standby oracle]$ sqlplus "/ as sysdba"
  
  SQL*Plus: Release 9.2.0.4.0 - Production on Wed Mar 9 09:55:14 2005
  
  Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
  
  Connected to:
  Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
  With the Partitioning option
  JServer Release 9.2.0.4.0 - Production
  
  SQL> select name from v$datafile;
  
  NAME
  --------------------------------------------------------------------------------
  /opt/oracle/oradata/primary/system01.dbf
  /opt/oracle/oradata/primary/undotbs01.dbf
  /opt/oracle/oradata/primary/users01.dbf
  
  SQL> archive log list;
  Database log mode     Archive Mode
  Automatic archival     Enabled
  Archive destination    /opt/oracle/oradata/primary/archive
  Oldest online log sequence   122
  Next log sequence to archive  124
  Current log sequence    124
  SQL> select name from v$archived_log;
  
  NAME
  --------------------------------------------------------------------------------
  /opt/oracle/oradata/primary/archive/1_109.dbf
  /opt/oracle/oradata/primary/archive/1_110.dbf
  /opt/oracle/oradata/primary/archive/1_111.dbf
  /opt/oracle/oradata/primary/archive/1_112.dbf
  /opt/oracle/oradata/primary/archive/1_113.dbf
  /opt/oracle/oradata/primary/archive/1_114.dbf
  /opt/oracle/oradata/primary/archive/1_115.dbf
  /opt/oracle/oradata/primary/archive/1_116.dbf
  /opt/oracle/oradata/primary/archive/1_117.dbf
  /opt/oracle/oradata/primary/archive/1_118.dbf
  /opt/oracle/oradata/primary/archive/1_119.dbf
  
  NAME
  --------------------------------------------------------------------------------
  /opt/oracle/oradata/primary/archive/1_120.dbf
  /opt/oracle/oradata/primary/archive/1_121.dbf
  /opt/oracle/oradata/primary/archive/1_122.dbf
  /opt/oracle/oradata/primary/archive/1_123.dbf
  
  15 rows selected.
  
  SQL> select name from v$controlfile;
  
  NAME
  --------------------------------------------------------------------------------
  /opt/oracle/oradata/primary/control01.ctl
  /opt/oracle/oradata/primary/control02.ctl
  /opt/oracle/oradata/primary/control03.ctl
  
  SQL> exit
  Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
  With the Partitioning option
  JServer Release 9.2.0.4.0 - Production
  
  2.启用控制文件的自动备份
  
  [oracle@standby 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: PRIMARY (DBID=1367687269)
  
  RMAN> configure controlfile autobackup on;
  
  using target database controlfile instead of recovery catalog
  new RMAN configuration parameters:
  CONFIGURE CONTROLFILE AUTOBACKUP ON;
  new RMAN configuration parameters are successfully stored
  
  RMAN> exit
  
  Recovery Manager complete.
  
  3.执行RMAN全备份
  
  [oracle@standby oracle]$ ls
  10g admin dictionary.ora initprimary.ora jre oradata oraInventory oui
  [oracle@standby oracle]$ mkdir orabak
  [oracle@standby 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: PRIMARY (DBID=1367687269)
  
  RMAN> run {
  2> backup database
  3> format '/opt/oracle/orabak/full_%d_%T_%s'
  4> plus archivelog
  5> format '/opt/oracle/orabak/arch_%d_%T_%s'
  6> delete all input; }
  
  Starting backup at 09-MAR-05
  current log archived
  using target database controlfile instead of recovery catalog
  allocated channel: ORA_DISK_1
  channel ORA_DISK_1: sid=14 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=109 recid=1 stamp=539688042
  input archive log thread=1 sequence=110 recid=2 stamp=539688042
  input archive log thread=1 sequence=111 recid=3 stamp=539688043
  input archive log thread=1 sequence=112 recid=4 stamp=539735252
  input archive log thread=1 sequence=113 recid=5 stamp=539789259
  input archive log thread=1 sequence=114 recid=6 stamp=539844028
  input archive log thread=1 sequence=115 recid=7 stamp=539899304
  input archive log thread=1 sequence=116 recid=8 stamp=539954539
  input archive log thread=1 sequence=117 recid=9 stamp=539972835
  input archive log thread=1 sequence=118 recid=10 stamp=541574463
  input archive log thread=1 sequence=119 recid=11 stamp=543757271
  input archive log thread=1 sequence=120 recid=12 stamp=545854003
  input archive log thread=1 sequence=121 recid=13 stamp=547951007
  input archive log thread=1 sequence=122 recid=14 stamp=550047742
  input archive log thread=1 sequence=123 recid=15 stamp=552403943
  input archive log thread=1 sequence=124 recid=16 stamp=552478112
  channel ORA_DISK_1: starting piece 1 at 09-MAR-05
  channel ORA_DISK_1: finished piece 1 at 09-MAR-05
  piece handle=/opt/oracle/orabak/arch_PRIMARY_20050309_1 comment=NONE
  channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
  channel ORA_DISK_1: deleting archive log(s)
  archive log filename=/opt/oracle/oradata/primary/archive/1_109.dbf recid=1 stamp=539688042
  archive log filename=/opt/oracle/oradata/primary/archive/1_110.dbf recid=2 stamp=539688042
  archive log filename=/opt/oracle/oradata/primary/archive/1_111.dbf recid=3 stamp=539688043
  archive log filename=/opt/oracle/oradata/primary/archive/1_112.dbf recid=4 stamp=539735252
  archive log filename=/opt/oracle/oradata/primary/archive/1_113.dbf recid=5 stamp=539789259
  archive log filename=/opt/oracle/oradata/primary/archive/1_114.dbf recid=6 stamp=539844028
  archive log filename=/opt/oracle/oradata/primary/archive/1_115.dbf recid=7 stamp=539899304
  archive log filename=/opt/oracle/oradata/primary/archive/1_116.dbf recid=8 stamp=539954539
  archive log filename=/opt/oracle/oradata/primary/archive/1_117.dbf recid=9 stamp=539972835
  archive log filename=/opt/oracle/oradata/primary/archive/1_118.dbf recid=10 stamp=541574463
  archive log filename=/opt/oracle/oradata/primary/archive/1_119.dbf recid=11 stamp=543757271
  archive log filename=/opt/oracle/oradata/primary/archive/1_120.dbf recid=12 stamp=545854003
  archive log filename=/opt/oracle/oradata/primary/archive/1_121.dbf recid=13 stamp=547951007
  archive log filename=/opt/oracle/oradata/primary/archive/1_122.dbf recid=14 stamp=550047742
  archive log filename=/opt/oracle/oradata/primary/archive/1_123.dbf recid=15 stamp=552403943
  archive log filename=/opt/oracle/oradata/primary/archive/1_124.dbf recid=16 stamp=552478112
  Finished backup at 09-MAR-05
  
  Starting backup at 09-MAR-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=/opt/oracle/oradata/primary/system01.dbf
  input datafile fno=00002 name=/opt/oracle/oradata/primary/undotbs01.dbf
  input datafile fno=00003 name=/opt/oracle/oradata/primary/users01.dbf
  channel ORA_DISK_1: starting piece 1 at 09-MAR-05
  channel ORA_DISK_1: finished piece 1 at 09-MAR-05
  piece handle=/opt/oracle/orabak/full_PRIMARY_20050309_2 comment=NONE
  channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
  Finished backup at 09-MAR-05
  
  Starting backup at 09-MAR-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=125 recid=17 stamp=552478150
  channel ORA_DISK_1: starting piece 1 at 09-MAR-05
  channel ORA_DISK_1: finished piece 1 at 09-MAR-05
  piece handle=/opt/oracle/orabak/arch_PRIMARY_20050309_3 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=/opt/oracle/oradata/primary/archive/1_125.dbf recid=17 stamp=552478150
  Finished backup at 09-MAR-05
  
  Starting Control File and SPFILE Autobackup at 09-MAR-05
  piece handle=/opt/oracle/product/9.2.0/dbs/c-1367687269-20050309-00 comment=NONE
  Finished Control File and SPFILE Autobackup at 09-MAR-05
  
  RMAN> exit
  
  Recovery Manager complete.
  
  
共2页 首页 上一页 1 2 下一页 尾页 跳转到
相关内容
赞助商链接