Steps for Creating New Control Files

Steps for Creating New Control Files

Complete the following steps to create a new control file.

  1. Make a list of all datafiles and redo log files of the database.

    If you follow recommendations for control file backups as discussed in "Backing Up Control Files" , you will already have a list of datafiles and redo log files that reflect the current structure of the database. However, if you have no such list, executing the following statements will produce one.

    SELECT MEMBER FROM V$LOGFILE;
    SELECT NAME FROM V$DATAFILE; 
    SELECT VALUE FROM V$PARAMETER WHERE NAME = 'control_files';
    

    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 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 normally if possible. Use the IMMEDIATE or ABORT clauses only as a last resort.

  3. Back up all datafiles and redo log files of the database.

  4. Start up a new instance, but do not mount or open the database:

    STARTUP NOMOUNT
    
  5. Create a new control file for the database using the CREATE CONTROLFILE statement.

    When creating a new control file, specify the RESETLOGS clause if you have lost any redo log groups in addition to control files. In this case, you will need to recover from the loss of the redo logs (step 8). You must specify the RESETLOGS clause if you have renamed the database. Otherwise, select the NORESETLOGS clause.

  6. Store a backup of the new control file on an offline storage device. See "Backing Up Control Files" for instructions for creating a backup.

  7. Edit the CONTROL_FILES initialization parameter for the database to indicate all of the control files now part of your database as created in step 5 (not including the backup control file). If you are renaming the database, edit the DB_NAME parameter in your instance parameter file to specify the new name.

  8. Recover the database if necessary. If you are not recovering the database, skip to step 9.

    If you are creating the control file as part of recovery, recover the database. If the new control file was created using the NORESETLOGS clause (step 5), you can recover the database with complete, closed database recovery.

    If the new control file was created using the RESETLOGS clause, 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.

    See Also:

    Oracle Database Backup and Recovery User's Guide for information about recovering your database and methods of recovering a lost control file
  9. Open the database using one of the following methods:

    • If you did not perform recovery, or you performed complete, closed database recovery in step 8, open the database normally.

      ALTER DATABASE OPEN; 
      
    • If you specified RESETLOGS when creating the control file, use the ALTER DATABASE statement, indicating RESETLOGS.

      ALTER DATABASE OPEN RESETLOGS;
      

The database is now open and available for use.

你可能感兴趣的:(oracle心得)