ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 重建控制文件

重建控制文件

原创 Linux操作系统 作者:tolywang 时间:2009-03-31 11:08:02 0 删除 编辑

以下是通过 SQL > alter database backup controlfile to trace  ;   然后在udump下找到的trc文件 。

/u01/product/admin/intel/udump/intel3_ora_21858.trc
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
ORACLE_HOME = /u01/product/oracle
System name: Linux
Node name: dmdii-node3
Release: 2.4.21-4.ELsmp
Version: #1 SMP Fri Oct 3 17:52:56 EDT 2003
Machine: i686
Instance name: intel3
Redo thread mounted by this instance: 1
Oracle process number: 12
Unix process pid: 21858, image: oracle@dmdii-node3 (TNS V1-V3)

*** SESSION ID:(9.4422) 2009-03-31 11:04:51.658http://space.itpub.net/spacecp.php?docp=me&action=spaceblogs&op=add&openwindow=1
*** 2009-03-31 11:04:51.658
# The following are current System-scope REDO Log Archival related       ####     REDO LOG归档相关参数
# parameters and can be included in the database initialization file.
#
# LOG_ARCHIVE_DEST=''
# LOG_ARCHIVE_DUPLEX_DEST=''
#
# LOG_ARCHIVE_FORMAT=%t_%s.dbf
# REMOTE_ARCHIVE_ENABLE=TRUE
# LOG_ARCHIVE_START=TRUE
# LOG_ARCHIVE_MAX_PROCESSES=2
# STANDBY_FILE_MANAGEMENT=MANUAL
# STANDBY_ARCHIVE_DEST=?/dbs/arch
# FAL_CLIENT=''
# FAL_SERVER=''
#
# LOG_ARCHIVE_DEST_1='LOCATION=/u01/product/oradata/intel/archive'
# LOG_ARCHIVE_DEST_1='OPTIONAL REOPEN=300 NODELAY'
# LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM SYNC'
# LOG_ARCHIVE_DEST_1='REGISTER 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.          

#  需要重建控制文件的话, 如果online redo 是可用的, 那么可以使用NORESETLOGS 创建新控制文件然后打开DB .

#   如果online redo 是不可用的, 那么需要使用RESETLOGS 创建新控制文件然后打开DB,  log被重置, 如果有standby 

#   ,那么Standby 必须重建 。  注意:  RMAN的设置将回到默认值


#
#     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.  

#   下面的命令用来创建一个新的控制文件来开启数据库。 用于RMAN的数据将会丢失。对于offline datafiles 可

#   能需要额外的log 用来做介质恢复, 当当前版本的所有online redo log 都没有问题的情况下使用noresetlogs 。


STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "INTEL" NORESETLOGS  ARCHIVELOG
--  SET STANDBY TO MAXIMIZE PERFORMANCE
    MAXLOGFILES 10
    MAXLOGMEMBERS 3
    MAXDATAFILES 4096
    MAXINSTANCES 1
    MAXLOGHISTORY 226
LOGFILE
  GROUP 1 '/u01/product/oradata/intel/redo01.log'  SIZE 10M,
  GROUP 2 '/u01/product/oradata/intel/redo02.log'  SIZE 10M,
  GROUP 3 '/u01/product/oradata/intel/redo03.log'  SIZE 10M
-- STANDBY LOGFILE
DATAFILE
  '/u01/product/oradata/intel/system01.dbf',
  '/u01/product/oradata/intel/undotbs01.dbf',
  '/u01/product/oradata/intel/drsys01.dbf',
  '/u01/product/oradata/intel/indx01.dbf',
  '/u01/product/oradata/intel/tools01.dbf',
  '/u01/product/oradata/intel/users01.dbf',
  '/u01/product/oradata/intel/xdb01.dbf'
CHARACTER SET AL32UTF8
;
# 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;
# Commands to add tempfiles to temporary tablespaces.
# Online tempfiles have complete space information.
# Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/product/oradata/intel/temp01.dbf'
     SIZE 41943040  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;

# End of tempfile additions.
#

 

##    下面的 RESETLOGS 重建语句,  online redo log 中的内容都会丢失,所有的备份将无效 

##    仅仅在online log 损坏的情况下使用 resetlogs 创建控制文件开启DB 。  resetlog创建控制文件后的开启

##     步骤与noresetlog 有一些不一样,注意 。 


#     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.
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "INTEL" RESETLOGS  ARCHIVELOG
--  SET STANDBY TO MAXIMIZE PERFORMANCE
    MAXLOGFILES 10
    MAXLOGMEMBERS 3
    MAXDATAFILES 4096
    MAXINSTANCES 1
    MAXLOGHISTORY 226
LOGFILE
  GROUP 1 '/u01/product/oradata/intel/redo01.log'  SIZE 10M,
  GROUP 2 '/u01/product/oradata/intel/redo02.log'  SIZE 10M,
  GROUP 3 '/u01/product/oradata/intel/redo03.log'  SIZE 10M
-- STANDBY LOGFILE
DATAFILE
  '/u01/product/oradata/intel/system01.dbf',
  '/u01/product/oradata/intel/undotbs01.dbf',
  '/u01/product/oradata/intel/drsys01.dbf',
  '/u01/product/oradata/intel/indx01.dbf',
  '/u01/product/oradata/intel/tools01.dbf',
  '/u01/product/oradata/intel/users01.dbf',
  '/u01/product/oradata/intel/xdb01.dbf'
CHARACTER SET AL32UTF8
;
# 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;
# Commands to add tempfiles to temporary tablespaces.
# Online tempfiles have complete space information.
# Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/product/oradata/intel/temp01.dbf'
     SIZE 41943040  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;

# End of tempfile additions.
#

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/35489/viewspace-582325/,如需转载,请注明出处,否则将追究法律责任。

上一篇: linux 命令 - lsmod
请登录后发表评论 登录
全部评论
Oracle , MySQL, SAP IQ, SAP HANA, PostgreSQL, Tableau 技术讨论,希望在这里一起分享知识,讨论技术,畅谈人生 。

注册时间:2007-12-10

  • 博文量
    5595
  • 访问量
    13301815