SQL> startup
ORACLE 例程已经启动。
Total System Global Area 426852352 bytes
Fixed Size 1333648 bytes
Variable Size 260048496 bytes
Database Buffers 159383552 bytes
Redo Buffers 6086656 bytes
数据库装载完毕。
数据库已经打开。
SQL> drop table t;
表已删除。
SQL> create table t as select object_id id ,object_name from dba_objects;
表已创建。
SQL> set serveroutput on
SQL> declare
2 l_index_ddl varchar2(1000);
3 l_used_bytes number;
4 l_allocated_bytes number;
5 begin
6 dbms_space.create_index_cost (
7 ddl =>'create index idx_t on t(id) ', --执行的ddl
8 used_bytes => l_used_bytes,
9 alloc_bytes => l_allocated_bytes );
10 dbms_output.put_line ('used= ' || l_used_bytes || 'bytes'
11 || ' allocated= ' || l_allocated_bytes || 'bytes');
12 end;
13 /
used= 345098bytes allocated= 720896bytes
PL/SQL 过程已成功完成。
说明: used_bytes 给出索引数据实际表现的字节数。
allocated 是当实际创建索引时在表空间中实际占用的字节数。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31448824/viewspace-2139360/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31448824/viewspace-2139360/