Quantcast
Channel: SQL Server Database Engine Forum
Viewing all 15872 articles
Browse latest View live

After enabling SET ALLOW_SNAPSHOT_ISOLATION ON DML slows down

$
0
0

Hi All,

We have a SP that is running fine when we are keeping the ALLOW_SNAPSHOT_ISOLATIONOFF but it performances degradedafter keeping it ON.

The procedure is using cursor and updating,inserting,deleting record wise based on the logic.

Is there any performance impact by keeping the ALLOW_SNAPSHOT_ISOLATIONto ON certain queries?

Curious why it start hampering after enabling.

Environment:SQL Server 2014 SP2

Regards,

Maneesh

 



Excessive time to create SQL 2005 Bak file

$
0
0

We are running on SQL 2005 R2 server (Windows 2003 R2).

It normally only took 3 hours to create the BAK file from a MDF DB size of about 1.1 TB.

All of a sudden, the BAK file build time ran to over 9 hours with no change with our SQL server.

I plan to reboot our SQL server this weekend.

Any suggestion? Thanks!


TechNet from Microsoft

SQL Server 2014 linked server giving Login timeout expired error when connecting from SQl Server 2008 R2

$
0
0

Hi All,

I am reading data from a database which is configured as SQL Server 2014 linked server from SQL Server 2008 R2 client. In my query I am doing a simple select statement and it fails with below error-

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
OLE DB provider "SQLNCLI10" for linked server <LinkedServerName> returned message "Login timeout expired".

Note this had been working until we moved our detination DB server from SQL server 2008 R2 to SQl server 2014 and hence now linked server is also pointing to SQL server 2014 server.

Can anybody please help are there any open issues with this scombination or what coul dbe the reasons for this and how can those be resolved. Any pointer is highly appreciated.


Shrink not working

$
0
0

I am new to DBA but I have been working with SQL development quite a while. Recently I am stuck with an issue. I have a DB ~120 GB in size it is having 8 tables. There is one monster table ~119.9 GB of space. I have truncated this big table and try to shrink data file. Shink command is running successfully but it is not releasing any space. I have to every time drop that table and load it again? Is there a way to do it in another way? Why shrink is not working thought command is successful? 

Is there a correlation between the counters database pages and page life expectancy?

$
0
0

Hi,

I often see a correlation between the counters "Database pages" and "Page Life Expectancy".  Today I saw on one server a drop of the database pages values from 1087229 to 257386 combined with a drop the page life expectancy from 190258 to 258.

So, I wonder what actions might have such impact on the "Database pages" counter.  I have some ideas, but I do not know whether they are correct and probably their might be other reasons as well?

1) I can assume that Page Life Expectancy drops dramatically when someone (fi) launches a report that retrieves a lot of data that is normally not required in the OLTP/GUI environment.  Moving that data to a datawarehouse might be a solution for the problem, but that's not the question.  In addition, in this scenario, following my interpretation of the counters, I do not expect a drop in Database Pages since the datapages that are being removed will be replaced by other database pages.

2) I can assume that there is some functionality that lauches a lot of ad-hoc queries.  All the execution plans of those queries will be stored in the execution plan cache and therefor the database pages that are the least hot are removed from the buffer cache (with the consequence more physical reads are required afterwards to get those pages back in memory).

3) I can assume lazy writer kicks out database pages to keep buffer cache available for near future requests, but in that case I wonder whether the process will remove 75% of the pages in memory.

Are my assumptions correct?

Might their be other reasons that explain the correlated drop?  (Their are no maintenance jobs running at that moment, no index rebuild, etc that might explain the behaviour.)

Kind regards

Peter.


Reason for really long query (no blockings)

$
0
0

Hi experts, I am extremely curious as of why this query has been running for almost 3 hours now…

 

On sp_who2, there are no blockings.

 

I see:

 

Status: SUSPENDED.

Command: INSERT.

CPUTime: 98,394

DISKIO:  998,372

Wait type: PAGEIOLATCH_SH

Wait Resource:   40:1:15323842

 

 

And the code is doing the below…

declare@ActVS3 as SF_ActMerge

SELECT@LastUpdateDate=Max(updatedate)

FROM  [BUDatamartsource].[dbo].[Salesforce_Act]

insert@ActVS3

selectAct_id,

      Clou_id,

      Name,      

      Box__c,

      FE_Sales_Group__c,

      FE_Owner__c        

from  [Repl].[dbo].[Act]

where UpdateDate> @LastUpdateDate

 

I am 100% sure the insert is doing less than 1,000 insertions, and that Act table has less than 400,00 rows…

why is it taking so long?!?! I do not understand, what could possibly be causing this?

Linked Server using Windows AD

$
0
0

We have a couple of apps that need access to data that resides in Oracle. Traditionally, we have using linked servers using Oracle credentials to provide data access from SQL to Oracle. 

I was wondering if it is possible to use windows AD for linked server credentials. In this case, let's assume userA connects to the database, and userA would need to run some queries against Oracle. In the past userA was able to do it via linked servers however linked server was configured to connect to Oracle using oracle username/password.

Is it possible to configure the linked server to connect to Oracle using Windows authentication while the user is connected to SQL Server as a sql native user. How can this happen? Will I have map the SQL Native account to a Windows AD account that has permissions within Oracle?

Thanks

High CPU but low Memory on SQL server.

$
0
0

Hi All,

I am having a performance issue on one of the SQL servers. It was really peaceful. Now the CPU is stuck at 100% and the memory is like around 15% . . . whichi think should be the vise versa.

I checked the INDEXES, rebooted the server multiple times, added more procs and memo (the spec looks like a beast). But still the CPU is at 100%. Its very slow and applications are timing out.

FYI - The SQL server is 2008r2 enterprise.

Please help. 


Tina


SCOM message SQL 2012 DB Average Wait Time is too high

$
0
0

Hi,

Could you please suggest what is the possible reason for the below message?

Alert: SQL 2012 DB Average Wait Time is too high

Source: INSTANCE_NAME (modified for privacy reasons)

Path: FQDN_OF_THE_SERVER (modified for privacy reasons)

Last modified by: System

Last modified time: 11/29/2016 10:58:00 PM Alert description: The Average Wait Time of SQL instance "INSTANCE_NAME " on computer "FQDN_OF_THE_SERVER " is too high. See "alert context" tab for more details

logical reads_Number of pages read from the data cache.

$
0
0

Hi experts,

I am doing this example from a MS book:

select productkey, sum(salesamount) as sales, COUNT_BIG(*) as rows from FactInternetSales group by ProductKey

The book says that the query makes 1,036 logical reads... and asks me to run it myself with statistics io on.

I get a different number: Table 'FactInternetSales'. Scan count 1, logical reads 2062, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

how is this possible?

thanks

Error Msg 8630 Level 17 State 50

$
0
0

Msg 8630, Level 17, State 50, Server ..., Procedure ..., Line ... Internal Query Processor Error: The query processor encountered an unexpected error during execution (HRESULT = 0x80004005).

How do I look up what this error message is caused by? Online searching did not reveal any exact hits. Thank you.


Microsoft SQL Server 2012 (SP1) - 11.0.3000.0 (X64) 
Enterprise Edition (64-bit) 
We use clustering and partitioning.

Unable to find the trace file for C2 Audit in SQL Server 2014

$
0
0

It's weird, but when I enable the C2 Audit Mode, restart SQL Server and check the sys.traces view on SQL Server 2014, I only get the default trace. When i do the same on SQL Server 2008 R2, i get the default and the audit trace.

Can anyone point out on what am i missing or where is the audit file placed that i am not looking?


Please mark the answer as helpful if i have answered your query. Thanks and Regards, Kartar Rana

SQL server Post Validation

$
0
0

Hi All,

I need such query or queries which can show me my SQL server Status as follow

1) All SQL server services are online and running
2) All Databases are online and accessible (sp_helpdb doesn't gives correct result here )
3) SQL agent is up and running
4) All alwaysOn Availability groups are online and running 

In short I need to check status of SQL server after we reboot The Windows server. 

send email from sql.

$
0
0

Hi experts,

 

What would be the most simple way of doing this:

 

-execute a script every 4 hours; and if the script returns any results, send an email with an alert.

 

99% of the times it would return no results…

 

Ps: I said “simple”: because I will do it  on a server, I will soon give to other team; so I would like to be easy to maintain for the next guy... (using sql 2014).

sql server 2016 access azure blob storage via polybase with sql authentication - access denied

$
0
0

Hi,

I hope it's the correct forum. 

I have a special question regarding sql server 2016 and access flat files via azure blob storage with polybase.

If I want to create an external data source or select from existing external tables with sql authentication, it doesn't work. I get the following error:

Msg 7416, Level 16, State 2, Line 21
Access to the remote server is denied because no login-mapping exists.

With windows authentication it works (logged in local admin account on the virtual machine I connect to the sql server instance via SSMS). I can select from the external tables and create external datasources. 

It's a virtual machine with sql server 2016 installed in azure. I just created a sql user login for jobs or other processes. The sql user should also be able to create external data sources / select from external tables.

I don't know what to do here. I don't find anything regarding polybase with sql authentication on google and I only find solutions regarding linked server. But I don't have a linked server. I only want to select from azure blob storage via SQL.

I found everything on https://msdn.microsoft.com/en-us/library/dn935022.aspx. But it only works with windows login directly on the server. Here is the code:

CREATE MASTER KEY ENCRYPTION BY PASSWORD = <password>;

CREATE DATABASE SCOPED CREDENTIAL BlobCredential
WITH
    IDENTITY = <identity>,
    SECRET = <secret key to access blob>
;

CREATE EXTERNAL DATA SOURCE BlobContainer
WITH
(
    TYPE = HADOOP,
    LOCATION = 'wasbs://<container>@<storageacc>.blob.core.windows.net',
    CREDENTIAL = BlobCredential
);

CREATE EXTERNAL FILE FORMAT FlatFile WITH
(
    FORMAT_TYPE = DELIMITEDTEXT,
    FORMAT_OPTIONS
    (
        FIELD_TERMINATOR = '|', -- column delimiter
        USE_TYPE_DEFAULT = TRUE
    )
);

CREATE EXTERNAL TABLE [stg].[TestTable]
(
[...]
)
WITH
(
    LOCATION='/Flat/',
    DATA_SOURCE = BlobContainer,
    FILE_FORMAT = FlatFile,
    REJECT_TYPE = VALUE,
    REJECT_VALUE = 1
);

Maybe someone has any idea where I can set the login-mapping or something else, so that I can also access external tables with the sql login ?

Thanks in advance !


CREATE USER WITHOUT LOGIN and Then CREATE LOGIN WITH SID

$
0
0

HI ALL,

here i am getting Err:

Non-dbo users may not be able to create Dabase Diagrams in SQL Server 2005
Link: http://blogs.msdn.com/b/mangeshd/archive/2008/02/08/non-dbo-users-may-not-be-able-to-create-dabase-diagrams-in-sql-server-2005.aspx
Resolution: Resoluton here is to create a regular user in a separate schema and make him the owner of that schema. After this, the user will be able to create/alter the diagram designer to add/modify/remove the tables in that schema.

I followed below steps:
CREATE USER SURESH WITHOUT Login
CREATE SCHEMA abc Authorization Suresh

Select * from sys.database_principals --SID from this table

CREATE LOGIN Suresh
WITH Password='asd',SID=0x010500000000000903000000674040092C01A94FB26E067F2E1F057B

It's giving error
Supplied parameter sid should be binary(16).


CREATE LOGIN Suresh
WITH Password='asd',SID=CAST(0x010500000000000903000000674040092C01A94FB26E067F2E1F057B as varbianry(16))--Incorrect syntax near 'SID'.

How to create login in this way as it's also oprpahened
User.


Manish

SSL Certificate not visible from SQL Configuration Manager

$
0
0

Hi all,

for some reason I am not able to see the certificate from the Configuration Manager --> SQL server network configuration --> Protocols for MSSQLSERVER when I right click and select the Certificate under the dropdown.
Certificate was imported from sys admin guy and I can see it under Certificates' Personal folder of the Console Root - certificates (Local Computer). It also looks that is configured and imported properly and in line with the requirements under the Microsoft's links below:

http://technet.microsoft.com/en-us/library/ms191192.aspx
http://technet.microsoft.com/en-us/library/ms189067%28v=sql.105%29.aspx

The version of the operating system is where SQL server resides is Windows Server 2012 Standard Edition and SQL Server is 2012 developer edition.

Since my sql server services Engine is running under service account with Deny Logon Locally domain policy, I started the service as LocalSystem and open the Configuration Manager with an administrative account, but still didn't worked.

Feedbacks on this issue are highly appreciated.

Cheers

SQL server leveraging free memory to fill buffer

$
0
0

I have a strange situation where one of my SQL server 2012 instance refuses to fill the buffer and displays very poor page life expectancy.

The instance is capped at 55GB.

when displaying the performance counter from the Memory manage of my instance:

Total memory flat at 55GB.  (no drop)

I have an average between 1GB to 2GB of buffer (database cache).  the page life expectancy constantly is below 5 seconds.

43GB of free memory

the rest is split between working set, stolen memory, etc. with no noticeable peaks.

Over two days, the buffer rased once to 40GB, consuming the free memory, for one hour or so outside work hours before lowering once more.

Wondering kind of situation could cause a SQL server instance keep the memory as "Free Memory" while keeping the buffer low. What could cause and instance to leave 43GB as "Free memory"?


How to check performance of sql query.

$
0
0

i made some changes in a sql query to optimize it. Now now want to check its performance before and after changes and also check it execution time and resources it hold in execution.

Thanks!

How to delete data from tables in batch wise

$
0
0

Hi All,

I have one requirement, where i need to delete 3 tables’ data in batch wise.

Note: We can’t delete whole data at time, Because there is huge volume of data in tables.

To complete the requirement:

I have created procedure: Where I have used temp table to maintain table names, after that loop the each table get the total records count. Based on that I’m deleting data in batch wise.

Input parameters to procedure:

  1. Fromdate
  2. RecordLimit

 

Based on two parameters it will delete data from tables.

Steps: 1) Get the total number of table based from date

            2) Get the number of loops count based on recordcount and recountlimit, needs to run to delete the data.  

Table Lists: 

  1. tbl_Emp

EMPID(PK)

EName

HireDate

  1. tbl_dept

Dept_ID(PK)

EMPID(FK)

Create Date

  1. tbl_deptSummary

Dept_ID(FK)

TotalNoOfEMP’s

 

Everything is working fine, My concern is that I don’t want to use temp table to loop the table by table. How to avoid the temp table.

Please your suggestions on this.

Regards,


Vaishu

Viewing all 15872 articles
Browse latest View live


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