Create trace file for Control file in Oracle

Create trace file for Control file in Oracle

Creating trace file of control file of Oracle having all information about log and data files present in the Oracle Database.
We can recreate control file from this trace file, if lost the control files.

Generate Trace file for control file as specified location

SQL> alter database backup controlfile to trace as 'D:\control.txt';
Database altered.

Create trace of Control file at Default location
It will generate the output at user_dump_dest parameter value.

-- Generate the trace file of control file.
SQL> alter database backup controlfile to trace;
Database alerted.

--Check the location of file with alert log
alter database backup controlfile to trace
2020-03-26T13:52:55.404897+05:30
Backup controlfile written to trace file C:\ORACLE\diag\rdbms\xe\xe\trace\xe_ora_29100.trc
Completed: alter database backup controlfile to trace

Sample look like following:
You can download both xe_ora_29100.trc and control.txt Controlfile sample.

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "XE" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'C:\ORACLE\ORADATA\XE\REDO01.LOG' SIZE 200M BLOCKSIZE 512,
GROUP 2 'C:\ORACLE\ORADATA\XE\REDO02.LOG' SIZE 200M BLOCKSIZE 512,
GROUP 3 'C:\ORACLE\ORADATA\XE\REDO03.LOG' SIZE 200M BLOCKSIZE 512,
GROUP 4 'C:\ORACLE\ORADATA\XE\REDO04.LOG' SIZE 200M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'C:\ORACLE\ORADATA\XE\SYSTEM01.DBF',
'C:\ORACLE\ORADATA\XE\SYSAUX01.DBF',
'C:\ORACLE\ORADATA\XE\UNDOTBS01.DBF',
'C:\ORACLE\ORADATA\XE\PDBSEED\SYSTEM01.DBF',
'C:\ORACLE\ORADATA\XE\PDBSEED\SYSAUX01.DBF',
'C:\ORACLE\ORADATA\XE\USERS01.DBF',
'C:\ORACLE\ORADATA\XE\PDBSEED\UNDOTBS01.DBF',
'C:\ORACLE\ORADATA\XE\XEPDB1\SYSTEM01.DBF',
'C:\ORACLE\ORADATA\XE\XEPDB1\SYSAUX01.DBF',
'C:\ORACLE\ORADATA\XE\XEPDB1\UNDOTBS01.DBF',
'C:\ORACLE\ORADATA\XE\XEPDB1\USERS01.DBF',
'C:\ORACLE\ORADATA\XE\PDB1\SYSTEM01.DBF',
'C:\ORACLE\ORADATA\XE\PDB1\SYSAUX01.DBF',
'C:\ORACLE\ORADATA\XE\PDB1\UNDOTBS01.DBF',
'C:\ORACLE\ORADATA\XE\PDB1\USERS01.DBF',
CHARACTER SET AL32UTF8
;

-- 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 'C:\ORACLE\ARCHIVE\ARC0000000001_0999319476.0001';
-- ALTER DATABASE REGISTER LOGFILE 'C:\ORACLE\ARCHIVE\ARC0000000001_1019317005.0001';
-- ALTER DATABASE REGISTER LOGFILE 'C:\ORACLE\ARCHIVE\ARC0000000001_1020770292.0001';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE

-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;

-- Database can now be opened normally.
ALTER DATABASE OPEN;

-- Open all the PDBs.
ALTER PLUGGABLE DATABASE ALL OPEN;

-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE 'C:\ORACLE\ORADATA\XE\TEMP01.DBF'
SIZE 135266304 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = PDB$SEED;
ALTER TABLESPACE TEMP ADD TEMPFILE 'C:\ORACLE\ORADATA\XE\PDBSEED\TEMP012019-09-18_15-38-03-475-PM.DBF'
SIZE 65011712 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = XEPDB1;
ALTER TABLESPACE TEMP ADD TEMPFILE 'C:\ORACLE\ORADATA\XE\XEPDB1\TEMP01.DBF'
SIZE 135266304 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
ALTER SESSION SET CONTAINER = PDB1;
ALTER TABLESPACE TEMP ADD TEMPFILE 'C:\ORACLE\ORADATA\XE\PDB1\TEMP012019-09-18_15-38-03-475-PM.DBF' REUSE;
ALTER SESSION SET CONTAINER = CDB$ROOT;

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.