oracle sql and dba tutorial logo

 

Oracle DBA

Learn Oracle 11g / 12c Database Admin step by step



Oracle SQL

Tutorial for Oracle SQL


Oracle DBA Interview Questions

Most asked Oracle DBA Interview Questions.

60 Technical Questions
42 Backup & Recovery Questions

Unix For Oracle DBA 20 Questions



Download Oracle 11g / 12 c Software

Links to Download Oracle 12c / 11g for Linux, Windows etc.


MySQL Tutorial

Learn MySQL step by step


 

 

 

 

 

 

 

 

 

Managing Control Files in Oracle database

Every Oracle Database has a control file, which is a small binary file that records the physical structure of the database. The control file includes:

It is strongly recommended that you multiplex control files  i.e. Have at least two control files one in one hard disk and another one located in another disk, in a database.  In this way if control file becomes corrupt in one disk the another copy will be available and you don’t have to do recovery of control file.

You can  multiplex control file at the time of creating a database and later on also. If you have not multiplexed control file at the time of creating a database you can do it now by following given procedure.

Multiplexing Control File

Steps:

 1.  Shutdown the Database.

SQL>SHUTDOWN IMMEDIATE;

 2. Copy the control file from old location to new location using operating system command. For example.

$ cp /u01/oracle/ica/control.ora  /u02/oracle/ica/control.ora

 3. Now open the parameter file and specify the new location like this

CONTROL_FILES=/u01/oracle/ica/control.ora

Change it to

CONTROL_FILES=/u01/oracle/ica/control.ora,/u02/oracle/ica/control.ora

 4. Start the Database

Now Oracle will start updating both the control files and, if one control file is lost you can copy  it from another location.

Changing the Name of a Database

If you ever want to change the name of database or want to change the setting of MAXDATAFILES, MAXLOGFILES, MAXLOGMEMBERS then you have to create a new control file.

Creating A New Control File

Follow the given steps to create a new controlfile

Steps

1.  First generate the create controlfile statement

SQL>alter database backup controlfile to trace;

After giving this statement oracle will write the CREATE CONTROLFILE statement in a trace file. The trace file will be randomly named something like ORA23212.TRC and it is created in USER_DUMP_DEST directory.

2.  Go to the USER_DUMP_DEST directory and open the latest trace file in text editor. This file will contain the CREATE CONTROLFILE statement. It will have two sets of statement one with RESETLOGS and another without RESETLOGS. Since we are changing the name of the Database we have to use RESETLOGS option of CREATE CONTROLFILE statement. Now copy and paste the statement in a file. Let it be c.sql

3.  Now open the c.sql file in text editor and set the database name from ica to prod shown in an example below

CREATE CONTROLFILE
   SET DATABASE prod   
   LOGFILE GROUP 1 ('/u01/oracle/ica/redo01_01.log',
                    '/u01/oracle/ica/redo01_02.log'),
           GROUP 2 ('/u01/oracle/ica/redo02_01.log',
                    '/u01/oracle/ica/redo02_02.log'),
           GROUP 3 ('/u01/oracle/ica/redo03_01.log',
                    '/u01/oracle/ica/redo03_02.log')
   RESETLOGS
   DATAFILE '/u01/oracle/ica/system01.dbf' SIZE 3M,
            '/u01/oracle/ica/rbs01.dbs' SIZE 5M,
            '/u01/oracle/ica/users01.dbs' SIZE 5M,
            '/u01/oracle/ica/temp01.dbs' SIZE 5M
   MAXLOGFILES 50
   MAXLOGMEMBERS 3
   MAXLOGHISTORY 400
   MAXDATAFILES 200
   MAXINSTANCES 6
   ARCHIVELOG;

4. Start and do not mount the database.

SQL>STARTUP NOMOUNT;

5. Now execute c.sql script

SQL> @/u01/oracle/c.sql

6.  Now open the database with RESETLOGS

SQL>ALTER DATABASE OPEN RESETLOGS;

 

 


HomeContact Us

Data Loader

Data Loader is a simple yet powerful tool to
export and import Data between many common database formats


Forms Data Loader

Tool to load data into Oracle E-Business Suite R12 / Oracle Apps using Macros and Forms Record and Playback

Interface Computers Academy © 2007-2017 All Rights Reserved