日期:2014-05-16  浏览次数:20524 次

oracle数据库常用查询

数据字典dict总是属于Oracle用户sys的。?
1、用户:?
 select username from dba_users;?
改口令?
 alter user spgroup identified by spgtest;?
2、表空间:?
 select * from dba_data_files;?
 select * from dba_tablespaces;//表空间?
 select tablespace_name,sum(bytes), sum(blocks)?
from dba_free_space group by tablespace_name;//空闲表空间?
 select * from dba_data_files?
where tablespace_name='RBS';//表空间对应的数据文件?
 select * from dba_segments?
where tablespace_name='INDEXS';?
3、数据库对象:?
 select * from dba_objects;?
 CLUSTER、DATABASE LINK、FUNCTION、INDEX、LIBRARY、PACKAGE、PACKAGE BODY、?
 PROCEDURE、SEQUENCE、SYNONYM、TABLE、TRIGGER、TYPE、UNDEFINED、VIEW。?
4、表:?
 select * from dba_tables;?
 analyze my_table compute statistics;->dba_tables后6列?
 select extent_id,bytes from dba_extents?
 where segment_name='CUSTOMERS' and segment_type='TABLE'?