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

SQL Profiler Trace ran overnight and blowed up the production db server..need urgent help!!

$
0
0

Hi ,

I ran the SQL profiler trace on production server overnight with some selected events to save the trace files on D:\ and now the production server is down this morning. I cant RDP into the server. I am on call with support guys to bring the server up but do you think creating sql trace files would have consumed all windows memory and shut down the server?  if thats the case once server is up , how can I confirm that and how can I turn SQL server back ?

Would really appreciate some suggestions pls.

Thanks

Sim


Memory leak when columnstore tables are integrity checked

$
0
0

I've just posted a Connect item for 'Memory leak when columnstore tables are integrity checked'.

I'm wondering if anyone else who uses big columnstore tables and runs integrity checks every day is encountering the same issue that I've mentioned in the Connect item.

Worst case is that after a number of days of uptime the memory leak gets so bad that select queries are starved of resource pool memory and start throwing memory errors.

This is reproduced for SQL Server 2014 using the latest Cumulative Update (CU5).

Thanks.

SQL Attention events are raised during SqlBulkCopy WriteToServerAsync operations

$
0
0

In some of our applications we are using SqlBulkCopy to load data into SQL Server.  

After running some tracing which captures events for the Attention Event Class in SQL we have found that for each 'insert bulk' operation performed by the SqlBulkCopy WriteToServerAsync call there is a corresponding attention event raised even though these calls are successful and our client cleanly disconnections (releases the connection returning it to the pool). 

Does anyone know the reason behind this?   We generally use tracing of Attention events to help us identify client timeouts and the events being raised as part of the bulk copy operations pollute our logs with a bunch of attention events that seem to be benign.

thanks.

-mike


Mike Ruthruff

Why Do B+ Trees Have a Minimum Occupancy of 50%?

$
0
0

As far as I can tell, the basic operations (add, delete, search) on a B+ Tree would function the same if minimum occupancy was 1, or 1/3, or any other function on node size.

All the sources available give the minimum occupancy as 50%. Why 50%?

Upgraded 2008 R2 SP1 -> SP2, now BACKUP/CHECKPOINT on one DB fails

$
0
0

I upgraded 3 of our SQL servers from 2008R2 SP1 to 2008R2 SP2 Monday night.  One database (out of 9 DBs on the 3 servers) can no longer run a backup or checkpoint.

The error is:

Msg 2601, Level 14, State 1, Procedure sp_flush_commit_table, Line 15

Cannot insert duplicate key row in object 'sys.syscommittab' with unique index 'si_xdes_id'. The duplicate key value is (2273355842).
The statement has been terminated.
Msg 3999, Level 17, State 1, Line 2
Failed to flush the commit table to disk in dbid 8 due to error 2601. Check the errorlog for more information.

I ran some queries on dm_tran_commit_table and we seem to have several (14) ids with duplicate values in the table:

SELECT * FROM sys.dm_tran_commit_table
WHERE xdes_id IN ('2273355860', '2273355850', '2273355867', '2273355863', '2273355870', '2273355842', '2273355855', '2273355857', '2273355874', '2273355847', '2273355865', '2273355845', '2273355854', '2273355877')

ORDER BY xdes_id

Returns:

83719828	2273355842	16846661326308249	117567	2012-08-14 04:18:44.583
83719842	2273355842	16846661326308249	0	2012-08-14 04:23:38.750
83719829	2273355845	16846661326308253	117570	2012-08-14 04:18:44.783
83719843	2273355845	16846661326308253	0	2012-08-14 04:23:38.750
83719830	2273355847	16846661326308256	117574	2012-08-14 04:18:44.907
83719844	2273355847	16846661326308256	0	2012-08-14 04:23:38.750
83719831	2273355850	16846661326308262	117578	2012-08-14 04:18:44.943
83719845	2273355850	16846661326308262	0	2012-08-14 04:23:38.750
83719832	2273355854	16846661326308267	117582	2012-08-14 04:18:45.133
83719846	2273355854	16846661326308267	0	2012-08-14 04:23:38.750
83719833	2273355855	16846661326308271	117583	2012-08-14 04:18:45.137
83719847	2273355855	16846661326308271	0	2012-08-14 04:23:38.750
83719834	2273355857	16846661326308274	117587	2012-08-14 04:18:45.293
83719848	2273355857	16846661326308274	0	2012-08-14 04:23:38.750
83719835	2273355860	16846661326308278	117591	2012-08-14 04:18:45.307
83719849	2273355860	16846661326308278	0	2012-08-14 04:23:38.750
83719836	2273355863	16846661326308284	117594	2012-08-14 04:18:45.490
83719850	2273355863	16846661326308284	0	2012-08-14 04:23:38.750
83719837	2273355865	16846661326308287	117596	2012-08-14 04:18:45.530
83719851	2273355865	16846661326308287	0	2012-08-14 04:23:38.750
83719838	2273355867	16846661326308292	117600	2012-08-14 04:18:45.720
83719852	2273355867	16846661326308292	0	2012-08-14 04:23:38.750
83719839	2273355870	16846661326308316	117604	2012-08-14 04:18:45.780
83719853	2273355870	16846661326308316	0	2012-08-14 04:23:38.750
83719840	2273355874	16846661326308500	117607	2012-08-14 04:18:45.960
83719854	2273355874	16846661326308500	0	2012-08-14 04:23:38.750
83719841	2273355877	16846661326308503	117609	2012-08-14 04:18:46.040
83719855	2273355877	16846661326308503	0	2012-08-14 04:23:38.750


On all of the other dbs there are no ids with duplicate values in that table.

I have referenced this page http://support.microsoft.com/kb/2522893 , but the patch that is suggested to fix it is CU8 (10.50.1797) and we were already on 10.50.2500 (now 10.50.4000).



temp db is full

$
0
0
Hi all. Please let me know what needs to be done in below scenario.

TempDB is full. Unable to expand the databases and unable to open a new
query window. We should not restart sql services or restart the server.
How to fix this.

My login is showing server error when tryinng to login through my application

$
0
0
Server Error in '/' Application. Failed to generate a user instance of SQL Server due to a failure in copying database files. The connection will be closed. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. SQLExpress database file auto-creation error: The connection string specifies a local Sql Server Express instance using a database location within the application's App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database: If the application is running on either Windows 7 or Windows Server 2008R2, special configuration steps are necessary to enable automatic creation of the provider database. Additional information is available at: http://go.microsoft.com/fwlink/?LinkId=160102. If the application's App_Data directory does not already exist, the web server account must have read and write access to the application's directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist. If the application's App_Data directory already exists, the web server account only requires read and write access to the application's App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the application's App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server account's credentials are used when creating the new database. Sql Server Express must be installed on the machine. The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.

Log file restore takes long time

$
0
0

Hi,

My log file restore takes very long time to complete, for 128 MB it takes around 3-4 hours, most of the time it is in suspended state and wait type is 'SLEEP_BPOOL_FLUSH' 

I checked for virtual logs its around 534 files, also there is not disk IO issues as the other DB using the same drive restore faster than this DB...

Am using lg shipping and the backup/restore schedule is 5 mins.. by surfing i feel this could be a checkpoint issue so i manually tried to issue a checkpoint but can not as the DB is in restoring state most of the time.

Please advise on what could be the possible scenarios?


Best Regards Moug


Can Fragmentation Is Reduced while inserting data

$
0
0

Hi All

While testing few scenarios i faced one issue when i am not able to create fragmentation in table. This code usually works with me and with second insert i get 90 - 98% fragmentation.

Today I was inserting 1 Lakh/ 100 Thousand records in single chunk. I repeated this process no. of times and fragmentation changes like

1st Insert - 15 %

2nd Insert- 4%

3rd Insert - 8%

4th Insert - 5.6%

5th Insert - 1.5%

6th Insert - 0.7%

So is it possible that Inserting data might decrease Avg fragmentation and how?.

Code i used is 

create database BKP_Test
GO
USE BKP_Test
GO
CREATE TABLE Diff_Table
(ID INT,
FirstName VARCHAR(100),
LastName VARCHAR(100),
City VARCHAR(100))
GO
CREATE  CLUSTERED INDEX PK_Diff_Table
ON Diff_Table(ID)
GO
/**************Run below insert twice**********/
INSERT INTO Diff_Table (ID,FirstName,LastName,City)
SELECT TOP 100000 ROW_NUMBER() OVER (ORDER BY a.name) RowID,
'Saurabh',
CASE WHEN ROW_NUMBER() OVER (ORDER BY a.name)%2 = 1 THEN 'SINHA'
ELSE 'Sumit' END,
CASE
WHEN ROW_NUMBER() OVER (ORDER BY a.name)%1000 = 1 THEN 'New Delhi'
WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 1 THEN 'Mumbai'
WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 5 THEN 'Benglaru'
WHEN ROW_NUMBER() OVER (ORDER BY a.name)%10 = 3 THEN 'Kolkata'
ELSE 'Bhopal' END
FROM sys.all_objects a
CROSS JOIN sys.all_objects b
/**********************************************/
GO
SELECT OBJECT_NAME(i.OBJECT_ID) AS TableName,
i.name AS IndexName,
indexstats.avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats(DB_ID(), OBJECT_ID('Diff_Table'), NULL, NULL, 'LIMITED') indexstats
INNER JOIN sys.indexes i ON i.OBJECT_ID = indexstats.OBJECT_ID
AND i.index_id = indexstats.index_id



Thanks Saurabh Sinha http://saurabhsinhainblogs.blogspot.in/ Please click the Mark as answer button and vote as helpful if this reply solves your problem

Problem to the date

$
0
0
Hi,
when running this
EXEC usp_clsLogin 'ChangePassword','ldb_admin','','','????????','????????', '????????','?ÕÅÞ¤»·¼', '?ÕÅÞ¤»·¼', '3',getdate(), '','','LDB'


I do get this
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ')'.



while here are the parameters of the SP

CREATE PROCEDURE [dbo].[usp_clsLogin] -- Add the parameters for the stored procedure here @FuncName varchar(20), @UserID varchar(10), @UserName varchar(30), @Branch varchar(10), @Password varchar(50), @OldPass1 varchar(50), @OldPass2 varchar(50), @OldPass3 varchar(50), @OldPass4 varchar(50), @Permission varchar(5), @LastChg datetime, @Level varchar(5), @InUse varchar(1), @Unit varchar(10)

AS

...




Why do I get the error?

Many Thanks & Best Regards, Hua Min


high memory utilization

$
0
0

hi

we got one of our production server on SQL 2012,memory utilization on this server is hitting 95-96%.This is just our DB server and there are no applications running on this could please some one tell me how to control this utilization of memory, and reasons for this spike

server specs

->intel xeon 3.07ghz(2 pr0cessors)

->16gb ram(MAX MEMORY IS NOT CONFIGURED)

->SQL 2012 enterprise edition

->available Mbytes will be around 500-600mb

->cpu utilization varying in between 40-70%

with regards

ram

UNION Issue?

$
0
0

Hello,

I have this query:

Select 'All Ping Targets' As Status, Target_2EFA38B1_34E2_19E3_1D22_4A69BF0A57D2 from MT_PingTarget

UNION

Select 'Critical - Ping Target Failed' As Status, BME.Name from Alert A

Join BaseManagedEntity BME on BME.BaseManagedEntityId = A.BaseManagedEntityId

Where AlertName = 'SystemCenter.Utililities.MultiHostPing.PingAvailability.WMI.Monitor'

And ResolutionState != '255'

And Severity = '2'

I verified the three tables (MT_PingTarget, Alert, BaseManagedId) they are all SQL_Latin1_General_CP1_CI_AS

But I still getting an error:

Msg 468, Level 16, State 9, Line 1

Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "SQL_Latin1_General_CP1_CS_AS" in the UNION operation.

Where is this error coming from?

the column Target_2EFA38B1_34E2_19E3_1D22_4A69BF0A57D2 is SQL_Latin1_General_CP1_CS_AS

How could I change it? How could I use it as is in the Query? What ic the impact if I change the collation?

Thanks,

Dom


System Center Operations Manager 2007 / System Center Configuration Manager 2007 R2 / Forefront Client Security / Forefront Identity Manager

Differents between upgrade installation and new installation

$
0
0
Our processes have some misbi

Our processes sometimes misbehave. We don't know the cause. We have a DR site so we moved everything there and then everything worked with no issue. The applications are using SQL 2012 SP2.

All the servers are the same in the DR site as the primary site, One of the things we know to be different is that the SQL server installation in the primary site is an upgrade from 2008, and the one in the DR site is a new installation of SQL 2012.

Do you think there could be a different behaver that is related to type of installation?

Does it make scenes to reinstall the SQL in the primary site as new installation rather than upgrade?

What Permission Set Is Required For This Scenario?

$
0
0

Hello,

I currently have an environment where I have limited users to being able to create/delete databases that only they have created.  I did this by creating a Login with Public access and granting them the  CREATE ANY DATABASE permissions to their login. This works great as the users can create a database and delete their database but not anyone else's. The issue I have is the following scenario:

Database A is backed up from Server 1 (a different server than the restore server) and the DB was created by User 1

Database A is restored to Server 2 by User 2 who has CREATE ANY DATABASE permission (successfully).

User 2 can see the restored database, but cannot access it: The database is not accessible error.

When I view the database I see that the DB Owner is listed as User 1.

I've been trying to figure out how to be able to allow the user to become the new owner so they can edit/delete the database, but still not affect other databases that they do not own.

I've played with various permission sets but they end up being able to delete other user databases which I'm trying to avoid.  I also don't want to have to change the owner myself. 

Is there a permission set that I can grant that will allow this scenario?

Query Performance

$
0
0

Morning,

I've got a specific SP that when the server is newly rebooted the performance is great.  After the box has been up for awhile then the performance is terrible.  For example, a SQL Trace for this SP has only 2386 reads...then, after awhile it goes to 5873200.  This is a vendor and I can't change the code or anything like that... But, I was hoping someone could provide some insight.

Thanks in advance.

- Michael

PS: Version 10.50.2811


Driver SCSI returned invalid ID for a child device

$
0
0

Hi,
We are having a Sql Clustered instance of SqlServer 2008 R2 with 2 nodes running
on windows server 2008 R2. We have about 90 databases in the instance.
Our servers(Dell PowerEdge m610) runs on 2 Intel Xeon(R) CPU X5670 @2.94 GHz with
6 cores(12 logical processor) and 12 GB RAM. The mdf and ldf files are stored in
a single drive which actually is lun of 2TB in EMC vnx5330 san storage system connected
through fibre optic channel.For the heartbeat between the 2 servers we have Broadcom BCM57095
netextreme 11 1GB Ethernet adapters. The SQL Servers are connected to the SAN and LAN using
2 QLogic 10Gb Ethernet NICs(which are teamed) through 2 Cisco Nexus
5010 switches which are operating in ‘active-active’ mode.


 
On 12th instance there was server(active node) reboot. The instance automatically failed
over to the second node with out any problem. Checking the event viewer the following
critical event(kernel power) was registered.
The system has rebooted without cleanly shutting down first. This error could be caused
if the system stopped responding, crashed, or lost power unexpectedly.
Prior to it there were several event(application pop up) whose descriptions are given below -:
a)Driver SCSI returned invalid ID for a child device (000200).
b)Driver SCSI returned invalid ID for a child device (000129).
c)Driver SCSI returned invalid ID for a child device (000128).
d)Driver SCSI returned invalid ID for a child device (000127).
e)Driver SCSI returned invalid ID for a child device (000100).
f)Driver SCSI returned invalid ID for a child device (000029).
g)Driver SCSI returned invalid ID for a child device (000028).
h)Driver SCSI returned invalid ID for a child device (000027).
i)Driver SCSI returned invalid ID for a child device (000000).

Also on the chasis indicator the following error was displayed-:
Critical bus fatal error was detected on a component at bus 0 device 0 function 0.

Before the reboot on 12th of January the server had rebooted on 6th of January with the
same sequents of error events registered ie Driver SCSI returning invalid Id for child
device followed system rebooting.

On investigation the server had rebooted 3 times during the year 2014 with the same events
with the same sequence.

We are also logging 30 perfmon counters which showed no significant variation from the
daily pattern. However the counters which shows values over the threshold values recommnded
by Quest software are given below-:

Counter Name                  Min     Max     Average    At time of reboot
Processor Queue lenght        0       8       0.015      0
%processor time sql process   0       481     5          32
Sql buffer page reads per sec 0       17596   280        325
Memory Pages per sec          0       8217    1063       1800
Full scans per sec            0       192     9.567      26
Index searches per sec        0       12111   177        457
Batch requests per sec        0       509     12.673     28
Compilations per sec          0       258     2.266      19

The cpu usage was well below 20% and avg disk sec/read & write well below 8 ms.

What could be the reason for the problem? What exactly is the reason that the 'driver
SCSI returned invalid ID for a child device' error is getting registered in the event log.
Is it a Sql Server cluster configuration problem or an hardware problem?
How could the server reboot's in future be avoided?

Thanking you in advance,
Binny Mathew.

***************

Index still fragmented after rebuild

$
0
0

I have a database 2008R2 with 97% of average fragmented index and page counts = 164785 and the index table is more than 300,000 rows.

I use the ola.hallengren script to optimize index and the stat above provided by the IndexCheck.sql script.

My question is why after the index fragmentation above has been rebuilt the fragmentation is very much the same as before. The indesc has been rebuilt because it's lager than 30% and page count is larger than 1000 .

However, if a copy of that database has been restored on a different server, the fragmentation is much below than 30%.

Help! SQL server database log file increasing enormously

$
0
0

I have 5 SSIS jobs running in sql server job agent and some of them are pulling transactional data into our database over the interval of 4 hours frequently. The problem is log file of our database is growing rapidly which means in a day, it eats up 160GB of disk space. Since our requirement dont need In-point recovery, so I set the recovery model to SIMPLE, eventhough I set it to SIMPLE, the log data consumes more than 160GB in a day. Because of disk full, the scheduled jobs getting failed often.Temporarily I am doing DETACH approach to cleanup the log.

FYI: All the SSIS packages in the job is using Transaction on some tasks. for eg. Sequence Cointainer

I want a permanent solution to keep log file in a particular memory limit and as I said earlier I dont want my log data for future In-Point recovery, so no need to take log backup at all.

And one more problem is that in our database,the transactional table has 10 million records in it and some master tables have over 1000 records on them but our mdf file size is about 50 GB now.I dont believe that this 10 million records should make it to 50GB memory consumption.Whats the problem here?

Help me on these issues. Thanks in advance.

SQL Server BCP import increase memory usage above max allocated

$
0
0

Hello,

I am using SQL server 2008 SP1 on a VM (Test only. SQL will be hosted on physical machine for production). I have the server property Maximum Server Memory in MB set to 20000. 

I use BCP to import a large file with ~320000000 (320 millions) records (int,int,nvarchar(455)). I have the tempdb split into 4 on a disk with enough disk space (over TB free for that).

Problem is that SQLserver process keeps eating memory beyond the 20GB I set in the max limit. It is currently over 21GB and I am afraid it will crash the machine once OS has not enough memory.

Any suggestions?

Thanks you.

Thread count higher than max worker threads... Large number of suspended worker threads

$
0
0

I have a SQL 2012 SP2 server that is getting High Thread count alerts in SCOM.  looking into the issue I found some interesting things that I am now at a loss for.  I have been searching around for a few hours now and havent found much other than making it more confusing.  I found this MSDN blog: Are my actual worker threads exceeding the sp_configure 'max worker threads' value?

Running through that I found some interesting things.

-Max worker threads is set to default for x64 of 512 threads

running a thread count query found 547 current worker threads:

SELECT
SUM(current_workers_count) as [Current worker thread] FROM sys.dm_os_schedulers

Taking it a step further found that there was 523 worker threads in a suspended state with a last_wait_type of MISCELLANEOUS:

select is_preemptive,state,last_wait_type,count(*) as NumWorkers from sys.dm_os_workers

Group by state,last_wait_type,is_preemptive

order by count(*) desc  

is_preemptive    state    last_wait_type    NumWorkers
0    SUSPENDED    MISCELLANEOUS    523

This is not yet a production server, no one is connecting to the database and the front end software application is not being used on this server yet.  Essentially this is just an idle database server so I thought it might be a fluke, so I restarted the sql services and the thread counts cleared.  I left it alone and overnight the high thread count alert popped back up.  I looked at it again this morning and the exact same thing happend.  Same number of suspended workers etc and total worker threads of 523 and 547 respectively.

Other than the one article I have found above I have not been able to find anything to help explain this or what the heck suspended miscellaneous worker threads are.  Any help would be appreciated...Thanks!





Viewing all 15264 articles
Browse latest View live


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