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

SQL Profiler + Duration + ASYNC_NETWORK_IO wait

$
0
0

Hi,

From my understanding the duration in SQL profile includes
- The time from when the query starts executing until the last result set buffer completed.  
- Blocking
- The time the client application takes to consume results that require more than one roundtrip

Q1
Is this correct ?

Q2
Is there a way to determine only the time the query is executed and data retrieved from SQL and do not include the time spent on ASYNC_NETWORK_IO ?


Deadlocks

$
0
0

A transaction which performs select on sysobjects is being deadlocked by a alter index statement.

Queries involved:

select OBJECTPROPERTY(id,'TableHasPrimaryKey') from sysobjects where id = 'x';

ALTER INDEX [l_LOC_1234_type] ON [dbo].[LOCATION] REBUILD WITH (ONLINE=ON …

How can this be avoided. Could someone help.

<objectlock lockPartition="6" objid="18099105" subresource="FULL" dbid="6" objectname="DB1.dbo.LOCATION" id="lock8489077600" mode="Sch-M" associatedObjectId="18099105">
    <owner-list>
     <owner id="process2631848" mode="Sch-M"/>
    </owner-list>
    <waiter-list>
     <waiter id="process264f468" mode="Sch-S" requestType="wait"/>
    </waiter-list>
   </objectlock>
   <keylock hobtid="281474978938880" dbid="6" objectname="DB1.sys.sysschobjs" indexname="clst" id="lock3b7303f300" mode="U" associatedObjectId="281474978938880">
    <owner-list>
     <owner id="process264f468" mode="S"/>
    </owner-list>
    <waiter-list>
     <waiter id="process2631848" mode="X" requestType="convert"/>

SET LOCK_TIMEOUT is ignored

$
0
0

Hi,

I have a stored procedure aimed to verify a main table is not locked. Here is the code:

BEGIN TRY
SET LOCK_TIMEOUT 1000
BEGIN TRAN
INSERT INTO Session(SessionID,SrvID,MachineName,LoginName,DomainName)
SELECT NEWID(),NEWID(),'Test','Test','Test'
ROLLBACK
SELECT @IsLocket = 0  
END TRY
BEGIN CATCH
ROLLBACK
SELECT @IsLocket = 1
END CATCH

First resource wait is lock.

In profiler I see many calls for this SP with duration of exactly 15 seconds (14.99-15.01).

How can it be?
The duration should not be more then 1 second.

install 'microsoft.sqlserver.smo, version=13.0.0'

$
0
0

Hi

How to install 'microsoft.sqlserver.smo, version=13.0.0' on server with SQL Server 2014 and 'microsoft.sqlserver.smo, version=12.0.0' ?

We have installed a 3rd party tool and this is not working on some servers with SQL 2014/SMO V12 with this error:

Could not load file or assembly 'microsoft.sqlserver.smo, version=13.0.0'

Best regards


Mohamed B.

database performance degradation

$
0
0

On 20/11 starting from 8:00 A.M the application got "Timeout expired"  error messages.

We noticed database performance degradation.

The DB was up, accepting connections but most of the queries (on different tables) were running very slow. (e.g: 3 minutes instead of several seconds)

During this time, the CPU was less than 40%, memory was stable ~ 85%.

There were no locks, nor load on the database.

 

The problem was solved after restarting the SQL Service.

No error messages detected in the Cluster, the virtual host, SQL logs and in the server event viewer.

 

Please guide us how can we find the root cause of the problem,

how to avoid it, and what else can we check if we hit the same problem again.

 

Configuration

==========

WIndows cluster on hyper-V

 

OS Name: Microsoft Windows Server 2016 Standard

OS Version: 10.0.14393 N/A Build 14393

Each cluster server has 16 CPU, 64G Ram

SQL Server version: Microsoft SQL Server 2017 (RTM-CU11) – 14.0.3038.14


Kiran

Sql server takes several minutes to update few rows in a table

$
0
0

Hello

We are using SQL server 2017

Microsoft SQL Server 2017 (RTM-CU15) (KB4498951) - 14.0.3162.1 (X64)   May 15 2019 19:14:30   Copyright (C) 2017 Microsoft Corporation  Standard Edition (64-bit) on Windows Server 2016 Standard 10.0 <X64> (Build 14393: ) 

On IOs Windows server 2016 - 64 bit - dual processor @ 2.4 GHz - 64 GB RAM

Currently from task manager we have Memory used 93 % out of which 51 GB used by SQL.

C drive has 4.99GB free out of 49.99 GB.

SQL server memory options has values 0 as minimum and 2147483647 MB as maximum.

Whenever we try to do update on a certain table that has around 550,000 records and 1 GB size

, it takes several minutes for simple update to be executed and causes the whole sql to become busy and we start getting timeout expired on webpages in our website.

This table is used by several views and queries running on website.We did rebuild all indexes over this table and views using it since fragmentation percentage was high, but it didn't solve the problem.

It is the main source of info for our website.

What might be the reason of such behavior ?

polybase not installed per sp_configure

$
0
0

Folks:

I am trying to get polybase (standalone) working on SQL Server 2019 developer edition so I can play with it.  I went through the install experience - adding the feature.  The three databases (DWConfiguration, DWDiagnostics and DWQueue) were created.  The two services  (SQL Server PolyBase Engine (JWF) and SQL Server PolyBase Engine (JWF)) were also created and are running.  JWF is my instance name.  It is the only instance installed on the machine. 

I created the master key, and verified that TCP/IP is enabled.  

The next step it to: exec sp_configure 'polybase enabled', 1; which I do.  I get an error message "PolyBase feature is not installed. Please consult Books Online for more information on this feature.".  Further - if I select serverproperty('IsPolyBaseInstalled') as IsPolyBaseInstalled; I get 0 returned. 

Obviously I have missed a step.  I have been over the documentation (specifically https://docs.microsoft.com/en-us/sql/relational-databases/polybase/polybase-installation?view=sql-server-ver15)  I can't figure out what I missed. 

Any help would be very appreciated.


John

Installing package with sqlmlutils on SQL 2019 RTM causes DBCC CHECKDB to fail

$
0
0

I noticed that if I use sqlmlutils to install Python package and run DBCC CHECKDB I get an error:

Msg 8992, Level 16, State 1, Line 1
Check Catalog Msg 3851, State 1: An invalid row (class=128,depid=<LibraryID>,depsubid=0) was found in the system table sys.syssingleobjrefs (class=128).


Removing the installed package gets things back into normal - so it might be caused by DBCC CHECKDB not fully "understanding" what's going on.

At the same time installed module can be found by SQL Python runtime for limited period of time (possibly an period of inactivity) after which the script that requires installed module fails with:

An external script error occurred: 

Error in execution.  Check the output for more information.
Traceback (most recent call last):
  File "<string>", line 5, in <module>
  File "C:\ProgramData\MSSQLSERVER\Temp-PY\Appcontainer1\<GUID>\sqlindb_0.py", line nn, in transform
    from xxx import YYY
ModuleNotFoundError: No module named 'xxx'

SqlSatelliteCall error: Error in execution.  Check the output for more information.
Package is still visible in sys.external_libraries and exists in C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\ExternalLibraries

Installing the package via pip install directly seems to be working just fine (no entries that confuse DBCC CHECKDB) and SQL Pyhton runtime finds the modules every time.

The issue was first reported on GitHub and it was suggested to be more appropriate here.



SQL Permissions help

$
0
0
Hi All,

Need help on SQL Server permissions.

For example) demologin is my login. I want to give a permission to demologin so that he can change owner of any SQL Agent Job. So, is there a specific permission to accomplish this?

Thanks,

Sam

how to segregate table from blockings

$
0
0

hi

below commands blocks one another , both are using same table  "marketplace_items " .

merge , update happen on same table with deferent SP,

how to segregate this process to prevent from blocking?


Query 1  SPID- 171  (merge)


<?query --
with e as (
select *,row_number()over(partition by sku order by sku) row from #tmp
), f as (
select * from e where row = 1
)
merge into marketplace_items as target
using f as source on source.sku =target.sku and target.marketplace_id =6 
when matched then
update set 
confirmed=getdate(),
confirmed_price=case when isnumeric(source.price)= 1 and source.price not like '%[a-z]%' then source.price end,
confirmed_status=left(source.[PUBLISH STATUS],500),
confirmed_status_reason =left(source.[STATUS CHANGE REASON],1000),
confirmed_category = left(source.[PRODUCT CATEGORY],500),
confirmed_qty=case when isnumeric(source.[INVENTORY COUNT]) =1 then source.[INVENTORY COUNT] end,
confirmed_ref_code=left(source.WPID,500),
confirmed_ref_number=source.[ITEM ID],
confirmed_upc=source.UPC,
confirmed_shelf=left(source.[SHELF NAME],500),
confirmed_shelf_path=left(source.[PRIMARY CAT PATH],500),
confirmed_reviews=case when isnumeric(source.[REVIEWS COUNT]) =1 then source.[REVIEWS COUNT]  end,
confirmed_rating=case when isnumeric(source.[AVERAGE RATING]) =1 then cast(source.[AVERAGE RATING] as money) end,
confirmed_searchable=left(source.[SEARCHABLE?],500),

status= left(source.[LIFECYCLE STATUS],500),
response_message=left(source.[STATUS CHANGE REASON],500);
--?>


Query 2  SPID- 170  (update)
  

<?query --
update i set 
last_posted_qty = t.qty,
last_posted_qty_feed = t.feed,
last_posted_qty_ts = getdate()
from marketplace_items i join #tmp t on t.id = i.id
--?>



Query 3  SPID- 172 (update)


<?query --
UPDATE marketplace_items SET confirmed_leadtime=@p0,confirmed_leadtime_ts=@p1 WHERE ID = @id
--?>

Sql Server Agent - Multi-Server Administration using MSX/TSX

$
0
0

Hi,

I have problem with target server (MSX/TSX).There are 2 instance master with default port (1433) and target server with non-default port (1986).Firewall or antivirus is off in both of the servers. And i wanna add target server to master with Master Server Wizard. But i encounter with the error  (The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) (mscorlib))

I check all of resolving methods (in regedit) of RPC server is unaviable.

Please help me with this problem.How can i solve it?

in search of a date range overlap index

$
0
0

Hi we run 2017 STD. You can see at https://social.msdn.microsoft.com/Forums/en-US/4526e7e8-6c35-47e4-b81e-fa7a82e59839/looking-for-a-technique-to-make-date-range-joins-perform-better?forum=sqldatabaseengine that we have done a pretty good job of dealing with these kinds of things in the standard ways but I have to believe there is a better way.  Especially when other columns like machine and location aren't there to help performance.

To me the standard pattern (there are variations that include ='s) for recognizing date range overlaps is shown in the code block.  The 2 variables could just as easily be two columns on a retrieved "anchor" record that is being joined to the target table. 

Is there a genius out there who can see a way of getting right at the "target" overlaps without the overhead of index scans?  Maybe as 2 separate indexes on start and end whose intersection sql can resolve dynamically in an instant?

I think about column stores but since times are involved I suspect performance would be terrible.  And I don't like just straight select performance from column stores when the whole table needs to be retrieved.

@lowDT  < target.end_time and
@highDT > target.start_time

 

 

How many ways troubleshoot tempdb full issues

$
0
0
How many ways troubleshoot tempdb full issues

PerfLib 2.0 counter removal failed with exit code 2. Command line: C:\WINDOWS\system32\unlodctr.exe /m:hkengperfctr.xml from directory C:\Program Files\Microsoft SQL Server\120\Shared\.

$
0
0

This has been frustrating me for weeks. I have had sql 2014 on my machine since I installed it over a year ago. Why does it now blow up on me. I cannot reinstall it. Every time the Dabase Engine Services and SQL Server Replication fails. Everything else installs.  How do I get this to work?   How can I show you the detail.txt file ? I don't think I can paste it into there. I tried already. Will it work?

TITLE: Microsoft SQL Server 2014 Setup
------------------------------

The following error has occurred:

PerfLib 2.0 counter removal failed with exit code 2. Command line: C:\WINDOWS\system32\unlodctr.exe /m:hkengperfctr.xml from directory C:\Program Files\Microsoft SQL Server\120\Shared\.

For help, click: http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft%20SQL%20Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=12.0.2000.8&EvtType=0x590D6427%25400x24BDAA65%25401260%25401

------------------------------
BUTTONS:

OK
------------------------------

(01) 2019-12-18 23:28:34 Slp:     HResult : 0x84ec0001
(01) 2019-12-18 23:28:34 Slp:         FacilityCode : 1260 (4ec)
(01) 2019-12-18 23:28:34 Slp:         ErrorCode : 1 (0001)
(01) 2019-12-18 23:28:34 Slp:     Data:
(01) 2019-12-18 23:28:34 Slp:       Action = removal
(01) 2019-12-18 23:28:34 Slp:       ReturnCode = 2
(01) 2019-12-18 23:28:34 Slp:       ProcessName = C:\WINDOWS\system32\unlodctr.exe
(01) 2019-12-18 23:28:34 Slp:       ProcessArgs = /m:hkengperfctr.xml
(01) 2019-12-18 23:28:34 Slp:       WorkingDir = C:\Program Files\Microsoft SQL Server\120\Shared\
(01) 2019-12-18 23:28:34 Slp:       WatsonData = Microsoft.SqlServer.Configuration.XTP.LodCtrFailedException@1
(01) 2019-12-18 23:28:34 Slp:       SQL.Setup.FailureCategory = ConfigurationFailure
(01) 2019-12-18 23:28:34 Slp:       WatsonConfigActionData = REPAIR@CONFIGNONRC@SQL_ENGINE_CORE_CNS
(01) 2019-12-18 23:28:34 Slp:       WatsonExceptionFeatureIdsActionData = System.String[]
(01) 2019-12-18 23:28:34 Slp:     Stack:
(01) 2019-12-18 23:28:34 Slp:         at Microsoft.SqlServer.Configuration.XTP.HkPerfCtrConfigurationPrivate.AddRemovePerfLib2Counters(Boolean register, Boolean shouldThrow)
(01) 2019-12-18 23:28:34 Slp:         at Microsoft.SqlServer.Configuration.XTP.HkPerfCtrConfigurationPrivate.Repair(ConfigActionTiming timing, Dictionary`2 actionData, PublicConfigurationBase spcb)
(01) 2019-12-18 23:28:34 Slp:         at Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.ExecuteAction(String actionId)
(01) 2019-12-18 23:28:34 Slp:         at Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.Execute(String actionId, TextWriter errorStream)
(01) 2019-12-18 23:28:34 Slp: Watson Bucket 2






SQL Time out

$
0
0

Hi,

we have one production database which is 700 GB.

Through Microsoft dynamics jobs were running and connecting to these dbs. This job is scheduled at 9pm every night. The job will run for 30 min after it stops executing. In the dynamics logs we able to see below error.

the following sql error was unexpected: execution timeout expired. The timeout period elapsed prior to completion of the opeartion or the server is not responding.\program returned error database connectivity.

I dont see disconenctivity in sql server logs. or anykind of timeoput error message in the db logs. But in application dynamics logs we see the above error message.

I enabled sql server browser,remote time out setting to 0 in sql server connectivity properties. but still the issue same. some days the job runs with any issue. But some days this error comes frequently.

I am not into dynamics. Please can anyone suggest me what else i can see in the SQL db aspect. any blocking or deadlock happening during the time timeout error in application?

anything else i need to check in sql db?

Thanks,

Jo


pols


EXCEPTION_ACCESS_VIOLATION when rebuilding a FILETABLE

$
0
0

In our system we have a file table, since we experience some slowness, we tried to rebuild the table using the statement:

alter table [table_name] rebuild with (online=off) 

and this caused EXCEPTION_ACCESS_VIOLATION and memory dump from SQL server process.

The table has ~2000 records with small files only, the EXCEPTION_ACCESS_VIOLATION happened in different environments, also production environment and it happened with SQL 2016 CU5 and also with SQL 2016 CU10.

Does anyone experienced similar errors?

below header of the memory dump:

====================================================================                                            
                                                                                                                
This file is generated by Microsoft SQL Server                                                                  
version 13.0.5492.2                                                                                             
upon detection of fatal unexpected error. Please return this file,                                               
the query or program that produced the bugcheck, the database and                                                
the error log, and any other pertinent information with a Service Request.                                       
                                                                                                                
                                                                                                                
Computer type is Intel(R) Xeon(R) Platinum 8180 CPU @ 2.50GHz.                                                   
Bios Version is INTEL  - 6040000                                                                                
PhoenixBIOS 4.0 Release 6.0                                                                                     
8 X64 level 8664, 2 Mhz processor (s).                                                                          
Windows NT 6.2 Build 9200 CSD .                                                                                 
                                     
Memory                               
MemoryLoad = 31%                     
Total Physical = 36863 MB            
Available Physical = 25297 MB        
Total Page File = 36879 MB           
Available Page File = 24523 MB       
Total Virtual = 134217727 MB         
Available Virtual = 134161220 MB     
***Stack Dump being sent to D:\SQLServer\MSSQL13.MSSQLSERVER\MSSQL\LOG\SQLDump0001.txt                           
SqlDumpExceptionHandler: Process 309 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is
 terminating this process.                                                                                      
* *******************************************************************************                                
*                                                                                                               
* BEGIN STACK DUMP:                                                                                             
*   12/19/19 17:15:40 spid 309                                                                                  
*                                                                                                               
*                                                                                                               
*   Exception Address = 00007FFC5E3255E0 Module(sqlTsEs+00000000004355E0)                                        
*   Exception Code    = c0000005 EXCEPTION_ACCESS_VIOLATION                                                     
*   Access Violation occurred reading address 0000000000000000                                                   
* Input Buffer 164 bytes -                                                                                      
*               alter table [SIT_UA_tmp].[dbo].[SYS_ENTITY] rebuild with (O                                      
*  NLINE=off)                                                                                                   
*                                                                                                          

Database restoration in Cloud

$
0
0

Hi Experts,

Can you please help with any data which talks of the time taken for restoring a SQL Database on an Azure VM say x size of database backup with y compute size of Azure VM , would take around z hours for restoration.

Similarly with x size of database backup with a compute size , would take around a hours for restoration. 

Thanks

Log_reuse_wait_desc = ACTIVE_TRANSACTION

$
0
0

Hello,

I've a SQL Server 2016 - 130.4411 Standard Edition.

I've a database log that keeps filling up (log is 250GB), select log_reuse_wait_desc from sys.databases says that the log can't be reused because of "active_transacion".

One thing I'm missing is that a query on sys.dm_tran_database_transaction, summing the column database_transaction_log_bytes_used I've very few kilobytes used, so I can't say which transactions are guilty for the log that keeps filling up.

Any help is appreciated

SQLServer 2019 - CREATE EXTERNAL FILE FORMAT error

$
0
0

All,

I received the below error when I ran the script on SQLServer 2019 Developers Edition. has anyone got this error before?

OLE DB provider "MSOLEDBSQL" for linked server "(null)" returned message "Cannot generate SSPI context".
Msg -2146893042, Level 16, State 1, Line 10
SQL Server Network Interfaces: No credentials are available in the security package


CREATE EXTERNAL FILE FORMAT TextFileFormat WITH
(
FORMAT_TYPE = DELIMITEDTEXT,
FORMAT_OPTIONS 
(
FIELD_TERMINATOR = N',')

access restriction

$
0
0

Hello,

we are using SQL Server 2016. Our requirement is to restrict DBA account from selecting or updating any user data.

DBA accounts have sysadmin privilige.

Please help how to restrict.

Thanks




Viewing all 12963 articles
Browse latest View live