重建控制文件

1:准备工作

Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:/Documents and Settings/Administrator>set oracle_sid=ora

C:/Documents and Settings/Administrator>rman target /

恢复管理器: 版本9.2.0.1.0 - Production

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

连接到目标数据库: ORA (DBID=1279057176)

RMAN> backup database;

启动 backup 于 09-6月 -09
正在使用目标数据库控制文件替代恢复目录
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=15 devtype=DISK
通道 ORA_DISK_1: 正在启动 full 数据文件备份集
通道 ORA_DISK_1: 正在指定备份集中的数据文件
在备份集中包含当前的 SPFILE
备份集中包括当前控制文件
输入数据文件 fno=00001 name=E:/ORACLE/ORADATA/ORA/SYSTEM01.DBF
输入数据文件 fno=00005 name=E:/ORACLE/ORADATA/ORA/EXAMPLE01.DBF
输入数据文件 fno=00010 name=E:/ORACLE/ORADATA/ORA/XDB01.DBF
输入数据文件 fno=00006 name=E:/ORACLE/ORADATA/ORA/INDX01.DBF
输入数据文件 fno=00009 name=E:/ORACLE/ORADATA/ORA/USERS01.DBF
输入数据文件 fno=00012 name=E:/ORACLE/ORADATA/ORA/USERS02.ORA
输入数据文件 fno=00013 name=E:/ORACLE/ORADATA/ORA/USER03.ORA
输入数据文件 fno=00003 name=E:/ORACLE/ORADATA/ORA/CWMLITE01.DBF
输入数据文件 fno=00004 name=E:/ORACLE/ORADATA/ORA/DRSYS01.DBF
输入数据文件 fno=00007 name=E:/ORACLE/ORADATA/ORA/ODM01.DBF
输入数据文件 fno=00002 name=E:/ORACLE/ORADATA/ORA/UNDOTBS01.DBF
输入数据文件 fno=00008 name=E:/ORACLE/ORADATA/ORA/TOOLS01.DBF
输入数据文件 fno=00011 name=E:/ORACLE/ORADATA/ORA/EWNS.ORA
输入数据文件 fno=00014 name=E:/ORACLE/ORADATA/ORA/USER04.ORA
输入数据文件 fno=00015 name=E:/ORACLE/ORADATA/ORA/USER05.ORA
输入数据文件 fno=00016 name=E:/ORACLE/ORADATA/ORA/USER06.ORA
通道 ORA_DISK_1: 正在启动段 1 于 09-6月 -09
通道 ORA_DISK_1: 已完成段 1 于 09-6月 -09
段 handle=E:/ORACLE/ORA92/DATABASE/01KH5DAT_1_1 comment=NONE
通道 ORA_DISK_1: 备份集已完成, 经过时间:00:01:07
完成 backup 于 09-6月 -09

RMAN> list archivelog all;


已存档的日志副本列表
关键字     Thrd Seq     S 短时间     名称
------- ---- ------- - ---------- ----
1       1    13      A 09-6月 -09 E:/ORACLE/ORA92/RDBMS/ARC00013.001
2       1    14      A 09-6月 -09 E:/ORACLE/ORA92/RDBMS/ARC00014.001
3       1    15      A 09-6月 -09 E:/ORACLE/ORA92/RDBMS/ARC00015.001

RMAN> backup archivelog all delete input;

启动 backup 于 09-6月 -09
当前日志已存档
使用通道 ORA_DISK_1
通道 ORA_DISK_1: 正在启动存档日志备份集
通道 ORA_DISK_1: 正在指定备份集中的存档日志
输入存档日志线程 =1 序列 =13 记录 ID=1 时间戳=689081676
输入存档日志线程 =1 序列 =14 记录 ID=2 时间戳=689081676
输入存档日志线程 =1 序列 =15 记录 ID=3 时间戳=689081682
输入存档日志线程 =1 序列 =16 记录 ID=4 时间戳=689092121
通道 ORA_DISK_1: 正在启动段 1 于 09-6月 -09
通道 ORA_DISK_1: 已完成段 1 于 09-6月 -09
段 handle=E:/ORACLE/ORA92/DATABASE/02KH5DGP_1_1 comment=NONE
通道 ORA_DISK_1: 备份集已完成, 经过时间:00:00:04
通道 ORA_DISK_1: 正在删除存档日志
存档日志文件名 =E:/ORACLE/ORA92/RDBMS/ARC00013.001 记录 ID=1 时间戳 =689081676
存档日志文件名 =E:/ORACLE/ORA92/RDBMS/ARC00014.001 记录 ID=2 时间戳 =689081676
存档日志文件名 =E:/ORACLE/ORA92/RDBMS/ARC00015.001 记录 ID=3 时间戳 =689081682
存档日志文件名 =E:/ORACLE/ORA92/RDBMS/ARC00016.001 记录 ID=4 时间戳 =689092121
完成 backup 于 09-6月 -09

 

Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:/Documents and Settings/Administrator>set oracle_sid=ora

C:/Documents and Settings/Administrator>sqlplus /nolog

SQL*Plus: Release 9.2.0.1.0 - Production on 星期二 6月 9 14:29:21 2009

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

SQL> conn / as sysdba
已连接。
SQL> alter system switch logfile;

系统已更改。

SQL> alter system switch logfile;

系统已更改。

SQL> alter system switch logfile;

系统已更改。

SQL>

 

 

RMAN> list archivelog all;


已存档的日志副本列表
关键字     Thrd Seq     S 短时间     名称
------- ---- ------- - ---------- ----
5       1    17      A 09-6月 -09 E:/ORACLE/ORA92/RDBMS/ARC00017.001
6       1    18      A 09-6月 -09 E:/ORACLE/ORA92/RDBMS/ARC00018.001
7       1    19      A 09-6月 -09 E:/ORACLE/ORA92/RDBMS/ARC00019.001

RMAN> backup archivelog all delete input;

启动 backup 于 09-6月 -09
当前日志已存档
使用通道 ORA_DISK_1
通道 ORA_DISK_1: 正在启动存档日志备份集
通道 ORA_DISK_1: 正在指定备份集中的存档日志
输入存档日志线程 =1 序列 =17 记录 ID=5 时间戳=689092172
输入存档日志线程 =1 序列 =18 记录 ID=6 时间戳=689092174
输入存档日志线程 =1 序列 =19 记录 ID=7 时间戳=689092176
输入存档日志线程 =1 序列 =20 记录 ID=8 时间戳=689092201
通道 ORA_DISK_1: 正在启动段 1 于 09-6月 -09
通道 ORA_DISK_1: 已完成段 1 于 09-6月 -09
段 handle=E:/ORACLE/ORA92/DATABASE/03KH5DJA_1_1 comment=NONE
通道 ORA_DISK_1: 备份集已完成, 经过时间:00:00:02
通道 ORA_DISK_1: 正在删除存档日志
存档日志文件名 =E:/ORACLE/ORA92/RDBMS/ARC00017.001 记录 ID=5 时间戳 =689092172
存档日志文件名 =E:/ORACLE/ORA92/RDBMS/ARC00018.001 记录 ID=6 时间戳 =689092174
存档日志文件名 =E:/ORACLE/ORA92/RDBMS/ARC00019.001 记录 ID=7 时间戳 =689092176
存档日志文件名 =E:/ORACLE/ORA92/RDBMS/ARC00020.001 记录 ID=8 时间戳 =689092201
完成 backup 于 09-6月 -09

RMAN> list backup summary;


备份列表
===============
关键字     TY LV S 设备类型 完成时间   段数 副本数 标记
------- -- -- - ----------- ---------- ------- ------- ---
1       B  F  A DISK        09-6月 -09 1       1       TAG20090609T142532
2       B  A  A DISK        09-6月 -09 1       1       TAG20090609T142841
3       B  A  A DISK        09-6月 -09 1       1       TAG20090609T143002

 

RMAN> list backup of controlfile;


备份集列表
===================

BS 关键字  类型 LV 大小       设备类型 经过时间 完成时间
------- ---- -- ---------- ----------- ------------ ----------
1       Full    2M         DISK        00:01:05     09-6月 -09
BP 关键字: 1   状态: AVAILABLE   标记:TAG20090609T142532
段名:E:/ORACLE/ORA92/DATABASE/01KH5DAT_1_1
  控制文件包括: Ckp SCN: 5371967      Ckp 时间:09-6月 -09

RMAN> list backup;


备份集列表
===================

BS 关键字  类型 LV 大小       设备类型 经过时间 完成时间
------- ---- -- ---------- ----------- ------------ ----------
1       Full    513M       DISK        00:01:05     09-6月 -09
BP 关键字: 1   状态: AVAILABLE   标记:TAG20090609T142532
段名:E:/ORACLE/ORA92/DATABASE/01KH5DAT_1_1
  包含的 SPFILE: 修改时间: 19-2月 -09
  备份集 1 中的数据文件列表
  文件 LV 类型 Ckp SCN    Ckp 时间   名称
  ---- -- ---- ---------- ---------- ----
  1       Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/SYSTEM01.DBF
  2       Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/UNDOTBS01.DBF
  3       Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/CWMLITE01.DBF
  4       Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/DRSYS01.DBF
  5       Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/EXAMPLE01.DBF
  6       Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/INDX01.DBF
  7       Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/ODM01.DBF
  8       Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/TOOLS01.DBF
  9       Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/USERS01.DBF
  10      Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/XDB01.DBF
  11      Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/EWNS.ORA
  12      Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/USERS02.ORA
  13      Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/USER03.ORA
  14      Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/USER04.ORA
  15      Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/USER05.ORA
  16      Full 5371969    09-6月 -09 E:/ORACLE/ORADATA/ORA/USER06.ORA

BS 关键字  大小       设备类型占用时间 完成时间
------- ---------- ----------- ------------ ----------
2       11M        DISK        00:00:02     09-6月 -09
BP 关键字: 2   状态: AVAILABLE   标记:TAG20090609T142841
段名:E:/ORACLE/ORA92/DATABASE/02KH5DGP_1_1

  备份集 2 中的已存档日志列表
  Thrd Seq     低 SCN    短时间     下一个 SCN   下一次
  ---- ------- ---------- ---------- ---------- ---------
  1    13      5338925    09-6月 -09 5338933    09-6月 -09
  1    14      5338933    09-6月 -09 5339967    09-6月 -09
  1    15      5339967    09-6月 -09 5341451    09-6月 -09
  1    16      5341451    09-6月 -09 5372573    09-6月 -09

BS 关键字  大小       设备类型占用时间 完成时间
------- ---------- ----------- ------------ ----------
3       109K       DISK        00:00:01     09-6月 -09
BP 关键字: 3   状态: AVAILABLE   标记:TAG20090609T143002
段名:E:/ORACLE/ORA92/DATABASE/03KH5DJA_1_1

  备份集 3 中的已存档日志列表
  Thrd Seq     低 SCN    短时间     下一个 SCN   下一次
  ---- ------- ---------- ---------- ---------- ---------
  1    17      5372573    09-6月 -09 5372771    09-6月 -09
  1    18      5372771    09-6月 -09 5372774    09-6月 -09
  1    19      5372774    09-6月 -09 5372776    09-6月 -09
  1    20      5372776    09-6月 -09 5372886    09-6月 -09

RMAN> show all;

RMAN 配置参数为:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'E:/ORACLE/ORA92/DATABASE/SNCFORA.ORA'; #
 default

RMAN>

 

 

SQL> shutdown immediate;
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup nomount;
ORACLE 例程已经启动。

Total System Global Area  135338868 bytes
Fixed Size                   453492 bytes
Variable Size             109051904 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
SQL>

 

C:/Documents and Settings/Administrator>set oracle_sid=ora

C:/Documents and Settings/Administrator>rman target /

恢复管理器: 版本9.2.0.1.0 - Production

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

连接到目标数据库: ora(未安装)

RMAN> restore controlfile from 'E:/ORACLE/ORA92/DATABASE/01KH5DAT_1_1
2> ';

启动 restore 于 09-6月 -09

正在使用目标数据库控制文件替代恢复目录
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=14 devtype=DISK
通道 ORA_DISK_1: 正在恢复控制文件
通道 ORA_DISK_1: 恢复完成
正在复制控制文件
输出文件名=E:/ORACLE/ORADATA/ORA/CONTROL01.CTL
输出文件名=E:/ORACLE/ORADATA/ORA/CONTROL02.CTL
输出文件名=E:/ORACLE/ORADATA/ORA/CONTROL03.CTL
完成 restore 于 09-6月 -09

RMAN> alter database mount;

数据库已加载

RMAN> exit


恢复管理器完成。

C:/Documents and Settings/Administrator>rman target /

恢复管理器: 版本9.2.0.1.0 - Production

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

连接到目标数据库: ORA (DBID=1279057176)

RMAN> list backup;

正在使用目标数据库控制文件替代恢复目录

RMAN> restore database from tag=TAG20090609T142532
2> ;

启动 restore 于 09-6月 -09

分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=12 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 06/09/2009 14:40:20
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 16 found to restore
RMAN-06023: no backup or copy of datafile 15 found to restore
RMAN-06023: no backup or copy of datafile 14 found to restore
RMAN-06023: no backup or copy of datafile 13 found to restore
RMAN-06023: no backup or copy of datafile 12 found to restore
RMAN-06023: no backup or copy of datafile 11 found to restore
RMAN-06023: no backup or copy of datafile 10 found to restore
RMAN-06023: no backup or copy of datafile 9 found to restore
RMAN-06023: no backup or copy of datafile 8 found to restore
RMAN-06023: no backup or copy of datafile 7 found to restore
RMAN-06023: no backup or copy of datafile 6 found to restore
RMAN-06023: no backup or copy of datafile 5 found to restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore

 

我们是nocatlog模式下的,如果是catalog数据库 可以使用catalog backuppiece filename将备份集写入目录数据库。

 

此时我们的数据库文件是最新的 控制文件比较老(删除控制文件一样) 此时我们可以重建数据文件

 

 

SQL> shutdown immediate;
ORA-01109: ??????


已经卸载数据库。
ORACLE 例程已经关闭。

 

SQL> startup nomount;
ORACLE 例程已经启动。

Total System Global Area  135338868 bytes
Fixed Size                   453492 bytes
Variable Size             109051904 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
SQL> alter database backup controlfile to trace;
alter database backup controlfile to trace
*
ERROR 位于第 1 行:
ORA-01507: ??????


SQL> alter database mount;

数据库已更改。

SQL> alter database backup controlfile to trace;

数据库已更改。

SQL>

 

 

找到E:/oracle/admin/ora/udump 最新的一个trc文件 文件内容如下

 

Dump file e:/oracle/admin/ora/udump/ora_ora_4612.trc
Thu Feb 19 13:36:51 2009
ORACLE V9.2.0.1.0 - Production vsnsta=0
vsnsql=12 vsnxtr=3
Windows 2000 Version 5.1 Service Pack 2, CPU type 586
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Windows 2000 Version 5.1 Service Pack 2, CPU type 586
Instance name: ora

Redo thread mounted by this instance: 0 <none>

Oracle process number: 16

Windows thread id: 4612, image: ORACLE.EXE


*** SESSION ID:(13.18) 2009-02-19 13:36:51.000
Archiving is disabled
Archiving is disabled
Dump file e:/oracle/admin/ora/udump/ora_ora_4612.trc
Tue Jun 09 14:46:00 2009
ORACLE V9.2.0.1.0 - Production vsnsta=0
vsnsql=12 vsnxtr=3
Windows 2000 Version 5.1 Service Pack 2, CPU type 586
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
Windows 2000 Version 5.1 Service Pack 2, CPU type 586
Instance name: ora

Redo thread mounted by this instance: 0 <none>

Oracle process number: 14

Windows thread id: 4612, image: ORACLE.EXE


*** 2009-06-09 14:46:00.000
*** SESSION ID:(11.1) 2009-06-09 14:46:00.000
 (blkno = 0x8a, size = 276, max = 1, in-use = 1, last-recid= 0)
 (blkno = 0x8b, size = 56, max = 145, in-use = 1, last-recid= 1)
*** 2009-06-09 14:46:01.000
# The following are current System-scope REDO Log Archival related
# parameters and can be included in the database initialization file.
#
# LOG_ARCHIVE_DEST=''
# LOG_ARCHIVE_DUPLEX_DEST=''
#
# LOG_ARCHIVE_FORMAT=ARC%S.%T
# REMOTE_ARCHIVE_ENABLE=TRUE
# LOG_ARCHIVE_START=TRUE
# LOG_ARCHIVE_MAX_PROCESSES=2
# STANDBY_FILE_MANAGEMENT=MANUAL
# STANDBY_ARCHIVE_DEST=%ORACLE_HOME%/RDBMS
# FAL_CLIENT=''
# FAL_SERVER=''
#
# LOG_ARCHIVE_DEST_1='LOCATION=E:/oracle/ora92/RDBMS'
# LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
# LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM SYNC'
# LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'
# LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED'
# LOG_ARCHIVE_DEST_STATE_1=ENABLE
#
# Below are two sets of SQL statements, each of which creates a new
# control file and uses it to open the database. The first set opens
# the database with the NORESETLOGS option and should be used only if
# the current versions of all online logs are available. The second
# set opens the database with the RESETLOGS option and should be used
# if online logs are unavailable.
# The appropriate set of statements can be copied from the trace into
# a script file, edited as necessary, and executed when there is a
# need to re-create the control file.
#
#     Set #1. NORESETLOGS case
#
# The following commands will create a new control file and use it
# to open the database.
# Data used by the recovery manager will be lost. Additional logs may
# be required for media recovery of offline data files. Use this
# only if the current version of all online logs are available.
# WARNING! The current control file needs to be checked against
# the datafiles to insure it contains the correct files. The
# commands printed here may be missing log and/or data files.
# Another report should be made after the database has been
# successfully opened.
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORA" NORESETLOGS  ARCHIVELOG
--  SET STANDBY TO MAXIMIZE PERFORMANCE
    MAXLOGFILES 50
    MAXLOGMEMBERS 5
    MAXDATAFILES 100
    MAXINSTANCES 1
    MAXLOGHISTORY 226
LOGFILE
  GROUP 1 'E:/ORACLE/ORADATA/ORA/REDO01.LOG'  SIZE 100M,
  GROUP 2 'E:/ORACLE/ORADATA/ORA/REDO02.LOG'  SIZE 100M,
  GROUP 3 'E:/ORACLE/ORADATA/ORA/REDO03.LOG'  SIZE 100M
-- STANDBY LOGFILE
DATAFILE
  'E:/ORACLE/ORADATA/ORA/SYSTEM01.DBF',
  'E:/ORACLE/ORADATA/ORA/UNDOTBS01.DBF',
  'E:/ORACLE/ORADATA/ORA/CWMLITE01.DBF',
  'E:/ORACLE/ORADATA/ORA/DRSYS01.DBF',
  'E:/ORACLE/ORADATA/ORA/EXAMPLE01.DBF',
  'E:/ORACLE/ORADATA/ORA/INDX01.DBF',
  'E:/ORACLE/ORADATA/ORA/ODM01.DBF',
  'E:/ORACLE/ORADATA/ORA/TOOLS01.DBF',
  'E:/ORACLE/ORADATA/ORA/USERS01.DBF',
  'E:/ORACLE/ORADATA/ORA/XDB01.DBF',
  'E:/ORACLE/ORADATA/ORA/EWNS.ORA',
  'E:/ORACLE/ORADATA/ORA/USERS02.ORA',
  'E:/ORACLE/ORADATA/ORA/USER03.ORA',
  'E:/ORACLE/ORADATA/ORA/USER04.ORA',
  'E:/ORACLE/ORADATA/ORA/USER05.ORA',
  'E:/ORACLE/ORADATA/ORA/USER06.ORA'
CHARACTER SET ZHS16GBK
;
# Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','OFF');
# Configure RMAN configuration record 2
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','DISK PARALLELISM 1');
# Recovery is required if any of the datafiles are restored backups,
# or if the last shutdown was not normal or immediate.
RECOVER DATABASE
# All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
# Database can now be opened normally.
ALTER DATABASE OPEN;
# No tempfile entries found to add.
#
#     Set #2. RESETLOGS case
#
# The following commands will create a new control file and use it
# to open the database.
# The contents of online logs will be lost and all backups will
# be invalidated. Use this only if online logs are damaged.
# WARNING! The current control file needs to be checked against
# the datafiles to insure it contains the correct files. The
# commands printed here may be missing log and/or data files.
# Another report should be made after the database has been
# successfully opened.
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORA" RESETLOGS  ARCHIVELOG
--  SET STANDBY TO MAXIMIZE PERFORMANCE
    MAXLOGFILES 50
    MAXLOGMEMBERS 5
    MAXDATAFILES 100
    MAXINSTANCES 1
    MAXLOGHISTORY 226
LOGFILE
  GROUP 1 'E:/ORACLE/ORADATA/ORA/REDO01.LOG'  SIZE 100M,
  GROUP 2 'E:/ORACLE/ORADATA/ORA/REDO02.LOG'  SIZE 100M,
  GROUP 3 'E:/ORACLE/ORADATA/ORA/REDO03.LOG'  SIZE 100M
-- STANDBY LOGFILE
DATAFILE
  'E:/ORACLE/ORADATA/ORA/SYSTEM01.DBF',
  'E:/ORACLE/ORADATA/ORA/UNDOTBS01.DBF',
  'E:/ORACLE/ORADATA/ORA/CWMLITE01.DBF',
  'E:/ORACLE/ORADATA/ORA/DRSYS01.DBF',
  'E:/ORACLE/ORADATA/ORA/EXAMPLE01.DBF',
  'E:/ORACLE/ORADATA/ORA/INDX01.DBF',
  'E:/ORACLE/ORADATA/ORA/ODM01.DBF',
  'E:/ORACLE/ORADATA/ORA/TOOLS01.DBF',
  'E:/ORACLE/ORADATA/ORA/USERS01.DBF',
  'E:/ORACLE/ORADATA/ORA/XDB01.DBF',
  'E:/ORACLE/ORADATA/ORA/EWNS.ORA',
  'E:/ORACLE/ORADATA/ORA/USERS02.ORA',
  'E:/ORACLE/ORADATA/ORA/USER03.ORA',
  'E:/ORACLE/ORADATA/ORA/USER04.ORA',
  'E:/ORACLE/ORADATA/ORA/USER05.ORA',
  'E:/ORACLE/ORADATA/ORA/USER06.ORA'
CHARACTER SET ZHS16GBK
;
# Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','OFF');
# Configure RMAN configuration record 2
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','DISK PARALLELISM 1');
# Recovery is required if any of the datafiles are restored backups,
# or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
# Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
# No tempfile entries found to add.
#

 

根据数据库不同状况,你可以选择是使用RESETLOGS/NORESETLOGS来重建控制文件.

 

我们获得如下脚本

 

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORA" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 50
    MAXLOGMEMBERS 5
    MAXDATAFILES 100
    MAXINSTANCES 1
    MAXLOGHISTORY 226
LOGFILE
  GROUP 1 'E:/ORACLE/ORADATA/ORA/REDO01.LOG'  SIZE 100M,
  GROUP 2 'E:/ORACLE/ORADATA/ORA/REDO02.LOG'  SIZE 100M,
  GROUP 3 'E:/ORACLE/ORADATA/ORA/REDO03.LOG'  SIZE 100M
DATAFILE
  'E:/ORACLE/ORADATA/ORA/SYSTEM01.DBF',
  'E:/ORACLE/ORADATA/ORA/UNDOTBS01.DBF',
  'E:/ORACLE/ORADATA/ORA/CWMLITE01.DBF',
  'E:/ORACLE/ORADATA/ORA/DRSYS01.DBF',
  'E:/ORACLE/ORADATA/ORA/EXAMPLE01.DBF',
  'E:/ORACLE/ORADATA/ORA/INDX01.DBF',
  'E:/ORACLE/ORADATA/ORA/ODM01.DBF',
  'E:/ORACLE/ORADATA/ORA/TOOLS01.DBF',
  'E:/ORACLE/ORADATA/ORA/USERS01.DBF',
  'E:/ORACLE/ORADATA/ORA/XDB01.DBF',
  'E:/ORACLE/ORADATA/ORA/EWNS.ORA',
  'E:/ORACLE/ORADATA/ORA/USERS02.ORA',
  'E:/ORACLE/ORADATA/ORA/USER03.ORA',
  'E:/ORACLE/ORADATA/ORA/USER04.ORA',
  'E:/ORACLE/ORADATA/ORA/USER05.ORA',
  'E:/ORACLE/ORADATA/ORA/USER06.ORA'
CHARACTER SET ZHS16GBK
;
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP','OFF');
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','DISK PARALLELISM 1');
RECOVER DATABASE
ALTER SYSTEM ARCHIVE LOG ALL;
ALTER DATABASE OPEN;

 

运行这个脚本 open数据库

 

SQL> shutdown immediate;
ORA-01109: ??????


已经卸载数据库。
ORACLE 例程已经关闭。
SQL> STARTUP NOMOUNT
ORACLE 例程已经启动。

Total System Global Area  135338868 bytes
Fixed Size                   453492 bytes
Variable Size             109051904 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "ORA" NORESETLOGS  ARCHIVELOG
  2      MAXLOGFILES 50
  3      MAXLOGMEMBERS 5
  4      MAXDATAFILES 100
  5      MAXINSTANCES 1
  6      MAXLOGHISTORY 226
  7  LOGFILE
  8    GROUP 1 'E:/ORACLE/ORADATA/ORA/REDO01.LOG'  SIZE 100M,
  9    GROUP 2 'E:/ORACLE/ORADATA/ORA/REDO02.LOG'  SIZE 100M,
 10    GROUP 3 'E:/ORACLE/ORADATA/ORA/REDO03.LOG'  SIZE 100M
 11  DATAFILE
 12    'E:/ORACLE/ORADATA/ORA/SYSTEM01.DBF',
 13    'E:/ORACLE/ORADATA/ORA/UNDOTBS01.DBF',
 14    'E:/ORACLE/ORADATA/ORA/CWMLITE01.DBF',
 15    'E:/ORACLE/ORADATA/ORA/DRSYS01.DBF',
 16    'E:/ORACLE/ORADATA/ORA/EXAMPLE01.DBF',
 17    'E:/ORACLE/ORADATA/ORA/INDX01.DBF',
 18    'E:/ORACLE/ORADATA/ORA/ODM01.DBF',
 19    'E:/ORACLE/ORADATA/ORA/TOOLS01.DBF',
 20    'E:/ORACLE/ORADATA/ORA/USERS01.DBF',
 21    'E:/ORACLE/ORADATA/ORA/XDB01.DBF',
 22    'E:/ORACLE/ORADATA/ORA/EWNS.ORA',
 23    'E:/ORACLE/ORADATA/ORA/USERS02.ORA',
 24    'E:/ORACLE/ORADATA/ORA/USER03.ORA',
 25    'E:/ORACLE/ORADATA/ORA/USER04.ORA',
 26    'E:/ORACLE/ORADATA/ORA/USER05.ORA',
 27    'E:/ORACLE/ORADATA/ORA/USER06.ORA'
 28  CHARACTER SET ZHS16GBK
 29  ;

控制文件已创建

SQL> VARIABLE RECNO NUMBER;
SQL> EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('CONTROLFILE AUTOBACKUP
','OFF');

PL/SQL 过程已成功完成。

SQL> VARIABLE RECNO NUMBER;
SQL> EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('DEVICE TYPE','DISK PAR
ALLELISM 1');

PL/SQL 过程已成功完成。

SQL> RECOVER DATABASE
ORA-00283: ??????????
ORA-00264: ?????


SQL> ALTER SYSTEM ARCHIVE LOG ALL;

系统已更改。

SQL> ALTER DATABASE OPEN;

数据库已更改。

SQL>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值