首页 > 数据库技术 > 详细

[oracle]常用SQL汇总

时间:2017-12-27 14:58:52      阅读:213      评论:0      收藏:0      [点我收藏+]

创建用户

create user 用户名 identified by 密码 default tablespace 默认表空间 temporary tablespace 临时表空间;

查看表空间大小

select tablespace_name, sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;

查看表空间及利用率

select a.tablespace_name, total, free, total-free as used from
(select tablespace_name, sum(bytes)/1024/1024 as total from dba_data_files group by tablespace_name) a,
(select tablespace_name, sum(bytes)/1024/1024 as free from dba_free_space group by tablespace_name) b
where a.tablespace_name = b.tablespace_name;

查看临时表空间及利用率

select tablespace_name, tablespace_size/1024/1024 as total, allocated_space/1024/1024 as used, free_space/1024/1024 as free  from dba_temp_free_space;

查看临时表空间信息

select * from dba_temp_files;

查看某表的索引信息

select * from user_indexes where table_name = ‘表名‘

查看表的列信息

select * from user_tab_columns where table_name=‘表名‘

 

[oracle]常用SQL汇总

原文:https://www.cnblogs.com/wendelhuang/p/8125612.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!