--çıktı dosyamızı ayarlayalım./* Formatted on 2009/07/06 10:24 (Formatter Plus v4.8.8) */
spool tablespace_olustur.sql
set serveroutput on size 1000000
DECLARE
CURSOR get_ts
IS
SELECT *
FROM dba_tablespaces
WHERE tablespace_name != 'SYSTEM';
CURSOR get_df (p_ts VARCHAR2)
IS
SELECT *
FROM dba_data_files
WHERE tablespace_name = p_ts;
l_str VARCHAR2 (10);
BEGIN
FOR ts_rec IN get_ts
LOOP
DBMS_OUTPUT.put_line ('CREATE TABLESPACE ' || ts_rec.tablespace_name);
-- tablespace de bulunana bütün datafile leri burada yaz.
FOR df_rec IN get_df (ts_rec.tablespace_name)
LOOP
IF get_df%ROWCOUNT = 1
THEN
l_str := 'DATAFILE';
ELSE
l_str := ',';
END IF;
DBMS_OUTPUT.put_line ( l_str
|| ' '
|| CHR (39)
|| df_rec.file_name
|| CHR (39)
|| ' SIZE '
|| df_rec.BYTES
|| ' REUSE '
);
IF df_rec.autoextensible = 'YES'
THEN
DBMS_OUTPUT.put_line ( ' AUTOEXTEND ON'
|| ' NEXT '
|| df_rec.increment_by
);
IF df_rec.maxbytes = 68719443968
THEN
DBMS_OUTPUT.put_line (' MAXSIZE UNLIMITED');
ELSE
DBMS_OUTPUT.put_line (' MAXSIZE ' || df_rec.maxbytes);
END IF;
END IF;
END LOOP;
/* Extent Management durumuda burada. */
DBMS_OUTPUT.put_line ('EXTENT MANAGEMENT ' || ts_rec.extent_management);
IF ts_rec.extent_management = 'LOCAL'
THEN
IF ts_rec.allocation_type = 'SYSTEM'
THEN
DBMS_OUTPUT.put_line (' AUTOALLOCATE ');
ELSE
DBMS_OUTPUT.put_line (' UNIFORM SIZE ' || ts_rec.initial_extent);
END IF;
END IF;
IF ts_rec.extent_management = 'DICTIONARY'
THEN
DBMS_OUTPUT.put_line ( 'DEFAULT STORAGE (INITIAL '
|| ts_rec.initial_extent
|| ' NEXT '
|| ts_rec.next_extent
|| ' MINEXTENTS '
|| ts_rec.min_extents
|| ' MAXEXTENTS '
|| ts_rec.max_extents
|| ' PCTINCREASE '
|| ts_rec.pct_increase
|| ' ) '
);
END IF;
DBMS_OUTPUT.put_line (' ONLINE;');
DBMS_OUTPUT.new_line;
END LOOP;
END;
/
spool off
--kodlar hazır.
No comments:
Post a Comment