sybase数据库常用SQL积累

发布时间:2020-08-04 21:04:15 作者:cg_gavin
来源:ITPUB博客 阅读:111

场景1:user connection配置了1500,数据库日志里面发现报错连接用完,需要定位是哪个机器或用户产生了大量连接

SQL语句:

select * from (select b.name,a.hostname,a.program_name,count(*) counts from master..sysprocesses a,数据库1..sysusers b where a.suid=b.suid group by name,hostname,program_name union select b.name,a.hostname,a.program_name,count(*) counts from master..sysprocesses a,数据库2..sysusers b where a.suid=b.suid group by name,hostname,program_name ) tmp order by counts desc


场景2:查看数据库中运行时间较长的语句

SQL:select datediff(mi,starttime, getdate()) as time , * from master..syslogshold


场景3:查看某个参数的配置

方法一:sp_confiugre "参数名"

方法二:使用下面SQL语句进行查询:

select b.name, c.value,c.memory_used, c.minimum_value, c.maximum_value, c.defvalue,c.unit

from master.dbo.sysconfigures b, master.dbo.syscurconfigs c

where b.config*=c.config and parent!=19 and b.config > 100 and name like '%参数名片段%'

order by name 


场景4:查看参数配置及历史使用情况

--全部配置: sp_monitorconfig 'all'

--单个参数: sp_monitorconfig "参数名"


场景5:查看存储过程使用内存情况

dbcc traceon(3604)

dbcc memusage

dbcc traceoff(3604)


推荐阅读:
  1. sybase部署
  2. mongo 语句积累

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

sql sybase 常用

上一篇:人工智能产业链地图

下一篇:Python学习路线:Python就业指导建议

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》