Thursday, May 21, 2015

Add Datafile Space automatically when tablespace Got full, Not recommanded



Oracle Job which will automatically add datafile in tablespace when it get 99% full,




SELECT tablespace_name,maxbytes,bytes INTO v_tbs_info FROM dba_data_files; FOR tbs_inf IN v_tbs_info LOOP IF tbs_inf.bytes/tbs_inf.maxbytes > 0.99 excecute immediate 'ALTER TABLESPACE '|| tbs_inf.tablespcae_name ||' ADD DATAFILE SIZE 1M aUTOEXTEND ON NEXT 10M MAXSIZE 10G'; END LOOP;


this query will add 1 M of datafile when existing Datafile got full, and after adding Datafile of size 1 M , it will keep adding space of 10 M till it grows to 10G.

No comments:

Post a Comment