Quantcast
Channel: SQL Server Database Engine forum
Viewing all 15911 articles
Browse latest View live

SQL Server Database used mainly for Reporting purpose - What are the DBA Tuning Tips

$
0
0
If the SQL Server Database (2014 / 2017) used mainly for Operational Reporting purpose - What are the DBA Tuning Tips you recommend please?

Raghavendra Narayana


DBA related SSRS Reports

$
0
0

what are the reports (SSRS) can create for DBA related activity,

as of now  created

  • Top query cost report
  • Dead locks
  • sql Job historical metrics.
  • Table grow analysis


apart from this any other report can create? 

Potential Worker Thread Starvation - How to diagnose

$
0
0

Hi there everyone,

I'll start by saying I'm somewhat a noob when it comes to SQL, so I apologise in advance! Everything I've done here has been me learning from scratch so by no means am I a DBA.

We have a virtual x64bit Windows Server 2008 R2 running SQL Server 2008 R2 which we have around 40 DB's which are for our bespoke application that's built in house (not by our IT I hasten to add). It also hosts a small number of DB's for Citrix and third party apps.

For the past few months we've had an intermittent degradation of service where the applications slow down to a stop and eventually SQL becomes inaccessible due to timeouts, it usually happens within a 2 hours time frame in the afternoon. Pausing and resuming the MSSQLSERVER service resolves the issue instantly. I got tasked with resolving the issue as an application specialist for the bespoke software we host.

So far I have discovered that during this period we see a large number of processes for these databases enter a SUSPENDED task state with high wait times and they lock with LCK_M_SIX or LCK_M_IX.

I also see a similar amount of processes THREADPOOL also SUSPENDED.

So, I have obviously been looking down the route of Worker Thread Starvation, increasing threads etc etc. I can see the resource monitor during 'normal' periods see threads for SQL settle around 350 and when we see the degradation this 'appears' to sky rocket to 750+ and when I run the following query:

SELECT
cpu_count ,
[max_workers_count],
[scheduler_count],
[scheduler_total_count]
FROM sys.[dm_os_sys_info] dosi

That we only had 3 available threads out of 512, 13 workers waiting for CPU and 1702 requests waiting for threads.
That increases the longer we wait.

During normal periods we have hundreds of available threads and 0 requests.

We *could* increase the maximum worker threads by adding more CPU's but we feel that this isn't the cause and we would just be delaying or masking the actual issue.

The issue I'm having is finding the root cause of the issue, with it being around the same time each time it happens it's either an overlap of requests coming in (We have two 'periods' throughout the day, one morning session one afternoon session, it's possible that the finalisation and start up of these might overlap, this is not something we can avoid).

What we'd like to do is log what's happening around this time to see what could be causing the locking, perhaps there is a single query that could be causing mayhem or resource is being throttled somewhere that we haven't been able to identify.

Also, we see in resource monitor that there's not too much impact there that I can see but I've read a lot about I/O, intra-query parallel deadlocks.

Any help/suggestions/comments are welcome!

Queries consuming high memory

$
0
0

We have some wierd behavior. Several queries are grabbing unusually high amount of memory. Several queries consume over 40GB of memory, causing a backlog of RESOURCE_SEMAPHORE waits. 

production cluster. 
SQL SERVER 2016 SP2 (13.0.5026)

48 CPU

256GB memory, Max memory set to 245GB.

According to sys.dm_os_memory_clerks the MEMORYCLERK_SQLBUFFERPOOL has 156GB available. 

The database in question is 7.5 TB.

login failed error Error: 18056, Severity: 20, State: 46.

$
0
0

Hi 

I am getting below error on our SQL Server

environment: SQL Server 2008 Standard edition SP1 64 bit running on Windows 2008 R2 SP2

Got below error, the applications were not able to access later after restarting the app servers it was able to connects, pls suggest any resolution for below error message

Login failed for user 'xxxx'. Reason: Failed to open the database configured in the login object while revalidating the login on the connection.

The client was unable to reuse a session with SPID 78, which had been reset for connection pooling. The failure ID is 46. This error may have been caused by an earlier operation failing. Check the error logs for failed operations immediately before this error message.

The client was unable to reuse a session with SPID 74, which had been reset for connection pooling. The failure ID is 29. This error may have been caused by an earlier operation failing. Check the error logs for failed operations immediately before this error message.



The client was unable to reuse a session with SPID XX, which had been reset for connection pooling. The failure ID is 23. This error may have been caused by an earlier operation failing.

$
0
0

Hello,

We have a recurring problem with one of our MS SQL Servers (Microsoft SQL Server 2012 (SP1) - 11.0.3128.0 (X64) ).


The error message from the applicatoion log:

 

Event Type: Error
Event Source: MSSQLSERVER
Event Category: (2)
Event ID: 18056

 The client was unable to reuse a session with SPID 94, which had been reset for conection pooling. This error may have been caused by an earlier operation failing. Check the error logs for failed operations immediately before this error message.

Anybody that knows anything why this error occurs?

Regards

Emre 

SQL server Performance issue

$
0
0

Hi All,

we are facing performance issue for production sql server. Its SQL server standard edition.

total database size is 650 GB. usually database backup job will take 2 hrs 45 min but yesterday its took around 4 hrs 55 min and SQL server response is very poor and we have received below error in error message.

last target outstanding: 5360, avgWriteLatency 2219

average throughput:   0.74 MB/sec, I/O saturation: 20416, context switches 33852

FlushCache: cleaned up 47491 bufs with 11799 writes in 499238 ms (avoided 35975 new dirty bufs) for db 8:0

regards,

karthik b

Availability Group Database Backups

$
0
0

Hello Forum

We are using 2014 SQL Server Availability Groups.  One of our previous DBA's has devised a Backup Script which essentially performs Full and Differential Backups on the Primary replica, and TL backup on the Read Only replica.

Is there a way to share the backup history between the replicas, so that if we need to do a PIT restore with the GUI, all backup history is available?


Please click "Mark As Answer" if my post helped. Tony C.


Issues with a Network Share for SQL Server Backups

$
0
0

Hello Forum

As a part of our backup strategy, we are trying to use a Network Share for the SQL Server Backups.

Issue 1, Backups not being created with the Credential

We have a normal Service Account that has the required access and an operating system Proxy mapped to the credential.  When we run a Job to create the backups, it is creating the backups as the SQL Server Service Account and not the Backup Service Account, is there a way to have the  Backups being created as the Backup Service Account?

Issue 2,  SQL Service Account Access Issue

As we are having difficulties with Issue 1, we decided to create a Security Group containing all of the SQL Server Services Accounts (MSA's, GMSA's and native AD Service Accounts).  We then gave this new Security Group permissions to the Network Share.  When we tested the backups it failed due to permissions, however when we assigned the Test Server SQL Server Account to the Share and tested the backups it succeeded.  Does anyone have any idea why this is happening?

Many Thanks


Please click "Mark As Answer" if my post helped. Tony C.

The client was unable to reuse a session with SPID XX, which had been reset for connection pooling.

$
0
0
Hi Guys,


Need your help! We are receiving the below errors more frequently now. When ever we get this error, application gets timeout errors of Server not responding (System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding). 


Here is the configuration of Production server :


Window server 2008 R2 Enterprise X64 bit; RAM:32 GB; Processors: 2 ( 16 Core each); 


SQL Server : SQL Server 2008 R2 Enterprise CU4; Memory 1GB-29GB (max); MDOP=1 (OLTP Server);






I am getting this below error almost every day and it causing failure in the application. 


Error :


2012-02-29 09:00:52.350 Logon        Login failed for user 'XXX'. Reason: Failed to open the database configured in the login object while revalidating the login on the connection. [CLIENT: IP]
2012-02-29 09:00:52.350 spid74       Error: 18056, Severity: 20, State: 46.
2012-02-29 09:00:52.350 spid74       The client was unable to reuse a session with SPID 74, which had been reset for connection pooling. The failure ID is 46. This error may have been caused by an earlier operation failing. Check the error logs for failed operations immediately before this error.


I have researched on the Error a lot, did not find any particular solutions to it. I have found this link where this has been reported as bug to Microsoft, but no resolutions were posted.


 http://connect.microsoft.com/SQLServer/feedback/details/540092/sql-server-2008-sp1-cu6-periodically-does-not-accept-connections 


So is this bug fixed or not ? Can you guys please help me to find the solution.


Please help me!!!!


Thanks

syspolicy_purge_history job connecting to instance under different login

$
0
0

The third step of the job "Erase Phantom System Health Records" is configured to run under the SQL Server Agent Account but it is trying to connect to the instance under the agent account of a different instance. This is being flagged by instance auditing as:

Login failed for user '***'. Reason: Could not find a login matching the name provided. [CLIENT: <local machine>]

However the job itself is not failing. I'm unclear what this job step *actually* executes - i.e. where is the EraseSystemHealthPhantomRecords() module - and why it would be connecting to the instance under the wrong account.

Anyone got any ideas? I've tried dropping and recreating the agent job but that hasn't made any difference.

Procedure stats getting cleared very often

$
0
0

Recent days, in our organisation, we are facing with a strange issue.

Our SQL Server has enough memory(256 GB) and CPU cores. There is no memory pressure(outcome of dm_os_sys_memory is "Available physical memory is high").

Only problem is, the procedure stats sys.dm_exec_procedure_stats is getting cleared very often. Stats doesn't stay even for an hour.

The reason why we need the stats is, it is being collected on daily basis with the help of the DMV dm_exec_procedure_stats. And, our SQL Developers used to do optimization on stored procedures, and once it is done, to know the effectiveness of the tuning activity, a comparison is being done between the collected historical stats and the current one.

Since, the procedure stats is not staying on the cache, we are not able to set any benchmark.

Kindly suggest some solutions.

Version: Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Enterprise Edition: (64-bit) on Windows Server 2012 R2 Standard 6.3 <X64> (Build 9600: )

Cluster fail over internal mechanism

$
0
0
I would like to know the Cluster fail over internal mechanism.

Transaction Log Keeps Growing With No Database Activity - WHY?

$
0
0

Hello,

I recently configured AlwaysOn AG in SQL Server 2017 Enterprise with two nodes with the plans to upgrade our existing environment.  I migrated some of the production databases to this new environment in preparation for testing.  I observed a very strange behavior for one of the databases and specifically the log file - let's called this TestDB_log.ldf.  After I initially added this "TestDB" to the new availability group, the log size was about 50Mb.  That's what it was in Production.  Everything was fine up to here.  After about a week, the "TestDB_log.ldf" had increased to 50Gb which eventually consumed all the log disk space.  So I dropped this database and rebuilt it in the new availability group again.  I started to monitor this log file and noticed the same behavior.  The log file constantly grows many times per day and no one is even logged in or doing any testing yet.  There's absolutely no transactions or records being inserted or updated on this database and yet the log keeps growing.  Why?

Can someone explain this behavior and tell me what I need to do?  My other migrated databases are fine and timestamp on these remain the same and have the date/time of the day I migrated.

Thank you


Event ID 33205 - MSSQLSERVER Logon - What is this??

$
0
0

Hello,

I have recently setup a new SQL Server 2017 Enterprise environment at work.  As part of this setup, I have also configured an "Audit" to track logins.  Upon inspecting Event ID 33205 in Event Viewer, I see lots of logins in SQL Server that I don't understand what it is.  For example, see the below log attached.  For security reasons, I altered the domain name and the sql server name.  This log gets captured in Event Viewer every 5 minutes.  Also why does it show "server_principal_name" being in the format as [DomainName\SQLServerName] with the "$" sign appended to the end?

Can someone explains to me what it means or was there something I didn't setup my environment correctly?

Thank you

-------------

Audit event: audit_schema_version:1
event_time:2018-11-27 19:54:31.9782848
sequence_number:1
action_id:LGIS
succeeded:true
is_column_permission:false
session_id:57
server_principal_id:265
database_principal_id:0
target_server_principal_id:0
target_database_principal_id:0
object_id:0
user_defined_event_id:0
transaction_id:0
class_type:LX
duration_milliseconds:0
response_rows:0
affected_rows:0
client_ip:local machine
permission_bitmask:00000000000000000000000000000000
sequence_group_id:526E4BAC-2B30-4B63-8B3B-57AC9B1099D3
session_server_principal_name:MyDomain\MySQLServer$
server_principal_name:MyDomain\MySQLServer$
server_principal_sid:010600000000000550000000447a1a9ee0235381234a54aa9bd0549c4fcc0642
database_principal_name:
target_server_principal_name:
target_server_principal_sid:
target_database_principal_name:
server_instance_name:MySQLServer
database_name:
schema_name:
object_name:
statement:-- network protocol: LPC
set quoted_identifier on
set arithabort off
set numeric_roundabort off
set ansi_warnings on
set ansi_padding on
set ansi_nulls on
set concat_null_yields_null on
set cursor_close_on_commit off
set implicit_transactions off
set language us_english
set dateformat mdy
set datefirst 7
set transaction isolation level read committed

additional_information:<action_info xmlns="http://schemas.microsoft.com/sqlserver/2008/sqlaudit_data"><pooled_connection>1</pooled_connection><client_options>0x28000020</client_options><client_options1>0x0001f438</client_options1><connect_options>0x00000000</connect_options><packet_data_size>8000</packet_data_size><address>local machine</address><is_dac>0</is_dac></action_info>
user_defined_information:
application_name:SQLServerCEIP
.


What is The Best Practice for Log File Rotation Frequency and Size

$
0
0

Hi All,

I am new to SQL DBA.

Can you please guide me what is the best practice for log file rotation, size etc in production database?

Thanks,

Ramaraju

Optimization Options for quick data load and Index rebuild in SQL Server 2016

$
0
0

Data load for one of the tables in SQL Server is taking around 22-24 hrs and index rebuild is taking4-6 hrs. Below are some additional details about the size and data load process.

  • Table Size: 800 GB
  • Total No. of Indexes: 11
  • No. of Partitions on the Table :50
  • Frequency of Data Load: Monthly Once
  • Data Load Pattern:  Truncate and Load. Disable all Indexes and then rebuild post data load
  • Source System: Teradata
  • Target System: SQL SERVER 2016
  • ETL Tool: AB-Initio

Below are some of the options we have tried already.

For quick data load used (TABLOCK) hint.

For quick indexing we have tried MAXDOP, Sort in tempdb on and Bulk logged recovery model. Due to issues in application end, we are not allowed to use sort in tempdb and bulk logged recovery options.

Please suggest any other optimization options to reduce the time taken for data load and index rebuild process.

Regards,


ETL load process locked by a system query running a create index???

$
0
0

Hi,

I suffered a strange issue during the loading of data using SSIS into a clustered columnstore index table 

SQL 2016 Enterprise edition used.

in the middle of the loading, my insert were locked by a create index command executed by the system ????

it was not a user query or user connection.

its a random behavior I suffered it 2 times in the past 2 months.

any idea of the reason of this?

is the system doing some background tasks on the clustered columnstore index which lock it?

FILESTREAM on Windows XP

$
0
0
Hello,

I've created a Win32 API IO streaming sample for the FILESTREAM support in SQL Server 2008. It runs on Windows Vista, and Windows Server 2008. But unfortunately I'm getting an exception when the constructor of the SqlFileStream class is executed (but only on Windows XP):

InvalidOperationException: "The process cannot access the file specified because it has been opened in another transaction."

StackTrace:
   at System.Data.SqlTypes.SqlFileStream.OpenSqlFileStream(String path, Byte[] transactionContext, FileAccess access, FileOptions options, Int64 allocationSize)
   at System.Data.SqlTypes.SqlFileStream..ctor(String path, Byte[] transactionContext, FileAccess access, FileOptions options, Int64 allocationSize)
   at System.Data.SqlTypes.SqlFileStream..ctor(String path, Byte[] transactionContext, FileAccess access)
   at ADO_Enhancements.Program.FileStreamUploadStreaming() in D:\Klaus\Work\EDS\Conferences\DevWeek London\2009\ADO.NET Enhancements\ADO_Enhancements\Program.cs:line 230
   at ADO_Enhancements.Program.Main(String[] args) in D:\Klaus\Work\EDS\Conferences\DevWeek London\2009\ADO.NET Enhancements\ADO_Enhancements\Program.cs:line 26
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Any suggestions?

Thanks

Klaus Aschenbrenner
http://www.csharp.at/

CPU usage of the database host

$
0
0

Is there a view that exposes the CPU usage of the database host? dm_os_performance_counters is giving out the cpu usage by the sqlserver instance but I am looking for the CPU usage by the overall database host.

-Chinni

Viewing all 15911 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>