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

How to resolve PAGE LOCK Deadlock situation in SQL SERVER 2008 SP2

$
0
0

Hello Experts,

Can someone please help me in resolving the below deadlock situation:

I ran DBCC TRACEON(1222,-1) and suppressed the results as below: But i am unable to conclude what could be the problemhere: Please help:

   deadlock victim=process5e27048   process id=process5e27048 taskpriority=0 logused=480 waitresource=PAGE: 11:1:100919 waittime=2682 ownerId=822500103 transactionname=user_transaction lasttranstarted=2015-05-28T09:47:56.413 XDES=0x2e9b3d970 lockMode=U schedulerid=4 kpid=15300 status=suspended spid=962     frame procname=abcsyss.dbo.xAAccessLog_Update_KBTech line=1 stmtstart=848 stmtend=1618
  sqlhandle=0x03000b00f8bdf00cbba2d100e1a300000000000000000000
  UPDATE
  [access] set [accessdate] = [accessdate] 
  WHERE [userid]%%=%%@1 AND [companyid]%%=%%@2 AND [databasename]%%=%%@3
  AND [internetaddress]%%=%%@4 AND [sessioncntr]%%=%%@5 AND [tstamp]<=@6     
  update
  access set accessdate=accessdate  where
  userid= 'mathy.rod' and companyid= '31' and databasename=
  'ABCAPP' and internetaddress= 'werRDP-Tcp#10' and
  sessioncntr=14  and tstamp <=
  0x0000000000cba6c3 process id=process5e3b288 taskpriority=0 logused=716 waitresource=PAGE: 11:1:100914 waittime=2491 ownerId=822496200 transactionname=user_transaction lasttranstarted=2015-05-28T09:47:56.043 XDES=0x15a0cce90 lockMode=U schedulerid=6 kpid=11996 status=suspended spid=851      frame procname=abcsyss.dbo.xAAccessLog_Delete_KBTech line=1 stmtstart=464 stmtend=1984
  sqlhandle=0x03000b008675080bec98d100e1a300000000000000000000
  DELETE
  [access]  WHERE [userid]%%=%%@1 AND
  [companyid]%%=%%@2 AND [databasename]%%=%%@3 AND [internetaddress]%%=%%@4 AND
  [sessioncntr]%%=%%@5     
  delete
  access where userid= 'WILLI.GOW' and companyid= '81' and databasename=
  'ABCAPP' and internetaddress= 'TPRDP-Tcp#2' and
  sessioncntr=10     


  Text


       waiter id=process5e3b288 mode=U requestType=wait      waiter-list     owner
  id=process5e27048 mode=X    owner-list   pagelock fileid=1
  pageid=100914 dbid=11 objectname=abcsyss.dbo.xAAccessLog
  id=lock334291b80 mode=X associatedObjectId=72057594089570304     waiter
  id=process5e27048 mode=U requestType=wait    waiter-list     owner
  id=process5e3b288 mode=X    owner-list   pagelock fileid=1
  pageid=100919 dbid=11 objectname=abcsyss.dbo.xAAccessLog
  id=lock37d944a00 mode=X associatedObjectId=72057594089570304


NULL Value in Client_Net_Address & Local_Net_Address

$
0
0

Dear Sir,

When I am executing Query

SELECT * FROM SYS.DM_EXEC_CONNECTIONS 

then it displays NULL Value in Local_Net_Address and Client_Net_Address Fields.

Is any one tell why this problem is arising ?

Sanjay Shah

SQL SERVER SYMMETRIC KEY SECURITY ISSUE

$
0
0

I've got a DB in which i need to store the encrypted values for a column. I use the SQL Server encryption format for encryption. The format is as follows:

CREATE MASTER KEY ENCRYPTION BY PASSWORD 'dsagfdsagv418515adsf' CREATE CERTIFICATE 'CERTIFICATE_NAME' CREATE SYMMETRIC KEY 'KEY_NAME' WITH ALGORITHM = AES_256 ENCRYPTION BY CERTIFICATE 'CERTIFICATE_NAME';

Now I am able to encrypt and decrypt the column, using EncryptByKey and DecryptByKey functions resp.

Now I see a security threat here in a way, that the SYMMETRIC KEY is visible to DBA and other DB Users. They can always decrypt that column using the key anytime they want. This is not feasable in my application. Can someone please suggest what can be done to safeguard this key?

Error 32 When Restoring Database

$
0
0

I'm attempting to restore a SQL Server 2008 R2 backup into a SQL Server 2014 database WITH MOVE but am encountering the following error:

The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'E:\Intuitive8.7Data\iERP87_Data.mdf'.

Following is the code I'm using attempting to accomplish this:

USE Master
GO

ALTER DATABASE iERP87 SET OFFLINE WITH ROLLBACK IMMEDIATE;

RESTORE DATABASE [iERP87]
FROM DISK = N'E:\Temp\iERP81_2008.bak'
WITH
MOVE N'Production70_Data' TO N'E:\Intuitive8.7Data\iERP87_Data.mdf',
MOVE N'Production70_Log' TO N'E:\Intuitive8.7Log\iERP87_Log.ldf',
NOUNLOAD, REPLACE, STATS = 10

ALTER DATABASE iERP87 SET ONLINE WITH ROLLBACK IMMEDIATE;

As a result of searching on-line for help I have user "Process Explorer" to look for processes using the mdf file without finding any and have rebooted the server to ensure there are no other open connections.

I've run out of ideas on this one.  Any help would be most appreciated.

sys.spt_tables_info_view is being blocked

$
0
0
Hi,

I see the below queries is blocked every time ... Another observation is, the query blocked are from different servers connecting using linked servers. 

Query blocked

select
        TABLE_CATALOG           = s_tiv.TABLE_CATALOG,
        TABLE_SCHEMA            = s_tiv.TABLE_SCHEMA,
        TABLE_NAME              = s_tiv.TABLE_NAME,
        TABLE_TYPE              = s_tiv.TABLE_TYPE,
        TABLE_GUID              = s_tiv.TABLE_GUID,
        BOOKMARKS               = s_tiv.BOOKMARKS,
        BOOKMARK_TYPE           = s_tiv.BOOKMARK_TYPE,
        BOOKMARK_DATATYPE       = convert(smallint, 21), --DBTYPE_UI8
        BOOKMARK_MAXIMUM_LENGTH = convert(int, 8),
        BOOKMARK_INFORMATION    = s_tiv.BOOKMARK_INFORMATION,
        TABLE_VERSION           = s_tiv.TABLE_VERSION,
        CARDINALITY             = s_tiv.CARDINALITY,
        DESCRIPTION             = s_tiv.DESCRIPTION,
        TABLE_PROPID            = s_tiv.TABLE_PROPID,
        TABLE_FLAGS             = s_tiv.TABLE_FLAGS
    from
        sys.spt_tables_info_view s_tiv
    where
        (
            (@table_schema is null and s_tiv.TABLE_NAME = @table_name) or
            object_id(quotename(@table_schema) + '.' + quotename(@table_name)) = s_tiv.object_id
        ) and
        (@table_type is null or @table_type = s_tiv.TABLE_TYPE)
    order by 4, 2, 3



Query at the head of blocking chain

SELECT StatMan([SC0])
FROM (SELECT TOP 100 PERCENT [ROLEID] AS [SC0] FROM [dbo].[#TMP_AP_ROLE_USER_______________________________________________________________________________________________000000EAD1DD] WITH (READUNCOMMITTED)  ORDER BY [SC0] ) AS _MS_UPDSTATS_TBL

Suman

Issue using Windows login for Oracle linked server, SQL login works fine with same permissions

$
0
0

I am seeing a issue with one of the oracle linked servers. I as a SA can access everything and am having no issues. One of the sql windows logins which the app is using is having issues with one partiucular oracle table, that login can acess other tables. Login has dbo permissions on the sql database. I created a test sql login and made it dbo on the same db & I got access error to SYS.XP_PROP_OLEDB_PROVIDER, following solved it:

USE [master]
GO
CREATE USER [] FOR LOGIN []
GO
USE MASTER
GO
GRANT EXECUTE ON SYS.XP_PROP_OLEDB_PROVIDER TO [];

---

now the test sql login had no issues running the linked server OPENQUERY t-sqls. I gave the same permission to the windows login but it still fails on a particular OPENQUERY:

SELECT *
FROM OPENQUERY(linkedservernamehere, 'SELECT * FROM problemtablenamehere')

--

giving following error:

The OLE DB provider "OraOLEDB.Oracle" for linked server "linkedservernamehere" supplied inconsistent metadata. The object "[OraOLEDB.Oracle]" was missing the expected column "columnnamehere_which_I_don't_see_when_run_as_sa_on_results".

--

so, all in all, if i login as a SA on SQL - no issues. If I login as a sql login with same permissions as windows login - no issues. But if the app engg logs in using WINDOWS login - then he gets the errors only on a single problem table, he can access others with no issues, not sure how to proceed, thanks.


D

IN Operator : UnExpected Result

$
0
0

There is no orderid field in customers table and below query supposed to produce an error , but it retrieves all the result from customer which is INCORRECT

SELECT * from Orders WHERE ORDERID IN (SELECT orderid FROM CUSTOMERS)



Please mark the post as answered to help others to choose the best. chandra sekhar pathivada | www.calsql.com (SQL Server Community Website)

SQL server taking all the CPU and RAM

$
0
0

Dear All,

I have a SQL Server 2008 standard edition with 20 GB RAM and have allocated 17 GB of RAM memory to SQL Server and 4 CPU.
But Since last 1 week i am facing issue in SQL server, The issue is SQL Server reaches 100% CPU usage constantly , have checked there is no single query is running in sql by using below dm views

SELECT Text from sys.dm_exec_request cross apply sys.dm_exec_sql_text(sql_handle)

I have also checked in task manager but only sqlserver.exe taking 100% CPU and Physical Memory Both
Then i have restarted the sql server, during restart process, the utilization gets decreases but Once the service gets started, Again the CPU and Physical Memory reaches to 100 % and it doesn't release the memory.The Only solution which i have used is rebooted the server, but it would not be the solution because the server is in Production.

I thought there might b issue with the antivirus have disabled it but nothing happend good, also checked in counter and found the total sql server memory(KB) is taking all 20GB and all the counter thresh hold values are normal.

I don't know where is the issue, I would thankful to you guys if someone help me.  

Thank you


Procedure is taking much time

$
0
0

Dear Team,

This is to inform you that i have a something like below procedure (PROCEDURE --1) in my production environment, but if i am running this procedure by passing parameter to 1000 it is taking around 5 minute ,

But If i am running second Procedure (PROCEDURE --2) its takes only 2 second 

Have recompile the SP,drop and recreated the same but it is taking same time and i got confused what to do next.

As the Statistics is also updated and reorganizes the index , fragmentation of index is also 0 for the table which is using in the Stored Procedure but haven't found any resolution.

PROCEDURE --1

ALTER Procedure [dbo].[Test1]
(
@rows INT 
)
As
Begin
Declare @internalRow INT
SET @internalRow = @rows
SELECT TOP (@internalRow) ,refclientid from RefClient
END

PROCEDURE --2

CREATE Procedure [dbo].[Test2]
As
Begin
SELECT TOP 1000 * from RefClient
END

how to get multiselect value in a variable in sql server function

$
0
0
i have a column with mulitple ids stored with commas . i want to pass ids and get data along with name from the table..
OR how to get multiselect value in a variable in  sql server function 

SQL 2008 Page Life Expectancy very high

$
0
0

When I run the following query to determine the Page Life Expectancy:  SELECT cntr_valueAS'Page Life Expectancy'FROMsys.dm_os_performance_countersWHEREobject_name='SQLServer:Buffer Manager'AND counter_name='Page life expectancy'

It returns a value greater than 120,000, Shouldn't this value be in seconds?  So that would work out to 33 Hours, that does not seem right?  The server is a Virtual Windows 2008 R2 Enterprise running SQL 2008 Standard.  It has 24 GB in the box and 22.5 allocated to SQL.  The Buffer Cache is roughly 99% and the Target Server Memory (KB) is 21764.  So SQL is not using all of the RAM Allocated to it

SSDT database code relase

$
0
0

Hello Friends,

I would like to know database code deployment from DEV to QA/PROD database server. I can use SSDT tools.

Please help me in this as it has been a problem for us as we have developers in different geo locations.

All I want is to generate new/modified scripts in order with some filter capabilities (because some time not all the change scripts in DEV suppose to go QA or PROD)..

Thanks in advance

Best Practise to Restart SQL Server Services

$
0
0

Hi All,

I know that we can restart SQl Services in different ways Like from

--> Services

--> Configuration manager.

What is the best way out of this?

Do we need stop and start the Services are do we need to restart?

Thanks in Advance

Cannot view the SQLDIAG extended events log file with SSMS on SQL Server 2012 SP2 CU5

$
0
0

I have a production SQL 2012 instance recently updated to SP2 and CU5 from RTM release.  To investigate an alwayson problem, I need to view the log file. I tried double clicking the file to view in SSMS but 0 events are displayed even though there is content in the file. I moved the file to another instance elsewhere which is still at RTM level and the file opens up showing content.

On the face of it, this seems like a bug but I may be overlooking something. Any advice would be appreciated. It looks like all other extended events logs have the same issue and just the SQLDIAG extended events logs.

How to install SSRS

$
0
0

I am using SQL Server 2008 R2. I'd like to set up a reporting server with SSRS but I cannot find out how to install it. Please help.

Thanks


Log size Increases

$
0
0

Dear Team,

Is this Possible, If database is in Simple recovery Mode and the ldf size gets increased?? .

mdf size :  159 GB (171,383,717,888 bytes)

ldf size : 6.46 GB (6,945,505,280 bytes).

My question is if the recovery model is in Simple Mode then why the log gets generated high.

dbcc sqlperf(logspace) --output

DATABASE  Logsize(MB)      Log space used(%)     status

mam        6623.742       0.4305579             0

Is there any issue or it is Normal.

SQL Server 2012 Error 26073 - TCP connection closed but a child process of SQL Server may be holding a duplicate of the connection's socket

$
0
0

Hi,

We have received a few 26073 errors on two of our SQL 2012 SP 2 (11.0.5058.0) Enterprise servers running on Windows Server 2012 R2 Standard.  The full text of the message we are receiving is:

"TCP connection closed but a child process of SQL Server may be holding a duplicate of the connection's socket.  Consider enabling the TcpAbortiveClose SQL Server registry setting and restarting SQL Server. If the problem persists, contact Technical Support."

Based on my research I know this is a bug with SQL 2008/2008 R2.  Does anyone know how to resolve this error on SQL 2012?

Thank you,
Emily


Configuring 'Tempdb' in sql server 2005

$
0
0

Hello,

For one of our servers, which has its tempdb growing tremendously on this reporting server has become an issue for shortage of space on the drive:

This tempdb has 4 data files and one log file all on same drive of size 200 GB , where tempdb files keep occupying 90 % of space.

When we looked at space usage we see below values in KB

user obj= 1024internal obj= 2560version_store=13824 free_space= 34615680   mixed_extent=2688

After every maintenance activity where servers are rebooted, space from disk is released and later in a day it fills up to nearly 100 GB

As of now we had a server reboot on Sunday and today we see all four files occupying nearly 40 GB with so much of free space as shown above.

So i am wandering, should i split the data files on separate disk? if yes what measures needs to be taken?

The server is SQL server 2005 SP3.

All data files are of initial size 8MB with 100 MB autogrowth , which have all gown to 10 GB each.

Is there something wrong or is it an OK process and we should look for storage?

Please advise.

SQL Server 2016 - VHD

$
0
0

Hi,

Is there a way of testing SQL Server 2016 - CTP on a home pc (Windows 8)

Is there a VHD version of SQL Server 2016 available anywhere?

Thanks

File to be formatted using TSQL

$
0
0
Hi,

We have a file which is not in correct format. We need this in correct format for our ETL. Please look at the file structure below.

#I 1
1 13:0.0002 3:0.0003
#I 1
2 13:0.0002 3:0.0003
#I 1
3 13:0.0002 3:0.0003

In this the line(Row) starts with #I and next is the data. And in the line2 the colon (:) is the identifier between 2 colomns

we need this file to be in the below foramt? Is it possible using TSQL or Powershell

ID FeatureID data1 Data2 Data3 Data4 
1 1 13 0.0002 30.0003 
1 2 13 0.0002 30.0003 '
1 3 13 0.0002 30.0003
Viewing all 12554 articles
Browse latest View live