zoukankan      html  css  js  c++  java
  • Oacle常用语句

    --查询数据库中表的记录数  按记录数排名
    select  * from user_tables t where t.NUM_ROWS is not  null  order by t.NUM_ROWS  desc

    --查询数据库中表的存储空间, 按空间大小排名

    select * from user_segments s  where s.BYTES  is not null  order by s.BYTES desc

    --查询数据库表空间是否是自动扩展

     select a.FILE_NAME,a.TABLESPACE_NAME,a.AUTOEXTENSIBLE from dba_data_files a

    --查询数据库各表空间的分区情况

    select a.tablespace_name,count(*) from USER_TAB_PARTITIONS a
    group by a.tablespace_name

    --查看数据库的分区表

     select * from user_part_tables 

    --查看oracle表所有注释
    select * from user_tab_comments 

    --获取字段注释:

    select * from user_col_comments

    --查看表空间使用率

    SELECT a.tablespace_name "表空间名",

           total "表空间大小",
           free "表空间剩余大小",
           (total - free) "表空间使用大小",
           total / (1024 1024 1024"表空间大小(G)",
           free / (1024 1024 1024"表空间剩余大小(G)",
           (total - free) / (1024 1024 1024"表空间使用大小(G)",
           round((total - free) / total, 4) * 100 "使用率 %"
      FROM (SELECT tablespace_name, SUM(bytes) free
              FROM dba_free_space
             GROUP BY tablespace_name) a,
           (SELECT tablespace_name, SUM(bytes) total
              FROM dba_data_files
             GROUP BY tablespace_name) b
     WHERE a.tablespace_name = b.tablespace_name
  • 相关阅读:
    内置函数二
    内置函数
    【MySQL】纲举目张:打通MySQL架构和业务的任督二脉
    关闭服务器节能模式
    透明大页
    【MySQL】MySQ 8.0启用HugePage
    运维安全之Tripwire
    七字诀,不再憋屈的运维
    利用钉钉机器人发送告警信息
    【MySQL】MySQL 8.0支持utf8mb4
  • 原文地址:https://www.cnblogs.com/dll102/p/13292198.html
Copyright © 2011-2022 走看看