From 01bc0c33aeb4c5dc4950caf0f1ff34c3c2118485 Mon Sep 17 00:00:00 2001 From: youxiangyang Date: Thu, 25 Nov 2021 23:21:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=83=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...60\346\215\256\347\256\241\347\220\206.md" | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 "\351\253\230\347\272\247\350\277\220\347\273\264/Gbase8s\345\205\203\346\225\260\346\215\256\347\256\241\347\220\206.md" diff --git "a/\351\253\230\347\272\247\350\277\220\347\273\264/Gbase8s\345\205\203\346\225\260\346\215\256\347\256\241\347\220\206.md" "b/\351\253\230\347\272\247\350\277\220\347\273\264/Gbase8s\345\205\203\346\225\260\346\215\256\347\256\241\347\220\206.md" new file mode 100644 index 0000000..8930f0f --- /dev/null +++ "b/\351\253\230\347\272\247\350\277\220\347\273\264/Gbase8s\345\205\203\346\225\260\346\215\256\347\256\241\347\220\206.md" @@ -0,0 +1,59 @@ +# Gbase8s 元数据管理 + +> 和其他数据库一样,gbase8s把一些配置、表、视图等信息存储到了一些系统表。通过这些系统表,我们可以快速的获取想要的元数据信息。 + + + +常用的元数据查询: + +- 查询已创建的数据库 + - 数据库: `database sysmaster;` + - `select *from sysdatabasesl;` + - sysmaster是一个系统数库 +- 查询数据库字符集 + - 数据库:database sysmaster; + - select * from sysydbslocale; +- 查询表 + - 以下查询均需要切换到要查询的对象所在的数据库进行查询。 + - database db_name; + - select tabid,tabname,tabtype from systables where tabid>=100 and tabtype="T" ; + - tabid ,默认需要大于100 +- 查询视图 + - select * from systables where tabid>=100 and tabtype="V" ; +- 查询列 + - select * from syscolumns where tabid="x"; + - 查询出来的列的类型,是个代码,需要再关联下其他表 + - select * from syscolumnsext where tabid="" order by colno; +- 查询表索引: + - select * from sysindexes where tabid="xxx"; +- 查询触发器 + - select * from systiggers; +- 查询存储过程 + - select * from sysprocedures where procname like "xx_%" ; +- 查询函数: 与查询存储过程一样。 + - select * from sysprocedures where procname like 'fn_%'; +- 查询同义词 + - syssyntable +- 查询约束(主键、外键、唯一索引、null) + - 主键:select * from sysconstraints where constrtype = 'P'; + - 约束:select * from sysconstraints where constrtype = 'R'; + - 唯一索引:select * from sysconstraints where constrtype = 'U'; + - Null:select * from sysconstraints where constrtype="N" +- 查看默认值: + - select * from sysdefaults where tabid="xx" +- 查看数据库空间 + - select * from sysdbspaces; +- 查看Chunk + - select * from sysconstraints where constrtype = 'C'; + - select * from syschecks where type = 'T' and constrid = ; + - select first 3 dbsnum, name, pagesize, fchunk, nchunks, is_temp, is_blobspace, is_sbspace from sysdbspaces; +- 查看VP : + - select * from sysvplst; +- 查看物理日志 + - select * from sysplog; +- 查看逻辑日志 + - select * from syslogs; +- 查看会话: + - select * from syssessions; +- 查看用户: + - select * from sysusert; \ No newline at end of file -- GitLab