Friday, October 29, 2010

Script to detect duplicate file names in different filesystems.

select substr(file_name, instr(file_name,'/',1,5)+1), count(*)
from dba_data_files
group by substr(file_name, instr(file_name,'/',1,5)+1)
having count(*) > 1;

Tuesday, October 12, 2010

Script to increment sequences

A simple script to increment Oracle sequences.

set serveroutput on
declare
x integer;
begin
x:=89796633;
while x < 89796703 loop
select mysequence.nextval into x from dual;
dbms_output.put_line(x);
end loop;
end;
/