CREATE CONTROLFILE
Caution: Oracle recommends that you perform a full backup of all files in the database before using this statement. For more information, see Oracle8i Backup and Recovery Guide.
|
Purpose
Use the CREATE
CONTROLFILE
statement to re-create a control file in one of the following cases:
- All copies of your existing control files have been lost through media failure.
- You want to change the name of the database.
- You want to change the maximum number of redo log file groups, redo log file members, archived redo log files, datafiles, or instances that can concurrently have the database mounted and open.
When you issue a CREATE
CONTROLFILE
statement, Oracle creates a new control file based on the information you specify in the statement. If you omit any clauses, Oracle uses the default values rather than the values for the previous control file. After successfully creating the control file, Oracle mounts the database in the mode specified by the initialization parameter PARALLEL_SERVER
. You then must perform media recovery before opening the database. It is recommended that you then shut down the instance and take a full backup of all files in the database.
Prerequisites
You must have the OSDBA
role enabled. The database must not be mounted by any instance.
If the REMOTE_LOGIN_PASSWORDFILE
initialization parameter is set to exclusive
, Oracle returns an error when you attempt to re-create the control file. To avoid this message, either set the parameter to shared
, or re-create your password file before re-creating the control file.
See Also: Oracle8i Reference for more information about the REMOTE_LOGIN_PASSWORDFILE parameter
|
Syntax
logfile_clause::=
datafile_clause::=
character_set_clause::=
filespec
: See filespec.
Keywords and Parameters
REUSE
Specify REUSE
to indicate that existing control files identified by the initialization parameter CONTROL_FILES
can be reused, thus ignoring and overwriting any information they may currently contain. If you omit this clause and any of these control files already exists, Oracle returns an error.
DATABASE
database
Specify the name of the database. The value of this parameter must be the existing database name established by the previous CREATE
DATABASE
statement or CREATE
CONTROLFILE
statement.
SET
DATABASE
database
Use SET
DATABASE
to change the name of the database. The name of a database can be as long as eight bytes.
logfile_clause
LOGFILE filespec |
Specify the redo log files for your database. You must list all members of all redo log file groups.
-
See Also: filespec for the syntax of filespec
|
|
GROUP integer |
Specify the logfile group number. If you specify GROUP values, Oracle verifies these values with the GROUP values when the database was last open. |
RESETLOGS |
Specify RESETLOGS if you want Oracle to ignore the contents of the files listed in the LOGFILE clause. These files do not have to exist. Each filespec in the LOGFILE clause must specify the SIZE parameter. Oracle assigns all online redo log file groups to thread 1 and enables this thread for public use by any instance. After using this clause, you must open the database using the RESETLOGS clause of the ALTER DATABASE statement. |
NORESETLOGS |
Specify NORESETLOGS if you want Oracle to use all files in the LOGFILE clause as they were when the database was last open. These files must exist and must be the current online redo log files rather than restored backups. Oracle reassigns the redo log file groups to the threads to which they were previously assigned and reenables the threads as they were previously enabled. |
datafile_clause
DATAFILE filespec |
Specify the datafiles of the database. You must list all datafiles. These files must all exist, although they may be restored backups that require media recovery. See the syntax description of filespec in filespec. |
MAXLOGFILES integer |
Specify the maximum number of online redo log file groups that can ever be created for the database. Oracle uses this value to determine how much space in the control file to allocate for the names of redo log files. The default and maximum values depend on your operating system. The value that you specify should not be less than the greatest GROUP value for any redo log file group. |
MAXLOGMEMBERS integer |
Specify the maximum number of members, or identical copies, for a redo log file group. Oracle uses this value to determine how much space in the control file to allocate for the names of redo log files. The minimum value is 1. The maximum and default values depend on your operating system. |
MAXLOGHISTORY integer |
Specify the maximum number of archived redo log file groups for automatic media recovery of the Oracle Parallel Server. Oracle uses this value to determine how much space in the control file to allocate for the names of archived redo log files. The minimum value is 0. The default value is a multiple of the MAXINSTANCES value and depends on your operating system. The maximum value is limited only by the maximum size of the control file. This parameter is useful only if you are using Oracle with the Parallel Server option in both parallel mode and archivelog mode. |
MAXDATAFILES integer |
Specify the initial sizing of the datafiles section of the control file at CREATE DATABASE or CREATE CONTROLFILE time. An attempt to add a file whose number is greater than MAXDATAFILES , but less than or equal to DB_FILES , causes the Oracle control file to expand automatically so that the datafiles section can accommodate more files. |
|
The number of datafiles accessible to your instance is also limited by the initialization parameter DB_FILES . |
MAXINSTANCES integer |
Specify the maximum number of instances that can simultaneously have the database mounted and open. This value takes precedence over the value of the initialization parameter INSTANCES . The minimum value is 1. The maximum and default values depend on your operating system. |
ARCHIVELOG |
Specify ARCHIVELOG to archive the contents of redo log files before reusing them. This clause prepares for the possibility of media recovery as well as instance or crash recovery. |
NOARCHIVELOG |
If you omit both the ARCHIVELOG clause and NOARCHIVELOG clause, Oracle chooses NOARCHIVELOG mode by default. After creating the control file, you can change between ARCHIVELOG mode and NOARCHIVELOG mode with the ALTER DATABASE statement. |
character_set_clause
If you specify a character set, Oracle reconstructs character set information in the control file. In case media recovery of the database is required, this information will be available before the database is open, so that tablespace names can be correctly interpreted during recovery. This clause is useful only if you are using a character set other than the default US7ASCII.
If you are re-creating your control file and you are using Recovery Manager for tablespace recovery, and if you specify a different character set from the one stored in the data dictionary, then tablespace recovery will not succeed. (However, at database open, the control file character set will be updated with the correct character set from the data dictionary.)
Note: You cannot modify the character set of the database with this clause.
|
Example
CREATE
CONTROLFILE
Example
This statement re-creates a control file. In this statement, database orders_2
was created with the F7DEC character set.
CREATE CONTROLFILE REUSE
DATABASE orders_2
LOGFILE GROUP 1 ('diskb:log1.log', 'diskc:log1.log') SIZE 50K,
GROUP 2 ('diskb:log2.log', 'diskc:log2.log') SIZE 50K
NORESETLOGS
DATAFILE 'diska:dbone.dat' SIZE 2M
MAXLOGFILES 5
MAXLOGHISTORY 100
MAXDATAFILES 10
MAXINSTANCES 2
ARCHIVELOG
CHARACTER SET F7DEC;