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

Waiting queries

$
0
0
Do waiting queries increase CPU load ? How to reduce wait time of waiting queries ? 

SQL Database Error 924 – Database is already open and can only have one user at a time

$
0
0

In a Java-application I am working on, I have an updater, which updates the db structure whenever a new version is started for the first time. 
This updater is executed in single user mode, to ensure no one is working on the db in the meantime. 
During this update, I have to request meta data and this request sometimes leads to the Error 924. 
This bug occurs only since I upgraded the mssql-jdbc driver to 6.3.3 or later and I therefor opened an issue on theirGithub page
However, during the discussion in this issue, it turned out, that neither the driver nor our code opens a new connection. Even the SQL Server Profiler logs only one connection. 
During my research, I found an article, which states, that SINGLE_USER can only be used if AUTO_UPDATE_ASYNC is turned OFF. That's the case in my database, but since async jobs on the SQL Server seem to cause problems with single user mode, my guess is, that some statements used by the driver to load the meta data (starting with Line 988) are executed asynchronously. This presumption is reinforced by the fact, that the error only occurs, if the database is stored on a HDD drive. On SSD drives everything works fine, which sounds like some kind of race condition. 
Our current workaround for this is to catch this error and retry the statement after 3 seconds, until it works. Usually it takes about 5 retries or 15 seconds.

Is there some setting in the SQL Server I am missing or what else could cause this issue?

Replication- table replication with filter

$
0
0

hi,

we have transactional replication from serverA to ServerB ,  accounttable to accounttable. (publication contains 130 articles).

as of now all columns in accounttable replicated to supscription.

new requirment:  column "Price "@accounttable  in subscriptiondb  needs to update from other table value.  

how can i accomplish  this ?  shall i write another synchronize job to update this column alone or add filler in article property?

this table is high transaction used one . which way is advisable ?

Maintenance Plan

$
0
0

Hi All,

On one of our backup maintenance plan, the DB Backup task is configured to backup & also check the backup integrity.

Our management wants to know if it was added to perform backup integrity when the plan was created or later it was added.

Is there a way to check? If yes, can you please let me know.


error in the log

$
0
0

We recently got message in sql server log like below: 

What could be wrong:

SQL Server has encountered 1 occurrence(s) of I/O requests taking longer than 15 seconds to complete on file [F:\MSSQL\LOG\MBAM Recovery and Hardware_Primary.ldf] in database id 10.  The OS file handle is 0x0000000000001008.  The offset of the latest long I/O is: 0x0000009d303600.  The duration of the long I/O is: 32629 ms.

Message
FlushCache: cleaned up 8690 bufs with 7095 writes in 211148 ms (avoided 5100 new dirty bufs) for db 12:0

Message
average writes per second:  33.60 writes/sec 
            average throughput:   0.32 MB/sec, I/O saturation: 100, context switches 332

SQL Server has encountered 1 occurrence(s) of I/O requests taking longer than 15 seconds to complete on file [F:\MSSQL\LOG\SUSDB_log.ldf] in database id 11.  The OS file handle is 0x0000000000000FF4.  The offset of the latest long I/O is: 0x00000016ac0800.  The duration of the long I/O is: 45448 ms.

Message
last target outstanding: 19200, avgWriteLatency 0

SourceServer

Message
Long Sync IO: Scheduler 3 had 1 Sync IOs in nonpreemptive mode longer than 1000 ms

Message
FlushCache: cleaned up 24141 bufs with 16849 writes in 181911 ms (avoided 25301 new dirty bufs) for db 12:0

Message
average writes per second:  92.62 writes/sec 
            average throughput:   1.03 MB/sec, I/O saturation: 101, context switches 458
Message
last target outstanding: 19200, avgWriteLatency 0

Message
A time-out occurred while waiting for buffer latch -- type 3, bp 000001BDA73F7740, page 1:42954663, stat 0x10b, database id: 12, allocation unit Id: 72057622850764800, task 0x000001BD4C033468 : 0, waittime 300 seconds, flags 0x100000001a, owning task 0x000001BD4AC2D468. Not continuing to wait.

Sourcespid19s

Message
Error: 845, Severity: 17, State: 1.

Message
Time-out occurred while waiting for buffer latch type 3 for page (1:42954663), database ID 12.

 

Message
A time-out occurred while waiting for buffer latch -- type 3, bp 000001BDA73F7740, page 1:42954663, stat 0xb, database id: 12, allocation unit Id: 72057622850764800, task 0x000001B109AE48C8 : 0, waittime 300 seconds, flags 0x100000001a, owning task 0x000001BD4AC2D468. Not continuing to wait.

Message
One or more recovery units belonging to database 'ourdbname' failed to generate a checkpoint. This is typically caused by lack of system resources such as disk or memory, or in some cases due to database corruption. Examine previous entries in the error log for more detailed information on this failure.


Message
A time-out occurred while waiting for buffer latch -- type 3, bp 000001BDC780B580, page 1:42954644, stat 0xb, database id: 12, allocation unit Id: 72057622850764800, task 0x000001BD4C043088 : 0, waittime 300 seconds, flags 0x100000001a, owning task 0x000001BD4AC0CCA8. Not continuing to wait.


Thanks

How to download SQL server 2016 enterprise edition ?

$
0
0

Hi All,

Good Day!!

we need to download SQL server 2016 Enterprise edition media file for one of application and we have enterprise edition license key but we are unable to find the Media download link. please help me to provide the download link...


RAM

General index question

$
0
0

Just a general question on indexes. If sql server lists the following indexes as missing indexes, should you create both index one and index two, or just index two?    With it being the same 3 initial columns, I would think you would just create index two.

 

columns for recommended index one

AAA

BBB

CCC

columns for recommended index two

AAA

BBB

CCC

DDD

Non -Yielding scheduler errors on server 2012 r2, sql server 2014

$
0
0

From our Windows Clustering end, we have analysed and observed RHS deadlock events in the below logs from the cluster  :

 

00012bc.000012d4::2019/11/03-05:36:27.467 INFO  [RHS] Enabling RHS termination watchdog with timeout 1200000 and recovery action 3 from source 5.

000012bc.000012d4::2019/11/03-05:36:27.467 ERR   [RHS] Resource Cluster Name handling deadlock. Cleaning current operation and terminating RHS process.

000012bc.000012d4::2019/11/03-05:36:27.467 ERR   [RHS] About to send WER report.

System logs , found event ids 1069,1146,1230, found bugcheck 9e

Application logs : found non-yielding scheduler 17883 event ids.

We do observed that during the backups , we are getting deadlock and non-yielding scheduler errors at the same time. Backup jobs failed.

During the weekend, backup jobs are running around 5am - 6am , errors are observing during those time frame.

rhs deadlock error are also observed in cluster log. have increased the deadlock timeout value from 300000 to 600000

But still observing non-yielding scheduler errors on sql server ,This issue seem to happening when the bare metal backup from backup and storage solution cohesity is running.

Could you please look into this.


swathi


SQL Health Check

$
0
0

We have consistent issues with a specific SQL Server Instance every third week of the month, could you please review the screenshots below and advise


Kiran

How to report on locked objects or files in the database?

$
0
0

In my company's instance of SQL Server Management Studio 2014 we sometimes get locked objects within our database. This causes problems the most serious of which require an IIS Reset after clearing C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root

We would like to avoid resetting IIS altogether so I am open to suggestions that anyone may have.

What is a good solution that we can implement to avoid locked objects and/or be notified of object locking?

intra-query deadlocking

$
0
0
As we continue migration from SQL2012 to 2016 we are increasingly seeing deadlocking on our databases.we set the compatibility level to 120 (SQL 2014).  After this change we no longer see any deadlocks.  Unfortunately, none of these solutions are acceptable long-term in our production environment as we are essentially forcing the use of old technology in the case of SQL 2014 compatibility level.

To briefly summarize, we are experiencing  intra-query deadlocking on relatively simple read-only select queries.  It seems that this was a bug that was fixed in one of the earlier CU's for SQL 2016.  We updated to the latest CU and are still experiencing the intra-query deadlocking bug.

Kiran

BmkToPage - Intrinsic FunctionName in Compute Scalar

$
0
0

What is the BmkToPage (Intrinsic FunctionName) in the Compute Scalar operator that follows a nonclustered index seek and precedes the RID Lookup?

It does not seem to occur for unique indexes (single key) or in smaller tables. The presence of this about doubles the cost of the query

Below is the XML detail inside the Compute Scalar

Note: 

I am not trying to suppress the RID Lookup. The nonclustered index of a heap table has the full file and row id to find the data page. There should not a be function call.

Below is an index seek to the same table, but referencing a unique index

below is an index seek to an identical but smaller table using a non-unique index



jchang



Slow query processing

$
0
0
We currently have an ETL job hat runs at night. This Job is taking longer to complete than it normal does. We are not seeing any CPU or Memory or blocking issues, need some help troubleshooting the issue.

Kiran

Getting error 'Invalid window handle' in SSMS when trying to edit a table

$
0
0

Version of SSMS is v18.4 (latest available)

Version of SQL server is 13.0.5101.9

Was getting similar errors on earlier versions of SMSS so downloaded and installed the latest and still have the issue.

Always On (HA) Active - Active ?

$
0
0

Hello,

Can SQL Cluster, with 2 nodes both be Active/Active with Always On HA setup   ?

I'm trying to figure out can both nodes  have read/write on databases  or will only 1 node have read/write and other is read?

Thanks,

Veena Srinivas


achieving synchronized behavior between powershell and sql

$
0
0

Hi we run 2017 std. I'm experimenting with scheduling software that is plumbed to sql thru powershell (ps).

The powershell command for each "job" looks like this ...

Invoke-Sqlcmd-ServerInstance$SQLServer-Database$Database-Query$ExecAgent

...and $ExecAgent is a string that looks like this "exec dbo.sp_start_job N'...". 

I was disappointed (not in sql, more myself) to see that these calls are asynchronous, ie ps isnt made to wait for the started sql agent job to finish.  That's a problem if job "b" depends on completion of job "a" before it starts.  Is there a more synchronous way of starting up sql agent jobs, one that doesn't require a lot of extra coding?  

Error during Pre Login Handshake when connecting to SQL instance

$
0
0

Hey everyone, 

Hoping for some guidance. Quest Spotlight was generating an error this morning saying that it could not connect to one of my SQL instances. I was able to connect to that SQL Instance in question when connecting from my desktop via Mgmt Studio. When I logged into the Server that houses the SQL Instance with Spotlight installed, I attempted to use the local mgmt studio to connect to the SQL instance that spotlight was identifying as having issues. I encountered the following error:

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) (.Net SqlClient Data Provider)

SQL Instance in question that is encountering errors is running version 10.50.4042.0

The SQL Instance running spotlight is running version 13.0.5081.1.

I've only started encountering this issue this morning. This has never happened before. Any help would be greatly appreciated. 

Get error connecting by ip address, but host name works but only for one database on same server.

$
0
0

We have a .net application that connects to 2 databases on a server.

The connection to the main application database is working by both IP and hostname using .Net provider in the connection.

But, the other database, which needs to use the       Provider=SQLNCLI10;DataTypeCompatibility=80 would not connect by IP address but did connect by hostname. (this is because of COM api we have to use)

usually IP is solid to connect and the issue is by hostname, but not this case, started working when changing to hostname, i only did this as a trial and error. I have no idea why? Can someone shed light on what to look at so that I can verify that other customers will not have the issue. 

The error received connecting by IP address:

client unable to establish connection because an error was encountered during handshakes 

One thing I noted is that it is SQL Server 2008 (no service packs) - most our clients are upgraded to 2014, but this one was not.

I have looked around the SQL network configuration tool but don't really know what to look for.  Can anyone give some insight on what would cause this?


Big difference between SQL trace execution duration and duration in application log

$
0
0

There is SQL Server 2012, and the server have database with some stored procedures. One of the procedures returns data. Typically the procedure returns between 1-2 rows (most often case) to several hundreds of rows. The procedure is being called by an application, which is located on another server. Each call of the stored procedure is logged, log include start of execution, end of execution and its duration.

Some time ago, looking at the log, it was found what the stored procedure sometimes execute quite slowly. Its typical execution time is 2-3 ms, but sometimes it execute 2-3 seconds. SQL trace, server side, was started on SQL Server to check what is happening. 

Next, it was found what for nearby all such cases, when application log big duration, sql trace shows small execution time, like 2-3 ms in SQL trace. It looks quite strange.

In order to check where is delays, on server with SQL Server was configured and started Wireshark, to log all network traffic to find where is delays.

What it shows (one of examples):

SQL Trace:
Call - 03:45:01.327
Response - 03:45:01.327
Diff = 0

Wireshark:
Call - 09:42:53.384452
Response - 09:42:55.849946
Diff = 2.465494

So, based on Wireshark data, network packet with data from the query was send nearby 2 seconds later than it was reported by SQL trace.

What can be root cause?

I thought about slow data retrieval by application, but I not see async_network_io at that time.

server principal...is not able to access the database...under the current security context

$
0
0

Hi we run std 2017.  I'm switching a non expiring userid away from executing scheduled powershell->sp_start_job->ssis over to scheduled powershell->proc->ssis.

under my creds no problem running the ps script from the server where the ps script resides.  Under the non expiring userid (run from further upstream but executing this same ps script on the same ps server) there is a problem so I assumed if I recreate a similar proc with execute as 'domain\user' I can recreate the problem on ssms (if its a sql problem).  i'm trying to impersonate the non expiring userid and working my way backward.  i'm executing the proc on ssms.

The userid is already added to the two db's (TEST and SSISDB) mapped to the login and grant execute on all 4 procs in the respective db's to the user was run.  I assumed chaining would stop the userid when the db and schema changed from TEST.dbo to SSISDB.catalog.

I get the error on ssms shown below.  I'm not even sure if this is a valid way to impersonate.  I have admin rights on the sql server.  I have no idea what this error means.  But would have thought with a user mapped to the login, the user would have access to the db TEST.

The server principal "domain\user" is not able to access the database "TEST" under the current security context.

USE [TEST]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[runssispackage2]
	-- Add the parameters for the stored procedure here
	@folder varchar(1000),
	@project varchar(1000),
	@package varchar(1000)--,
	with execute as 'domain\user'
AS
BEGIN
	
	SET NOCOUNT ON;
	declare @execution_id bigint
    exec ssisdb.catalog.create_execution 
	     --there are other params but these dont have a default
         @folder 
        ,@project 
        ,@package 
        ,@execution_id = @execution_id output
     EXEC [SSISDB].[catalog].[set_execution_parameter_value]  
          @execution_id 
         ,@object_type = 50						-- System parameter , 50 is used for various types of calls
         ,@parameter_name = N'SYNCHRONIZED' 
         ,@parameter_value = 1 
     exec ssisdb.catalog.start_execution @execution_id
     IF 7 <> (SELECT [status] FROM [SSISDB].[catalog].[executions] WHERE execution_id = @execution_id) 
      RAISERROR('The package failed. Check the SSIS catalog logs for more information', 16, 1) 


END
GO

  

Viewing all 12963 articles
Browse latest View live


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