`

RAC或OPS环境下重新创建控制文件 引自Metalink

阅读更多

PURPOSE
-------
This article describes how you can recreate your controlfile in RAC.


SCOPE & APPLICATION
-------------------
For DBA's requiring to recreate the controlfile.

WARNING:
--------

You should only need to recreate your control file under very special
circumstances:

- All current copies of the control file have been lost or are corrupted.

- You need to change a "hard" database parameter that was set when the        
  database was first created, such as MAXDATAFILES, MAXLOGFILES,               
  MAXLOGHISTORY, etc.

- You are restoring a backup in which the control file is corrupted or        
  missing.

- Oracle Customer Support advises you to do so.

- If you are moving your database to another machine which is
  running the same operating system but the location of the datafiles,
  logfiles is not the same.


RECREATING THE CONTROLFILE IN RAC
---------------------------------

If are recreating your controlfile from an existing one, use the following
steps to recreate your controlfiles.  If you have lost all copies of the
controlfile, a new one will need to be generated using SQL.  The syntax
is available in the SQL Reference manual for all versions but consideration
for Step 4 onward must be taken into account.

1. Connected to an open or mounted RAC instance via sqlplus, issue the
following command to dump a trace file that contains a create controlfile
script.  The file will be generated in the user_dump_dest on the local
instance (show parameter dump in server manager to find user_dump_dest):

       SQL> alter database backup controlfile to trace;  

2. Find the trace file using "ls -ltr" in the user_dump_dest, it will
probably be the last or one of the last files listed as it will be very
recent.  At this point you may want to move or rename the file to an easy
to remember name.  In my example I use the name "create_control.sql".

3. Once the file is opened, remove all of the header information
up to the "STARTUP NOMOUNT" command.  In later versions 10+ for RAC
you can remove the "NORESETLOGS" "CREATE CONTROLFILE" statement and keep
the "RESETLOGS" version. 

If your redo logs still exist in the correct locations and the create
controlfile statement contains the appropriate "alter database add logfile"
statements, skip to step 5.  If your redo logs have been removed or need to
be recreated, continue:

At this point the controlfile should look something like this:

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "RAC" NORESETLOGS  NOARCHIVELOG
    MAXLOGFILES 192
    MAXLOGMEMBERS 3
    MAXDATAFILES 1024
    MAXINSTANCES 32
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/ocfs01/rac/redo01.log'  SIZE 50M,
  GROUP 2 '/ocfs01/rac/redo02.log'  SIZE 50M,
  GROUP 3 '/ocfs01/rac/redo03.log'  SIZE 50M,
  GROUP 4 '/ocfs01/rac/redo04.log'  SIZE 50M
-- STANDBY LOGFILE
DATAFILE
  '/ocfs01/rac/system01.dbf',
  '/ocfs01/rac/undotbs01.dbf',
  '/ocfs01/rac/sysaux01.dbf',
  '/ocfs01/rac/undotbs02.dbf',
  '/ocfs01/rac/users01.dbf'
CHARACTER SET WE8ISO8859P1
RECOVER DATABASE
ALTER DATABASE OPEN;
ALTER TABLESPACE TEMP ADD TEMPFILE '/ocfs01/rac/temp01.dbf'
     SIZE 167772160  REUSE AUTOEXTEND OFF;

4. Now the create controlfile script needs to be altered for RAC.

a. Notice that in the script all of the logfiles are listed together.  We
will need to seperate these out by thread.  First remove all logfiles listed
that are not from the 1st instance.  Once these are removed, after the
create controlfile statement add an "alter database add logfile thread"
statement(s) for each thread of redo to be added (usually 1 per node).   

b. Because not all of the logfiles are listed (additional threads added
after the controlfile is created), you will need to use the RESETLOGS
option on the create controlfile statement.  This is necessary in RAC
and will reset your scn's back to 0.  It is highly recommended to take
a full backup of the database after completing this procedure.

c. We must now set the appropriate recovery commands for the RESETLOGS.
If all datafiles are consistent and no additional recover is required
on the database you can simply place the following commands at the bottom
of the script:

RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;
CANCEL
ALTER DATABASE ADD LOGFILE...
ALTER DATABASE OPEN RESETLOGS;

If additional datafile recovery is needed, you will need to gather information
from the existing controlfile (mount and query V$log and V$logfile) to get the
full path and file name for each online redo log.  You will need to manually
run the recovery (take it out of the create controlfile script) and when recovery
prompts for an archive log that does not exist you will need to type in the full
path and file name for the online log that corresponds with the sequence number
requested.  When this is finished you should get a "Media Recovery Complete"
message.  For example:

RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;
# recovery prompts for non-existant logfile arch_123.log
/u01/redo_log_dest/redo123.log
# Should now get "Media Recovery Complete" message after online logs are applied.
ALTER DATABASE OPEN RESETLOGS;
ALTER DATABASE ENABLE PUBLIC THREAD 2;
# repeat for other threads if applicable         

e. After the alter database open command, add an "alter database enable
public thread #" command(s).  Do this for each additional thread to be added.

Now the create controlfile script should look something like the following:

set echo on
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "RAC" RESETLOGS  NOARCHIVELOG
    MAXLOGFILES 192
    MAXLOGMEMBERS 3
    MAXDATAFILES 1024
    MAXINSTANCES 32
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/ocfs01/rac/redo01.log'  SIZE 50M,
  GROUP 2 '/ocfs01/rac/redo02.log'  SIZE 50M
-- STANDBY LOGFILE
DATAFILE
  '/ocfs01/rac/system01.dbf',
  '/ocfs01/rac/undotbs01.dbf',
  '/ocfs01/rac/sysaux01.dbf',
  '/ocfs01/rac/undotbs02.dbf',
  '/ocfs01/rac/users01.dbf'
CHARACTER SET WE8ISO8859P1
RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL;
CANCEL
ALTER DATABASE ADD LOGFILE THREAD 2
  GROUP 3 '/ocfs01/rac/redo03.log' SIZE 50M REUSE,
  GROUP 4 '/ocfs01/rac/redo04.log' SIZE 50M REUSE;
ALTER DATABASE OPEN RESETLOGS;
ALTER TABLESPACE TEMP ADD TEMPFILE '/ocfs01/rac/temp01.dbf'
     SIZE 167772160  REUSE AUTOEXTEND OFF;         

5. Shutdown all instances cleanly with shutdown immediate, shutdown
transactional, or shutdown normal.

6. This would be a good time to make backup copies of the current
controlfiles.

7. Verify that you are running from the instance designated for thread 1. 
This is because any logfiles designated in the create controlfile statement
will go into thread 1.  You will get errors if you are running from another
instance.  Make sure that the local init/spfile file states:

instance=1
thread=1

8. Make sure the cluster_database=false parameter is set in the init/spfile
to re-create the controlfile.

9. Now we are ready to run the script.  Connect to server manager on Node
1 and as internal or sys and execute the script:

SQL> @create_control.sql

If you get the "Statement processed" message, the database will be
opened with a brand new control file.

10. Make sure the cluster_database=true parameter is set in the init/spfile.

11. Start other instances.

12. At the earliest convenience, take a full backup of the database.

RELATED DOCUMENTS
-----------------
Note 1012929.6 - HOW TO RECREATE THE CONTROL FILE
Note 90321.1 - TFTS: Example Script to Create an OPS Database on UNIX



分享到:
评论

相关推荐

    Oracle RAC+DataGuard环境下控制文件和日志文件调整步骤

    本文详细介绍了在Oracle RAC环境中添加控制文件、修改主库redo log、编辑主库和备库hosts文件、设置force logging模式、添加standby redo log文件、配置监听文件listener.ora、tnsnames.ora文件、从RAC源库复制密码...

    Oracle Rac 集群数据文件改变目录操作

    1. **查看控制文件路径**:通过SQL查询`v$controlfile`视图或`SHOW PARAMETER control_files`命令获取当前控制文件的位置。 2. **备份控制文件**:关闭所有实例,启动一个实例到NOMOUNT状态,使用RMAN进行控制文件的...

    Oracle排错 DBCA建库诡异问题处理--rac环境不能创建rac库

    ### Oracle排错 DBCA建库诡异问题处理--rac环境不能创建rac库 #### 故障处理概述 本文主要探讨了在Oracle RAC环境中利用DBCA(Database Configuration Assistant)工具进行数据库创建时遇到的一个特殊问题——无法...

    aix下RAC环境巡检

    本文将重点讨论在AIX操作系统下进行RAC环境巡检的关键点,包括检查文件系统合理性、操作系统补丁更新以及rootvg镜像状态。 首先,我们需要关注的是AIX文件系统的合理性。在巡检过程中,应使用`df -m`命令查看所有...

    RAC环境下网卡绑定

    在Oracle Real Application Clusters (RAC)环境中,网卡绑定是一...在提供的压缩包文件中,可能包含了具体的配置示例或指导文档,帮助用户更直观地了解如何在RAC环境下设置网卡绑定。请根据文件内容进一步学习和应用。

    记录一次在Vmware ESXi6虚拟机环境下搭建oracle的RAC的过程

    Vmware ESXi6虚拟机环境下搭建Oracle RAC的过程 在本文中,我们将记录一次在Vmware ESXi6虚拟机环境下搭建Oracle RAC的过程。Oracle RAC(Real Application Clusters)是一种高可用性解决方案,能够提供高性能和高...

    RAC中创建spfile

    与传统的单实例数据库不同,在RAC中,数据库实例可能使用ASM(Automatic Storage Management)来管理数据文件、日志文件和控制文件。因此,spfile也可能存储在ASM磁盘组中。 创建spfile的过程通常遵循以下步骤: 1...

    RAC 安装维护的 Metalink 必读

    对于RAC的安装与维护,Oracle官方的Metalink(现称My Oracle Support)提供了丰富的文档和技术支持,是进行RAC相关操作时不可或缺的资源。 ### 1. Patch Set Updates for Oracle Products (ID 854428.1) 这个文档...

    Oracle 11GR2 RAC-RAC DG 环境部署手册

    Oracle 11GR2 RAC (Real Application Clusters) 和 RAC-DG (Data Guard) 环境的部署是一项复杂而关键的任务,涉及到多个层面的技术集成和配置。以下是根据提供的信息,对整个部署过程的详细说明: 1. **Oracle RAC ...

    Oracle_Rac环境Rman备份与恢复

    本文将详细介绍 RAC 环境中的 RMAN 备份与恢复,包括备份、恢复的区别、ASM 环境下的备份、恢复、裸设备上的备份、恢复等。 一、RAC 环境中的备份与恢复 在 RAC 环境中,备份和恢复的操作需要考虑到 RAC 环境的...

    AIX7.1 ORACLE 11G RAC生产环境搭建(含打补丁)

    根据提供的文件内容,这是一份关于在AIX7.1操作系统下安装Oracle 11g RAC(Real Application Clusters)数据库,并包含补丁安装过程的详细指南。以下是从标题、描述、标签以及部分内容中提炼的知识点: ### Oracle ...

    Oracle RAC数据库环境安装配置手册 For RHEL

    Oracle RAC数据库环境安装配置手册 For RHEL Oracle RAC(Real Application Clusters)是一种高可用性的数据库解决方案,能提供高性能和高可用性数据库服务。 Oracle RAC环境的安装配置是整个解决方案的关键步骤,...

    Oracle RAC增加ASM盘,创建表空间

    ASM 盘是 Oracle RAC 中的一个关键组件,用于存储数据库的数据文件、日志文件和控制文件等。 在本文中,我们将介绍如何在 Oracle RAC 中增加 ASM 盘,并创建表空间。实验环境为虚拟机软件 Oracle VirtualBox 4.3.8...

    Oracle RAC部署环境准备手册之一:系统与工具安装

    在部署Oracle RAC环境时,操作系统的选择和配置是至关重要的第一步。以下将详细阐述Oracle RAC操作系统安装及部署的关键步骤。 1. **操作系统选择** Oracle RAC支持多种操作系统,如Red Hat Enterprise Linux ...

    oracle 11g rac搭建(VMware环境)

    配置ASM实例时,需要指定存储盘组、控制文件位置等参数。同时,还需要创建并配置OCR和Voting Disk。 **2.5 安装Oracle数据库软件** 在安装Oracle数据库软件时,需要指定数据库实例的名称、监听器端口等关键参数。...

    RAC概述及环境规划

    4. **资源池化**:所有节点共享同一个数据文件和控制文件,实现了资源的有效利用。 #### 二、单实例数据库与RAC集群数据库对比 **单实例数据库:** - **优势**:简单易用,管理成本低。 - **劣势**:难以满足高...

    Oracle RAC 文件系统丢失重新安装操作系统情况下集群环境修复

    在本篇文档中,我们将探讨如何在Oracle RAC环境下,当其中一个节点的操作系统重新安装或文件系统损坏时,如何修复集群环境。这个问题涉及到的关键技术点包括Oracle RAC、操作系统恢复、集群资源管理以及数据库实例的...

    阿里云ECS环境下CentOS-linux 7.6系统Oracle 19C RAC双节点集群安装部署-优化-维护手册.pdf

    接下来是数据库实例的创建,包括设置数据库参数,创建控制文件,初始化参数文件(SPFILE)。在部署过程中,还要注意权限设置,如Oracle用户和组的权限,以及文件系统的权限。安装完成后,需要进行性能调优,包括SQL...

Global site tag (gtag.js) - Google Analytics