Get the App
SLTechnology News&Howtos  ›  Database  › 

Common SQL accumulation in sybase database

Shulou Source: shulou.com Published: 2022-06-01 07:44:28 11月13日 Update

Scenario 1:user connection is configured with 1500, and it is found in the database log that the error connection has been used up. It is necessary to locate which machine or user has generated a large number of connections.

SQL statement:

Select * from (select b.name counts from master..sysprocesses a. Hostname where a.suid=b.suid group by name,hostname,program_name a.programmatic name where a.suid=b.suid group by name,hostname,program_name a. Programmatic name where a.suid=b.suid group by name,hostname,program_name count (*) tmp order by counts desc) tmp order by counts desc

Scenario 2: view long-running statements in the database

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

Scenario 3: view the configuration of a parameter

Method 1: sp_confiugre "parameter name"

Method 2: use the following SQL statement to query:

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 parentaries fragment 19 and b.config > 100 and name like'% parameter name fragment%'

Order by name

Scenario 4: view parameter configuration and historical usage

-- full configuration: sp_monitorconfig 'all'

-- single parameter: sp_monitorconfig "parameter name"

Scenario 5: view memory usage of stored procedures

Dbcc traceon (3604)

Dbcc memusage

Dbcc traceoff (3604)

Tags: Parameters scenarios data databases configurations statements situations methods memory individual history logs machines fragments users procedures transportation storage location query Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB vpn Shulou Information Apple Linux