首页 > 其他分享 >DM相关表结构查询

DM相关表结构查询

时间:2024-03-27 16:57:56浏览次数:20  
标签:index DM name column dcc 查询 table owner 相关

-- 查询表名
SELECT table_name FROM dba_tables WHERE owner = '所有者' ORDER BY table_name

-- 查询表注释
SELECT T.table_name,U.COMMENTS As table_comment FROM DBA_TABLES T
JOIN USER_TAB_COMMENTS U ON T.TABLE_NAME =U.TABLE_NAME WHERE OWNER= '所有者' ORDER BY T.table_name;

-- 查询表结构
SELECT a.table_name As tableName
, c.comments As tableComment
, a.column_name As columnName
, b.comments As comments
, a.data_type As dataType
, a.data_length As dataLength
, a.data_scale As dataScale
, d.column_position As primaryKey
, d.constraint_name As constraintName
, e.data_default as defaultValue
,(case when (e.nullable = 'N') then 'NO' else 'YES' end) as isNotNull
,(case when f.info2 = 1 then 'auto_increment' else null end) as extra
FROM all_tab_cols a
LEFT JOIN all_col_comments b ON b.table_name = a.table_name AND b.column_name = a.column_name AND a.owner = b.schema_name
LEFT JOIN all_tab_comments c ON c.table_name = b.table_name AND c.owner = b.owner
LEFT JOIN ( SELECT dcc.table_name,dcc.column_name,dcc.column_position,dcc.index_owner,dc.constraint_name
FROM all_ind_columns dcc
JOIN all_constraints dc ON dcc.index_name = dc.index_name AND dc.constraint_type = UPPER('p') AND dcc.index_owner = dc.owner) d
ON d.table_name = a.table_name AND d.column_name = a.column_name AND d.index_owner = a.owner
LEFT JOIN all_tab_columns e ON a.table_name = e.table_name AND a.owner = e.owner and a.column_name = e.column_name
LEFT JOIN (SELECT f1.owner,f1.object_name As table_name,f0.name,f0.info2 FROM syscolumns f0
INNER JOIN dba_objects f1 ON f1.object_type = 'TABLE' AND info2 =1 AND f1.object_id = f0.id
) f ON f.name = a.column_name AND f.table_name = a.table_name AND f.owner = a.owner
WHERE a.owner = UPPER('所有者')
ORDER BY a.table_name ASC, a.column_id ASC;

-- 查询索引
SELECT dcc.table_name As tableName
, dcc.index_name As indexName
, dcc.column_name As columnName
, dcc.column_position As columnPosition
, dc.constraint_type As constraintType
, di.index_type As indexType
, dcc.descend
FROM all_ind_columns dcc
LEFT JOIN all_constraints dc ON dcc.index_name = dc.index_name AND dcc.index_owner = dc.owner
LEFT JOIN all_indexes di ON dcc.index_name = di.index_name AND dcc.index_owner = di.owner
where dcc.index_owner = '所有者'
AND (dc.constraint_type not in ('p','U') or dc.constraint_type is null)
order by dcc.table_name,dcc.index_name;


原文链接:https://blog.csdn.net/wylsjz/article/details/128459084

标签:index,DM,name,column,dcc,查询,table,owner,相关
From: https://www.cnblogs.com/niuniu0108/p/18099692

相关文章

  • Linux dmesg命令使用方法详解
    Linuxdmesg命令使用方法详解一、命令简介dmesg(displaymessage)命令用于显示开机信息。kernel会将开机信息存储在ringbuffer中。您若是开机时来不及查看信息,可利用dmesg来查看。开机信息亦保存在/var/log/dmesg中。二、使用方法dmesg[options]三、命令选项[root@loc......
  • react零基础到精通-1|基础概念,主要特性,s6语法,react相关的开发环境和工具,react简介,箭头
    致力于解决复杂视图层开发我呢提,全新的ui组件的开发理念,1.1React简介前端UI的本质问题是如何将来源于服务器端的动态数据和用户的交互行为高效地反映到复杂的用户界面上。React另辟蹊径,通过引入虚拟DOM、状态、单向数据流等设计理念,形成以组件为核心,用组件搭建UI的开发......
  • kubeadm 搭建 k8s
    kubeadm搭建k8s预先构建基础环境搭建需要的运行时环境以下使用的是docker+cri-dockerd的方案,明显区别在sock指定上,其他无差别安装k8s组件截至2024-1-10各个镜像站最新版本,目前官方最新1.29.0,1.28.5,1.27.9站点1.29.x1.28.x1.27.x备注清华x1.28.......
  • SpringBootWeb最新相关技术(上接maven):IDEA2023-Spring环境,http协议复习概览,web服务器To
    Spring官网HTTPs://spring.iospring生态(全家桶)基于SpringFramework基础框架。但如果我们基于该基础框架开发,会面临配置繁琐,入门难度大的问题,SpringBoot则可以快速开发(简化配置,快速开发)。1.SpringBootWeb入门使用SpringBoot开发一个Web应用,浏览器发起请求/hello之后,给浏......
  • fsutil fsinfo ntfsinfo c:  查询NTFS特定卷信息C盘 fsutil fsinfo sectorInfo c:
    fsutilfsinfontfsinfoc: 查询NTFS特定卷信息C盘NTFSVolumeSerialNumber:    NTFSVersion   :        3.1LFSVersion   :        2.0TotalSectors  :        TotalClusters  : ......
  • OSERDES与HDMI
    参考之前笔记:Hdmi接口与XAPP460-CSDN博客原语:串并转换器-CSDN博客手册:XAPP460UG472AMD技术信息门户例化两次,其中一个调成slave,实现10转1;//例化OSERDESE2原语,实现并串转换,Master模式OSERDESE2#(.DATA_RATE_OQ("DDR"),//设置双倍数据速率.DATA_RA......
  • sensitive-word-admin v1.3.0 发布 如何支持敏感词控台分布式部署?
    拓展阅读sensitive-word-adminv1.3.0发布如何支持分布式部署?sensitive-word-admin敏感词控台v1.2.0版本开源sensitive-word基于DFA算法实现的高性能敏感词工具介绍更多技术交流业务背景如果我们的敏感词部署之后,不会变化,那么其实不用考虑这个问题。......
  • Oracle 分页查询,排序分页
    效率最高内查询小于等于外查询大于select*from(selectt.*,rownumasnfromSTUDENTtwhererownum<=4)twheret.n>2orderbyt.iddesc;查看执行计划explainplanforselect*from(selectrownumasn,d.*fromdeptdwhererownum<=4)twheret.n>......
  • Mongo Db基本查询
    gt:大于gte:大于等于lt:小于lte:小于等于SQL查询语句MongoDBfind()语句SELECT*FROMusersdb.users.find()SELECTid,user_id,statusFROMusersdb.users.find({},{user_id:1,status:1})SELECTuser_id,statusFROMusersdb.users.find({},{......
  • openGauss/MOGDB时间消耗相关视图
    openGauss/MOGDB时间消耗相关视图本文出处:https://www.modb.pro/db/388212数据库版本openGauss/MOGDB-2.1.1一、显示当前用户在各个节点上正在执行的作业的负载管理记录(单位:ms)包含:语句执行前的阻塞时间、语句执行的开始时间、语句已经执行的时间、语句执行预估总时间、语句......