Personal tools
You are here: Home Oracle How To's Generate a script to allow AUTOEXTENT to the DATAFILES
Navigation
Log in


Forgot your password?
 
Document Actions

Generate a script to allow AUTOEXTENT to the DATAFILES

Generate script to grant AUTOEXTENT to the DATAFILES

set serveroutput on;
set scan         on;
set verify       off;
set heading      off;
set feedback     off;

accept V_TBS char prompt 'Informe o TABLESPACE_NAME........: ' default %;

declare
v_1     number := 0;
begin
  select count(*) into v_1 from dba_objects where object_name='FILEXT$';
  if v_1 = 0 then
     DBMS_OUTPUT.PUT_LINE('PROMPT Nao existem datafiles AUTOEXTEND!');
     goto FIM;
  end if;
 
  for rg_c1 in (select B.File_Name,
                       B.Tablespace_Name,
                       A.INC*TO_NUMBER(C.VALUE) as NEXT,
                       A.Maxextend*TO_NUMBER(C.VALUE) as MAXSIZE
                from   SYS.FILEXT$ A,DBA_DATA_FILES B,V$PARAMETER C
                where  A.File#=B.File_ID
                and    B.Tablespace_name like '&V_TBS'
                and    C.NAME='db_block_size'
                order  by 4,1) LOOP
       DBMS_OUTPUT.PUT_LINE('--');
       DBMS_OUTPUT.PUT_LINE('alter database datafile ' || '''' || RG_C1.FILE_NAME || '''');
       DBMS_OUTPUT.PUT_LINE('autoextend on NEXT ' || RG_C1.NEXT || ' MAXSIZE ' || RG_C1.MAXSIZE || ';');
   end loop;
<<FIM>>
  DBMS_OUTPUT.PUT_LINE('--');
  DBMS_OUTPUT.PUT_LINE('PROMPT --;');
  DBMS_OUTPUT.PUT_LINE('PROMPT Fim ...;');
end;
/

Security Awareness
Would you like your company to implement gamification into your security awareness program?





Polls