How to Recreate a Controlfile (文档 ID 735106.1)

本文档详细介绍了在不同情况下如何重建Oracle数据库的控制文件,包括从现有数据库创建控制文件的方法及注意事项,适用于Oracle Enterprise Edition 9.0.1.0及后续版本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

In this Document

 Goal
 Solution

Applies to:

Oracle Database - Enterprise Edition - Version 9.0.1.0 and later
Information in this document applies to any platform.



Goal

This article describes how you can recreate your controlfile.

Solution

Warning

You should only recreate your control file under the following circumstances:

  • All current copies of the control file have been lost or are corrupted.
  • You are restoring a backup in which the control file is corrupted or missing.
  • You need to change a hard limit database parameter in the controlfile.
  • If you are moving your database to another server and files are located in a different location.
  • Oracle Customer Support advises you to.

Creating a new Controlfile from an existing database that is mounted or open. 

First you must generate an ascii dump of the controlfile.

Whilst the database is mounted or open issue:

SQL> alter database backup controlfile to trace;

A trace file will be generated in the user_dump_destination directory.

SQL> show parameter user_dump_dest

NAME            TYPE         VALUE
--------------  ------       ------------------------------------------------
user_dump_dest  string       /oracle/product/11.1.0/db_1/diag/rdbms/V11/trace

After navigating to the directory locate the latest trace file by date/time by issuing:   ls -ltr.

% cd /oracle/product/11.1.0/db_1/diag/rdbms/V11/trace
% ls -ltr

Once you locate the file it will appear as an ordinary trace file:

Trace file /oracle/product/11.1.0/db_1/diag/rdbms/V11/trace/V11_ora_31225.trc
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /oracle/product/11.1.0/db_1
You are interested in the section that contains the create controlfile script.
Modify the trace file and use it as a script to create the control. 
 
CREATE CONTROLFILE REUSE DATABASE "V11" NORESETLOGS ARCHIVELOG 
MAXLOGFILES 16 
MAXLOGMEMBERS 3 
MAXDATAFILES 100 
MAXINSTANCES 8 
MAXLOGHISTORY 292 
LOGFILE 
GROUP 1 '/oradata/V11/redo01.log' SIZE 50M, 
GROUP 2 '/oradata/V11/redo02.log' SIZE 50M, 
GROUP 3 '/oradata/V11/redo03.log' SIZE 50M 
DATAFILE 
'/oradata/V11/system01.dbf', 
'/oradata/V11/sysaux01.dbf', 
'/oradata/V11/undotbs01.dbf',
'/oradata/V11/user01.dbf' 
CHARACTER SET WE8MSWIN1252 
;
ALTER TABLESPACE TEMP_TEST ADD TEMPFILE '˜/oradata/V11/temp01.dbf'™ reuse;
  
It is important to delete everything above the "CREATE CONTROLFILE" and 
everything after the CHARACTER SET. Ensure you leave the semi colon. ";".
In the above example we are choosing the NORESETLOGS option and running the 
database in archivelog mode. After successfully saving the script you are now 
able to recreate the controlfile. When shutting down the database ensure that 
you shutdown with the immediate option.
 
SQL> shutdown immediate;
 SQL> startup nomount;
 SQL>@control.sql
 
Note: After recreating the controlfile ensure you add the existing TEMP files:
Example:
alter tablespace temp_ts add tempfile '˜/oradata/V11/temp01.dbf'™ reuse;
Once the controlfile is successfully created the database is automatically 
mounted. If you have opened the database with a resetlogs it is important to 
take a backup asap.

Creating a new controlfile from a database that is not able to mount.

Under the rare occasion that you do not have a controlfile to either:

1. Restore

2. or have a script from a "backup controlfile to trace script"

you must create a script from the beginning.

CREATE CONTROLFILE REUSE DATABASE "DBNAME" NORESETLOGS ARCHIVELOG

Follow the format listing:

- Location of redo logs.

- Location of datafiles

- Specifying the characterset.

Once you have listed all files correctly you are ready to recreate your controlfile

SQL> startup nomount; 

SQL>@control.sql
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值