Control File Backup Script to Trace

To generate SQL Script for Control Files, use this SQL Command.


SQL> alter database backup controlfile to trace;

Database altered.

This will be written in Trace file, Default Location is given below. Find out the latest trace file and copy it to some where else then open it using Notepad or Wordpad.


F:\oracle\product\10.2.0\admin\sibl\udump

My Control File SQL Script from Trace File:


-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
--     Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "SIBL" NORESETLOGS  NOARCHIVELOG
    MAXLOGFILES 32
    MAXLOGMEMBERS 2
    MAXDATAFILES 32
    MAXINSTANCES 16
    MAXLOGHISTORY 1752
LOGFILE
  GROUP 1 'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\REDO01.LOG'  SIZE 50M,
  GROUP 2 'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\REDO02.LOG'  SIZE 50M,
  GROUP 3 'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\REDO03.LOG'  SIZE 50M
-- STANDBY LOGFILE
DATAFILE
  'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\SYSTEM01.DBF',
  'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\UNDOTBS01.DBF',
  'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\SYSAUX01.DBF',
  'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\USERS01.DBF',
  'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\USERS02.DBF',
  'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\USERS03.DBF'
CHARACTER SET WE8MSWIN1252
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE 'F:\ARCHIVE1ARC00001_0718737921.001';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE 'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\TEMP02.DBF'
     SIZE 4096M REUSE AUTOEXTEND OFF;
ALTER TABLESPACE TEMP ADD TEMPFILE 'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\TEMP01.DBF'
     SIZE 15635M REUSE AUTOEXTEND OFF;
-- End of tempfile additions.
--
--     Set #2. RESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "SIBL" RESETLOGS  NOARCHIVELOG
    MAXLOGFILES 32
    MAXLOGMEMBERS 2
    MAXDATAFILES 32
    MAXINSTANCES 16
    MAXLOGHISTORY 1752
LOGFILE
  GROUP 1 'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\REDO01.LOG'  SIZE 50M,
  GROUP 2 'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\REDO02.LOG'  SIZE 50M,
  GROUP 3 'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\REDO03.LOG'  SIZE 50M
-- STANDBY LOGFILE
DATAFILE
  'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\SYSTEM01.DBF',
  'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\UNDOTBS01.DBF',
  'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\SYSAUX01.DBF',
  'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\USERS01.DBF',
  'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\USERS02.DBF',
  'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\USERS03.DBF'
CHARACTER SET WE8MSWIN1252
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE 'F:\ARCHIVE1ARC00001_0718737921.001';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE 'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\TEMP02.DBF'
     SIZE 4096M REUSE AUTOEXTEND OFF;
ALTER TABLESPACE TEMP ADD TEMPFILE 'F:\ORACLE\PRODUCT\10.2.0\ORADATA\SIBL\TEMP01.DBF'
     SIZE 15635M REUSE AUTOEXTEND OFF;
-- End of tempfile additions.

It is recommended that before attempting recreating Control File, please go through this Trace File content and consider mentioned issues carefully.

Thanks
A Rahim Khan

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: