No Backup !!! Think Again

While I was drinking my coffee yesterday in the office, A Customer Called me complaining that Non Production Database Is not working and Database Administrator quit his job without any Handover the situation was so creepy, This database hold Fusion middleware Repository and configuration, The development team use it before deploy anything on Production Database ( No Backup configured !!!! ),  

Trying to Recover Database and Open it with Resetlogs will lead to this error :-

ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: ‘/u01/app/oracle/oradata/NPDB/system01.dbf’

This Error is only apart of the problem, To solve it :-

Recover database using file name (Redolog) to get the current filename :-

SQL > Startup mount ;

 SQL > select member from v$logfile lf , v$log l where l.status=’CURRENT’ and;


SQL > Recover database using backup controlfile until cancel ; 

 Specify log: {=suggested | filename | AUTO | CANCEL}

 /u01/app/oracle/oradata/NPDB/redo03.log ( From the Above Query ).

Log applied.
Media recovery complete.

 Trying to open database :-

SQL > Alter database open Resetlogs ;

Failed !!!! with Another Datafile which is UNDO.

 ORA-01110: data file 4:’/u01/app/oracle/oradata/NPDB/UNDOTBS01.DBF’

SQL  > Create Pfile from Spfile ;

Modify the pfile and add the hidden parameter :-


But this Not Solved the problem either.

Again Edit Pfile But this Time :-


SQL> select name from v$datafile; 


SQL > alter database datafile ‘/u01/app/oracle/oradata/NPDB/UNDOTBS01.DBF’ offline drop;

ERROR at line 1:
ORA-01548: active rollback segment ‘_SYSSMU11$’ found, terminate dropping tablespace

Check Segment that Needs Recovery :-

SQL>select segment_name,status,tablespace_name from dba_rollback_segs where status=’NEEDS RECOVERY’; 

—————————— —————- —————–

Add the following line to pfile:

_corrupted_rollback_segments = (‘_SYSSMU11$’,’_SYSSMU12$’,’_SYSSMU13$’);

SQL > Startup mount pfile=’/u01/osama.ini’;
SQL > drop rollback segment “_SYSSMU11$” –> Drop all the above Segments ;

Drop the Undo And Recreate it again.

SQL > Startup ;

SQL> create undo tablespace UNDOTBS2 

datafile ‘/u01/app/oracle/oradata/NPDB/UNDOTBS02.DBF’ size 1G;

Remove All Hidden Parameter and restore UNDO_Managment Parameter to AUTO and UNDO_TABLESPACE=UNDOTBS2 then :-

SQL> create spfile from pfile; 

first Advice  Enable RMAN Please

 Thank you
Osama Mustafa

Reference :-
1- Doc ID 94114.1
2- Doc ID 1295294.1
3- Doc ID 28226.1

Check Your Database Size

Datafiles : 

select sum(bytes)/1048576 “DATAFILES_SIZE_MB” from dba_data_files;


select sum(bytes)/1048576 “TEMPFILES_SIZE_MB” from dba_temp_files;

Your redo logs can also use up a large amount of disk space – especially if your database has more than the minimum number of 2 redo log groups. (You may also have several members within each group).


select sum(bytes)/1048576 “REDOLOGS_SIZE_MB” from v$log;

The database obviously needs controlfiles to record information such as which datafiles belong to the database.  If your CONTROL_FILE_RECORD_KEEP_TIME is set to a large value, then your controlfiles can become quite large.


select round(sum(block_size*file_size_blks)/1048576,2) “CONTROLFILESIZE_MB” from v$controlfile;

From 10g onwards, flashback database is not enabled by default, but if it is, then this area can grow rapidly over time.

Flash Recovery Area:

select * from v$recovery_file_dest; 
select * from v$flash_recovery_area_usage;  

These views will show sizing details and free space available.

Note: If your backups are held outside of the flash recovery area, then you’ll also need to allow space for these. This will depend on your backup strategy and backup retention policy. (Export/datapump export dumpfiles also need to be planned for).
If you are using RMAN incremental backups and have block change tracking enabled, then include this file:

Block change tracking file

select filename, nvl(bytes/1048576,0) “BLOCK_CT_SIZE_MB” from v$block_change_tracking;

Files referenced by database directories or the utl_file_dir parameter:

Your application may read from, or write to external files via database directories or the utl_file_dir parameter.

Other examples of using external directories are for

(a) External tables –

select a.owner||’.’||a.table_name||’ stored in directory ‘||b.directory_path “EXTERNAL_TABLES”
from dba_external_locations a, dba_directories b
where a.directory_owner=b.owner
and a.directory_name=b.directory_name;

(b) If you are storing multiple versions of the same tablespace within a file group repository. (i.e. tablespace versioning).

select a.tablespace_name, a.version, a.file_group_owner, a.file_group_name,
b.file_name, b.file_directory
from dba_file_group_tablespaces a, dba_file_group_files b
where a.file_group_owner=b.file_group_owner
and a.file_group_name=b.file_group_name;

Thank you 
osama Mustafa

Resize Redolog On RAC Instance

Before I Posted “How To Resize redo log ” This was on Single Instance But Now I show you how to do it on Oracle Real Application Cluster

1.First Run this Query To check size, redo On your RAC :

select, l.thread#, f.member, l.archived, l.status, (bytes/1024/1024) fsize
from v$log l, v$logfile f
where =
order by 1,2

2. Now our purpose is increase redosize from 100Mb to 300 Mb

3. We are going to add our new redo file by below command:

alter database add logfile group 5 ‘+ORADATA’ size 300M;    <<   node 2
alter database add logfile group 6 ‘+ORADATA’ size 300M;    <<   node 2
alter database add logfile group 7 ‘+ORADATA’ size 300M;    <<   node 1
alter database add logfile group 8 ‘+ORADATA’ size 300M;    <<   node 1

5. Switch until we are into log group 5,6,7,8 so we can drop log groups 1, 2,3 and 4 Until you see the new redo log used .

Thank you
Osama mustafa

Resize Redo Log

Here is a newly created database redo log information:

SQL> select * from v$log;

———- ———- ———- ———- ———- — —————- ————- ——————-
1 1 17 52428800 1 NO INACTIVE 996238 06/09/2007 22:01:59
2 1 18 52428800 1 NO INACTIVE 1006432 06/09/2007 22:13:32
3 1 19 52428800 1 NO CURRENT 1036439 07/09/2007 09:56:44

SQL> select * from v$logfile;

———- ——- ——- ————————————————-
3 ONLINE /database/data/redo03.log
2 ONLINE /database/data/redo02.log
1 ONLINE /database/data/redo01.log

Here is how i changed this to five 200M redo logs:

SQL> alter database add logfile group 4 (‘/database/data/redo04.log’) size 200M;
SQL> alter database add logfile group 5 (‘/database/data/redo05.log’) size 200M;

while running following sql commands, if you hit an error like this:

ORA-01623: log 3 is current log for instance RPTDB (thread 1) – cannot drop
ORA-00312: online log 3 thread 1: ‘/database/data/redo03.log’

you should run ” alter system switch logfile;” until current log is 4 or 5. Then execute “alter system checkpoint;”

SQL> alter database drop logfile group 1;
SQL> alter database drop logfile group 2;
SQL> alter database drop logfile group 3;

then move (or maybe drop) old redo logs

mv /database/data/redo01.log /database/data/redo01_old.log
mv /database/data/redo02.log /database/data/redo02_old.log
mv /database/data/redo03.log /database/data/redo03_old.log


SQL> alter database add logfile group 1 (‘/database/data/redo01.log’) size 200M;
SQL> alter database add logfile group 2 (‘/database/data/redo02.log’) size 200M;
SQL> alter database add logfile group 3 (‘/database/data/redo03.log’) size 200M;