Oracle7 Server Administrator's Guide
Creating Control Files
Every Oracle7 database has a control file. A control files records the physical structure of the database and contains:
- names and locations of associated databases and online redo log files
- the timestamp of the database creation
- the current log sequence number
The control file of an Oracle7 database is created at the same time as the database. By default, at least one copy of the control file must be created during database creation. On some operating systems, Oracle7 creates multiple copies. You should create two or more copies of the control file during database creation. You might also need to create control files later, if you lose control files or want to change particular settings in the control files.
This section describes ways to create control files, and includes the following topics:
Creating Initial Control Files
You create the initial control files of an Oracle7 database by specifying one or more control filenames in the CONTROL_FILES parameter in the parameter file used during database creation. The filenames specified in CONTROL_FILES should be fully specified. Filename specification is operating system-specific.
If files with the specified names currently exist at the time of database creation, you must specify the CONTROLFILE REUSE parameter in the CREATE DATABASE command, or else an error occurs. Also, if the size of the old control file differs from that of the new one, you cannot use the REUSE option. The size of the control file changes between some release of new version of Oracle, as well as when the number of files specified in the control file changes; configuration parameters such as MAXLOGFILES, MAXLOGMEMBERS, MAXLOGHISTORY, MAXDATAFILES, and MAXINSTANCES affect control file size.
If you do not specify files for CONTROL_FILES before database creation, Oracle7 uses a default filename. The default name is also operating system-specific.
You can subsequently change the value of the CONTROL_FILES parameter to add more control files or to change the names or locations of existing control files.
See Also: For more information about specifying control files, see your operating system-specific Oracle documentation.
Creating Additional Copies of the Control File, and Renaming and Relocating Control Files
You add a new control file by copying an existing file to a new location and adding the file's name to the list of control files.
Similarly, you rename an existing control file by copying the file to its new name or location, and changing the file's name in the control file list.
In both cases, to guarantee that control files do not change during the procedure, shut down the instance before copying the control file.
To Multiplex or Move Additional Copies of the Current Control File
1. Shutdown the database.
3. Copy an existing control file to a different location, using operating system commands.
4. Edit the CONTROL_FILES parameter in the database's parameter file to add the new control file's name, or to change the existing control filename.
5. Restart Server Manager.
New Control Files
You can create a new control file for a database using the CREATE CONTROLFILE command. This is recommended in the following situations:
- All control files for the database have been permanently damaged and you do not have a control file backup.
- You want to change one of the permanent database settings originally specified in the CREATE DATABASE statement, including the database's name, MAXLOGFILES, MAXLOGMEMBERS, MAXLOGHISTORY, MAXDATAFILES, and MAXINSTANCES.
For example, you might need to change a database's name if it conflicts with another database's name in a distributed environment. As another example, you might need to change one of the previously mentioned parameters if the original setting is too low.
The following statement creates a new control file for the PROD database (formerly a database that used a different database name):
CREATE CONTROLFILE
SET DATABASE prod
LOGFILE GROUP 1 ('logfile1A', 'logfile1B') SIZE 50K,
GROUP 2 ('logfile2A', 'logfile2B') SIZE 50K
NORESETLOGS
DATAFILE 'datafile1' SIZE 3M, 'datafile2' SIZE 5M
MAXLOGFILES 50
MAXLOGMEMBERS 3
MAXDATAFILES 200
MAXINSTANCES 6
ARCHIVELOG;
Warning: The CREATE CONTROLFILE command can potentially damage specified datafiles and online redo log files; omitting a filename can cause loss of the data in that file, or loss of access to the entire database. Employ caution when using this command and be sure to follow the steps in the next section.
See Also: For more information about the CREATE CONTROLFILE command, see the .
Creating New Control Files
This section provides step-by-step instructions for creating new control files.
To Create New Control Files
1. Make a list of all datafiles and online redo log files of the database.
If you followed the recommendations for database backups, you should already have a list of datafiles and online redo log files that reflect the current structure of the database.
If you have no such lists and your control file has been damaged so that the database cannot be opened, try to locate all of the datafiles and online redo log files that constitute the database. Any files not specified in Step 5 are not recoverable once a new control file has been created. Moreover, if you omit any of the files that make up the SYSTEM tablespace, you might not be able to recover the database.
2. Shut down the database.
If the database is open, shut down the database with normal priority, if possible. Use the immediate or abort options only as a last resort.
3. Back up all datafiles and online redo log files of the database.
4. Start up an new instance, but do not mount or open the database.
5. Create a new control file for the database using the CREATE CONTROLFILE command.
6. Store a backup of the new control file on an offline storage device.
7. Edit the parameter files of the database.
Edit the parameter files of the database to indicate all of the control files created in Steps 5 and 6 (not including the backup control file) in the CONTROL_FILES parameter.
8. Recover the database if necessary.
If you are creating the control file as part of recovery, recover the database. If the new control file was created using the NORESETLOGS option (Step 5), you can recover the database with complete, closed database recovery.
If the new control file was created using the RESETLOGS option, you must specify USING BACKUP CONTROL FILE . If you have lost online or archived redo logs or datafiles, use the procedures for recovering those files.
Open the database using one of the following methods:
- If you did not perform recovery, open the database normally.
- If you performed complete, closed database recovery in Step 8, use the Startup Open radio button of the Startup Database dialog box of Server Manager.
- If you specified RESETLOGS when creating the control file, use the ALTER DATABASE command, indicating RESETLOGS.
The database is now open and available for use.
See Also: For more information about listing database files, see "Listing Database Files Before Backup" .
For more information on backing up all datafiles and online redo log files of the database, see "Performing a Full Backup" .
For more information on recovering online or archived redo log files, see "Loss of Online Redo Log Files" and "Loss of Datafiles" .
For more information on closed database recovery, see .