Tuesday, June 3, 2014

backup controlfile to trace / generate script of control file

Some time we need to recreate the control file in database so for this we should have the backup of control file.

Why we need to recreate the control file:
- All copies of our control file is lost or corrupted in database
- cloning of database
- recovering database using old datafiles, redologfiles
- we need to change the parameter value of database

how to have the backup of control file in form of script:
1. First of all you should know the path of alert log file in your database.

SQL> show parameter user_dump_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
user_dump_dest                       string      d:\app\gurjeet\diag\rdbms\orcl
                                                 \orcl\trace

                                               
2. We need to execute below command, it will generate the script of "create control file"
SQL> alter database backup controlfile to trace;

Database altered.


3. Move to above directory, path return by parameter "user_dump_dest", and look for alert file named as "alter_dbname".
open the file and look for the content like below

The create control file script will looks like below.

Create controlfile reuse set database "orcl"
MAXINSTANCES 8
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
Datafile
'D:\app\gurjeet\oradata\orcl\SYSTEM01.DBF',
'D:\app\gurjeet\oradata\orcl\SYSAUX01.DBF',
'D:\app\gurjeet\oradata\orcl\UNDOTBS01.DBF',
'D:\app\gurjeet\oradata\orcl\USERS01.DBF'
LOGFILE GROUP 1 ('D:\app\gurjeet\oradata\orcl\redo01.log') SIZE 51200K,
GROUP 2 ('D:\app\gurjeet\oradata\orcl\redo02.log') SIZE 51200K,
GROUP 3 ('D:\app\gurjeet\oradata\orcl\redo03.log') SIZE 51200K RESETLOGS

No comments:

Post a Comment

web stats