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

slow inserts causing timeouts

$
0
0

I have been trying to fix a production issue, where some of the client transaction are timing out.

The client has a requirement that a transaction must finish with in 2 seconds other wise it is considered as a time out.

 

This is a simple insert in a table which is taking time.

 

I have not yet moved to perfmon (disk queue etc) to collect the counters. I will be doing that tomorrow.

 

Till now, I have just Changed the fill factor to 80% suspecting page spits might be causing this.

When I try the same inserts in the Test environment it finishes in avg 50Milliseconds only where as in production they take some time as much as 1-4 seconds which is very high.

I am now going to change the clustered index key from identity to some other column to see if the issue might be due to a busy hotspot.

On a side note, I saw there had been too much of blocking on the server through out the day.  I have captured the server activity on trace.

Captured all transaction which took more than a second. Also captured the tempdb sorts and Blocked process report, just in case you need this data too.

Any other quick advice.

 

Sql server 2008 R2
Windows 2008



SQL Services fail to start after WSUS windows updates whether they have SQL updates or not.

$
0
0

SQL Services fail to start after WSUS windows updates whether they have SQL updates or not.

#### Application Event log - Windows Server 2008 R2 Standard - SQL Server 2008 R2 EE
#### 2013-02-19 - 3:33:13 AM - Report Server Windows Service (MSSQLSERVER) cannot connect to the report server database.
#### 2013-02-19 - 3:28:37 AM - The User Profile Service has started successfully.  
#### 2013-02-19 - 3:22:45 AM - SQL Server is terminating because of a system shutdown. This is an informational message only. No user action is required.

Is this a SQL prob or a WSUS problem?  But it only affects SQL services so far including Windows Internal Database on some servers. 

I Attempted to include the WindowsUpdateLog but, even if it is under 60k characters I get an error.


Insert Suspended

$
0
0

Hi

While inserting records into a table I found that it was taking too much time, I open Activity monitor window and try to look where it was stuck!! There is no any other session was running except my one. But I got surprised while looking the Process tab! My insertion was suspended and TempDB select is running. After few second insert was running and again got suspended. It was repeating this process after every few seconds. I am not DBA but interested to know why INSERT was suspended and what this TempDb Select is doing?

CREATETABLE JoinTest2

(idintidentity(1000,1), namevarchar(40),salmoney)

Insertinto jointest1(name, sal) values('myname1',100)

go 10000

Advance thanks for reply.


Regards Vikas Pathak

I STILL can't get a full text search to work on a filestream table.

$
0
0

SQLServerExpress 2012/WIndows Server 2008R2

Create filestream enabled database:

CREATE DATABASE ISR
PRIMARY (NAME = FileStream1, 
		FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\FileStreamDat1.mdf'),
FILEGROUP FileStreamGroup1 CONTAINS FILESTREAM ( NAME= FileStream3, 
		FILENAME = 'F:\FileStream1')
LOG ON ( NAME = FileStreamLog1, 
		FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\FileStreamLog1.ldf')		
GO	

Create Filestream enabled table:

USE [ISR]
GO
/****** Object:  Table [dbo].[Documents]    Script Date: 2/22/2013 8:56:59 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Documents](
	[DocumentID] [bigint] IDENTITY(1,1) NOT NULL,
	[FilestreamID] [uniqueidentifier] ROWGUIDCOL  NOT NULL,
	[TextIndex] [varchar](50) NULL,
	[TextType] [varchar](10) NULL,
	[Doc] [varbinary](max) FILESTREAM  NOT NULL,
	[Text] [varbinary](max) FILESTREAM  NOT NULL,
	[Title] [nvarchar](50) NOT NULL,
	[UserID] [int] NOT NULL,
	[FileName] [nvarchar](400) NULL,
	[FileExtension] [nvarchar](8) NULL,
	[ModifiedDate] [datetime] NULL,
 CONSTRAINT [PK_Document] PRIMARY KEY CLUSTERED 
(
	[DocumentID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] FILESTREAM_ON [FileStreamGroup1],
 CONSTRAINT [UQ__Document__6A858DF292516B12] UNIQUE NONCLUSTERED 
(
	[FilestreamID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
UNIQUE NONCLUSTERED 
(
	[FilestreamID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] FILESTREAM_ON [FileStreamGroup1]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[Documents] ADD  DEFAULT (newsequentialid()) FOR [FilestreamID]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Key Field' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Documents', @level2type=N'COLUMN',@level2name=N'DocumentID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Filestream unique ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Documents', @level2type=N'COLUMN',@level2name=N'FilestreamID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Full Text Index' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Documents', @level2type=N'COLUMN',@level2name=N'TextIndex'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'may be used for full text search' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Documents', @level2type=N'COLUMN',@level2name=N'TextType'
GO

Create Full Text Catalog:

create fulltext catalog FileStreamFTCatalog ON FILEGROUP FileStreamGroup1  AS DEFAULT

Create Full Text Index:

Create fulltext index on dbo.Documents
(Title, Text TYPE COLUMN TextType)
Key INDEX PK_Document
ON FileStreamFTCatalog
WITH Change_Tracking AUTO

Create word file that consists of a single sentence: "This is a sample document."  Save as docx and pdf.  Read into filestream:

DECLARE @Doc AS VARBINARY(MAX), @Text AS VARBINARY(MAX)
-- Load the image data
SELECT @doc = CAST(bulkcolumn AS VARBINARY(MAX))
FROM OPENROWSET( BULK 'C:\This is a sample document.docx', SINGLE_BLOB ) AS x 
SELECT @text = CAST(bulkcolumn AS VARBINARY(MAX))
FROM OPENROWSET( BULK 'C:\This is a sample document.docx', SINGLE_BLOB ) AS x 
INSERT INTO [dbo].[Documents] (Doc,Text,FileName, TextType, Title, UserID,ModifiedDate)
VALUES (@doc,@text,'This is a sample document','.docx','This is a sample document',1, getdate())

Check to see if docs are there:

SELECT Doc.PathName() AS 'PathName', Title, TextType, FIlestreamID FROM Documents;

They are.

Run full text query:

Select *
FROM Documents
WHERE CONTAINS (Text, 'This')

NO RESULTS.

What am I doing wrong????

Rebuild index task failed with error: Could not proceed with index DDL operation on table because it conflicts with another concurrent operation

$
0
0

Hi Friends,

I have one rebuild index job in my environment which is created using maintenance plan & having an option "keep index online ".

job is continuously failed at this schedule time, when i saw maintenance plan history then i got following error.

Error :

Executing the query "ALTER INDEX [IX_CMSID] ON [dbo].[tblAccountFacility]" failed with the following error: "Could not proceed with index DDL operation on table 'tblAccountFacility' because it conflicts with another concurrent operation that is already in progress on the object. The concurrent operation could be an online index operation on the same object or another concurrent operation that moves index pages like DBCC SHRINKFILE.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

details:

The above mentioned index which causing an error is non-clustered index, use page lock option is enable.

database size is only 8.00 GB,, Autoshrink option is=false

SQL server is 2008 SP2

Please help me how to sort this problem.

Issue with SQL Agent Running

$
0
0

Not sure if this is the right forum, please let me know if it should be posted elsewhere. We have SQL 2008 R2 Standard on a Windows 2008R2 server. About a year ago we had to rename the server and had Microsoft assist with it to ensure we didn't encounter issues with SQL after renaming the server. At that time, we weren't using the SQL Agent but now we have enabled it for the purpose of doing some maintenance plans. For clarification, Server1 is the old name and Server2 is the new name. When the maintenance plans try to run, we get the below error message. My question is why is the SQL Agent trying to use an old account server1\useradmin instead of server2\useradmin? When we look in the SQL studio, under the logins folder, we still see the old accounts server1\useradmin which never got automatically renamed. When viewing the logs to see what accounts we are using as admins to login to SQL, it shows us using Windows Authentication which is accouring since there is a group Builtin\Adminstrators. How can we fix the sql agent issue?

 

Message
[298] SQLServer Error: 15404, Could not obtain information about Windows NT group/user 'Server1\useradmin', error code 0x534. [SQLSTATE 42000] (ConnIsLoginSysAdmin)

Thx for any assistance provided.

sys.dm_exec_sql_text not showing all queries

$
0
0

 i am using sys.dm_exec_sql_text DMV to get the  Query on a Particular Database.But this DMV is not showing every Query.

Example:

if i run the Query ----> select * from Employee ---------- this Query is visable in this DMV

but if i Run this Query(select * from Employee where Empid=100)  this query is not showing in this DMV.

help me to find every query.

Thanks in Advance

%d%d Threshold error in Log-Shipping?

$
0
0

HI

%d%d Threshold error in Log-Shipping?

Thanks & Regards

Prasad Kilari


SQL Server 2012 Management Studio & Visual Studio 2012 Express: Database & its Tables created in my SQL\EXPRESS & Database Explorer. Different in Table Name? Why?

$
0
0

Hi all,

I have SQL Server 2012 Express [that has SQL Server 2012 Management Studio (SSMS 2012)] and SQL Studio 2012 Express installed in my "Windows 7" PC. I can manually create a Database "BooksAuthorsLibrary" with 2 tables "Books" and "Authous" in the NAB-WK-01234567\SQLEXPRESS (SQL Server 11.0.2100) of my SSMS 2012. But I cannot export the Database and its 2 table to my SQL Server 2012 Express LocalDB via the SQL Server Import and Export Wizard (Error # 5105). 

From http://www.homeandlearn.co.uk/csharp/csharp.html, I saw the following:

C#.NET: Databases

1. SQL Server Express and C#.NET

2. Create a SQL Server Express Database

3. Create a SQL Server Table

4. Add Data to the Table

5. Datasets and Data Adapters in C#.NET

and I created a new Database "Database1.sdf" in the Database Explorer and 2 tables "Books" and "Authors" manually.   These 2 tables in "Database1.sdf" do not have "dbo" in front of the file name as the 2 tables "Books" and "Authors" in the Data Explorer of my  NAB-WK-01234567\SQLEXPRESS have.  I checked my NAB-WK-01234567\SQLEXPRESS and did not see the "Database1.sdf" in my NAB-WK-01234567\SQLEXPRESS. 2 Technical Questions to ask: (i) Are the tables "Books" and "Authors" in "Database1.sdf" different from the "Books" and "Authors" in my NAB-WK-01234567\SQLEXPRESS? (ii) Why do the tables "Books" and "Authors" in "Database1.sdf" not appear in my NAB-WK-01234567\SQLEXPRESS.  Please kindly help and answer these 2 questions. Other comments/tips related to these 2 questions are welcome to have.

Thanks in advance,

Scott Chang     

How to denormalize a normalized database

$
0
0

Hi all,

any one please explain me "how to denormalize a normalized database"

thanks in advance

thanks,

kishor

cannot open index in ssms

$
0
0

i want to open my index  as script select

but when i m trying to open ,getting following error

Lock request time out period exceeded. (Microsoft SQL Server, Error: 1222)


Configuring File Tables in SQL2012

$
0
0

I followed this MSDN blog:

http://blogs.msdn.com/b/sqljourney/archive/2012/11/10/how-to-sql-2012-filetable-setup-and-usage.aspx

I've done a little bit of work with filestream tables.  The Filetable table definition seems a bit sparce:

CREATE TABLE DocumentStore AS FileTable 
    WITH ( 
          FileTable_Directory = 'DocumentTable', 
          FileTable_Collate_Filename = database_default 
         ); 
GO

The filestream tables I created had a ROWGUID column, a table ID column, Varbinary(Max) for the document, FileType, etc. as in:

USE [ISR]
GO
/****** Object:  Table [dbo].[Documents]    Script Date: 2/20/2013 1:22:03 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Documents](
	[DocumentID] [bigint] IDENTITY(1,1) NOT NULL,
	[FilestreamID] [uniqueidentifier] ROWGUIDCOL  NOT NULL UNIQUE DEFAULT NEWSEQUENTIALID(),
	[TextIndex] [varchar](50) NULL,
	[TextType] [varchar](10) NULL,
	[Doc] [varbinary](max) FILESTREAM  NOT NULL,
	[Text] [varbinary](max) FILESTREAM  NOT NULL,
	[Title] [nvarchar](50) NOT NULL,
	[UserID] [int] NOT NULL,
	[FileName] [nvarchar](400) NULL,
	[FileExtension] [nvarchar](8) NULL,
	[ModifiedDate] [datetime] NULL,
 CONSTRAINT [PK_Document] PRIMARY KEY CLUSTERED 
(
	[DocumentID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] FILESTREAM_ON [FileStreamGroup1],
 CONSTRAINT [UQ__Document__6A858DF292516B12] UNIQUE NONCLUSTERED 
(
	[FilestreamID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] FILESTREAM_ON [FileStreamGroup1]
GO
SET ANSI_PADDING OFF
GO
--ALTER TABLE [dbo].[Documents] ADD  CONSTRAINT [DF_Documents_FilestreamID1]  DEFAULT (newsequentialid()) FOR [FilestreamID]
--GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Key Field' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Documents', @level2type=N'COLUMN',@level2name=N'DocumentID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Filestream unique ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Documents', @level2type=N'COLUMN',@level2name=N'FilestreamID'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Full Text Index' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Documents', @level2type=N'COLUMN',@level2name=N'TextIndex'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'may be used for full text search' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Documents', @level2type=N'COLUMN',@level2name=N'TextType'
GO

 

Will I need those other columns to do full text searches on the file table documents

Table partioning for archiving

$
0
0

Hi,

I have a database that is taking up approximately 66% of space on a network drive that also hosts other databases. The culprit is one table which is currently 40GB in size. I was considering table partitioning as a solution to archive off some of this data onto a different file group with more space available. The table is primarily used for reads. The data is to be retained, so I don't really have the option of purging historical records. If I have understood things correctly, am I correct in saying table partitioning would be a reasonable solution in this instance?

åThanks.

140 pagelatch_ex per second, but 0.01 milliseconds/latch, is that normal?

$
0
0

Lots of pagelatch_ex waits, but the cumulative time is tiny.

Is that anything to worry about?

(I select waits into a temp table, wait a few seconds, get another sample and compute the deltas)

Thanks,

Josh

Is SQL Server Enterprise 2012 supported on VMWare 5.0?

$
0
0
Is SQL Server Enterprise 2012 supported on VMWare 5.0?

SQL Backup

$
0
0

Hi

I am intending to take a full/complete backup of the database.Can you tell me if I need to shutdown the sql sever before taking a backup?

Thanks

Cancel / Rollback for two transactions

$
0
0

I began running two update queries three days ago.  I was using SQL Server Management Studio in a single window.  The window looked like this:

UPDATE mytable SET Field1 = Value1
UPDATE mytable SET Field2 = Value2

There are actually some joins to other tables but you get the idea.  There was no BEGIN TRANSACTION or anything like that.  From a NOLOCK query on mytable I can tell that all of the Field1 values have been updated successfully.  The start_time in sp_whoisactive is just from about an hour ago, leading me to believe that the second update statement just started an hour ago and the first one has completed.  In the SSMS query window I clicked Cancel Query.  The status bar in the window shows "Canceling...".  sp_whoisactive shows that SPID 110 has a value of 2 for open_tran_count.  If I run sp_whoisactive once, then a second time I can see that writes are continuing to increase.  The status is SUSPENDED.  I would be expecting to see ROLLBACK, but since there are two update statements maybe I'm wrong.

The question is this.  I'm ok with losing updates from the second statement, but don't want to lose the ones from the first statement.  If I use the KILL statement will it roll back the first update also, or just the second?  Also, if I do use the KILL statement should the ROLLBACK take just an hour or two since it has only been running for an hour?

Thanks!

P.S. - I had intended to add indexes before running this and forgot, left the office on Friday, and now I'm stuck with this little gem!

Memory utilization of SQL server 2000;2005,2008 &2008R2 sql servers

$
0
0

Hi All,

From past few days we are getting so many issues/alerts regarding sql server.exc is utilizing 90% of memory in 2000;2005,2008 &2008R2 sql servers

My question is there any check list i need to take into consideration when i get this kind of issue.

Regards


Maheshwar Reddy

Sql 2005 Profiler: No "Deadlock graph" appeared in trace

$
0
0

I ran a trace against a sql 2005 database and selected

Locks: Deadlock graph

Lock:Deadlock

Lock: Deadlock chain

We encountered a deadlock and the last two items were caught in the trace but not the Deadlock graph. It didn't appear at all. Any ideas why?

Note: I did not select any option under "Events Extraction Settings" (Save Deadlock XML events separately). Could that have caused my issue?

TIA,

edm2

SQL Portuguese Desktop Application on Polish Windows 7 Professional

$
0
0
Hi, I have a problem with one application in Portuguese installed on a Polish Windows 7 Professional. When I select any table, the fields doesn’t show up with the correct codepage. The database has the correct collation SQL_Latin_General_CP1_CI_AS and works fine in Sql Management Studio, but not in my applications. Any Ideas?
Viewing all 15264 articles
Browse latest View live


Latest Images

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