Thanks, Purna
How to start the default instance of SQL Server in single-user mode through Command Prompt
SQL server instance getting corrupted.
Two months back, the SQL server instance which we were using got corrupted and getting the Error 26. We had contacted MS and they recreated the SQL instance. Yesterday the same issue repeated again. Now we are using Instance name,Port number for accessing the DB.
Is there any particular reason for this corruption?
Can i have a link for recreating sql server instance with same name?
How I need to run procedure in every database
Upgrading 2008 Standard Edition to SQL Server 2008 R2 Enterprise Edition
We need upgrade our SQL Server 2008 Standard Edition to SQL Server 2008 R2 Enterprise Edition, i have gone through couple of links as below.
http://msdn.microsoft.com/en-us/library/ms144267(v=sql.100).aspx
Wanted to know how do we upgrade from 2008 Standard Edition to SQL Server 2008 R2 Enterprise Edition, becuase here we have upgrade the Edition and also version.
Below link says we can upgrade from SQL Server 2008 Standard Edition to SQL Server 2008 R2 Enterprise Edition
http://msdn.microsoft.com/en-us/library/ms143393(v=sql.100).aspx
so my question is Do we have to upgrade SQL Server 2008 Standard Edition to SQL Server 2008 R2 Standard Edition Edition and then Upgrade the Edition to R2 Enterprise Edition
or
else we can directly Upgrade from SQL Server 2008 Standard Edition to SQL Server 2008 R2 Enterprise Edition.
please guide me and also let me know with Pre and post Upgrade Checklist
Error: 17204 (FCB::Open failed) - How to set persmission correctly on a data/log file for SQL Server
Hello,
Is there a process/procedure available in SQL Server which allows SQL Permission to be set properly for a given instance when a new drive is added? It seems like only way, that I know of, is to copy ACLs from existing data drive to this new drive to make this work, otherwise we get the following error:
FCB::Open failed: Could not open file J:\sql\mnt\UsrDB01\Data\XX.mdf for file number 1. OS error: 5(Access is denied.).
For a clustered drive adding it SQL Server service and applications does not seem to work either. Again I have to copy ACLs to make it work.
I did search through Google/Bing, but could not find any meaningful resources (other than copy ACLs, add SQL Server account to the directory manually, etc.). One would hope a set defined process set permission (similar to the process when SQL Server sets permission these drives (folder) while installing it).
Thanks,
Vijay
Script to shrink the database file size
Procedure for giving range of unique identity values produced duplicate ids after sql cluster failover
we use the following (german) sql2008r2 environment
===================================================
Microsoft SQL Server Enterprise Edition (64-bit)
Microsoft Windows NT 6.1 (7601)
NT x64
10.50.2789.0
4-node failover cluster
===================================================
The following procedure is executed by serveral self programmed .net windows services installed on 4 application servers.
CREATE PROCEDURE [dbo].[prc_GetRsnVergabeByTyp]
@Typ VARCHAR(50)
,@Anzahl INT
AS
BEGIN
IF (@Anzahl < 1)
BEGIN
RAISERROR('Value must be greater than 0!', 16, 1);
END;
UPDATE
dbo.RsnVergabe
SET
WertVon = (WertBis + 1)
,WertBis = (WertBis + @Anzahl)
,GeaendertAm = GETDATE()
,GeaendertVon = SUSER_NAME()
OUTPUT
inserted.WertVon
,inserted.WertBis
WHERE
Typ = @Typ;
END
Today the sql-instance with this logic crashed and a cluster failover happened (as expected).
Directly after the instance was online again (on another sql server node) we received 1.000 "primary key" failures within the application.
Our dba found the following message in the windows eventlog:
------------------------------------------------------------
The Transaction (UOW=%1, Description='%3') was unable to be committed, and instead rolled back; this was due to an error message returned by CLFS while attempting to write a Prepare or Commit record for the Transaction. The CLFS error returned was: %4.
------------------------------------------------------------
As a result of team research we think that the procedure was executed by a windows service which received a normal block of 1.000 ids successfully.
The server crashed before the update on dbo.RsnVergabe could be written to disk (ldf and/or mdf). After failover a windows service requested a new block of 1.000 unique ids.
Normaly those ids should have never been sent by the database before. But the sql server returned the same ids that have been returned in the previous request. This resulted in our primary key problem.
Might this be the reason for our problem and how can we prevent this situation in future.
Thanks for any advise.
Best regards
Thorsten Müller
Database/table repair
I want to repair the one database table and it size is almost 700 GB and running on SQL 2008 R2 instance. i set to tempdb as auto growth.
when i ran dbcc checktable and with an hour tempdb disk drive got full (50 GB).
Since i have 16 cores cpu,shall i create the 4 tempdb with disable the autogrowth option?
If i disable the auto growth, what would the datafile intial size limit i have to set? and can i create multiple tempdb in the production SQL server
Please advice on this
Many thanks
Rocky
Differential Backup getting failed and the error: Msg 3035, Level 16, State 1, Line 1
Hi,
We have configured Weekly Full Backup & Daily Differential backup through maintenance plan in SQL Server 2005 with SP3 and it was working fine till this Tuesday.
On Wednesday the Daily Differential backup was failed. I have checked the error message on the log file. Also, I have tried to execute the differential backup for this database from SSMS. At that also the below mentioned same error message is coming.
Msg 3035, Level 16, State 1, Line 1
Cannot perform a differential backup for database "DBName", because a current database backup does not exist. Perform a full database backup by reissuing BACKUP DATABASE, omitting the WITH DIFFERENTIAL option.
Msg 3013, Level 16, State 1, Line 1
BACKUP DATABASE is terminating abnormally.
I checked that the last Full backup was taken successfully and it is residing on the same server.
I have tried to take the differential backup for some other database on the same instance and I am able to take the differential backup successfully for other databases.
Tuning Log Shipping Agents on SQL 2008 R2
I've got a server that's hosting about 100 log shipping secondary databases. I frequently see messages like this in the sqlagent.out file.
"2012-03-23 08:00:11 - + [398] The job (LSRestore_dbname) has been queued because the maximum number of working threads (200) are already running. This job will be executed as soon as one of the working thread finishes execution."
I've got a couple of questions.
Where is the 200 coming from? My max worker threads setting is 512.
Which subsystem do the LSRestore jobs use? Isn't it CmdExec? My CmdExec subsystem's worker threads is set it 20 not 200. What I typically see is about 25 LS jobs executing and > 100 waiting for worker threads.
If I want to increase the max workers on the correct subsystem to avoid this error, which subsystem do I do it on?
Chuck
EVENT SESSION practical usage
What is an EVENT SESSION and the purpose of it. What purpose and advantage does it serve?
I created a test EVENT SESSION and did not see it in SSMS 2008 R2, but I see it created by doing the query below. Where exactly do all these events reside?
SELECT * FROM sys.server_event_sessions
Thanks in advance.............
Reorganing and Rebuilding Indexes and the Transaction Log
SQL Server Fast Track Datawarehouse server, performance issues..
Hi,
We have a fastrack dw server, 256 GB memory, 48 CPU(physical 8*6), about 12 TB data.
When i run this query to see the granted memory
SELECT mg.granted_memory_kb, mg.session_id/*, t.text, qp.query_plan */,requested_memory_kb,granted_memory_kb,required_memory_kb, used_memory_kb,max_used_memory_kb
FROMsys.dm_exec_query_memory_grantsAS mg
CROSSAPPLYsys.dm_exec_sql_text(mg.sql_handle)AS t
CROSSAPPLYsys.dm_exec_query_plan(mg.plan_handle)AS qp
ORDERBY 1 DESC OPTION (MAXDOP 1)
Go
I see only three rows with granted memory
Part of the output
granted_memory_kb, mg.session_id requested_memory_kb
43258760 66 43258760
7630296 211 7630296
1024 117 1024
1024 243 1024
NULL 277 272664
Followed by all NULL
These two values add up to about 50 GB and the remaining all NULL values (meaning waiting for memory to be granted). This is a 256 GB box with max server memory (MB) to 219 GB for SQL.
What happened to all the memory, how do I see that 219 GB allocated to SQL is used?
I tried dbcc memorystatus and here is the output of it. I do not know how to interpret this, can someone help me please here?
Posting only a part of dbcc memorystatus output here:
Memory Manager KB
---------------------------------------- -----------
VM Reserved 282869368
VM Committed 1838440
Locked Pages Allocated 234065920
Reserved Memory 1024
Reserved Memory In Use 0
MEMORYCLERK_SQLGENERAL (Total) KB
---------------------------------------- -----------
VM Reserved 0
VM Committed 0
Locked Pages Allocated 0
SM Reserved 0
SM Committed 0
SinglePage Allocator 17272
MultiPage Allocator 5760
MEMORYCLERK_SQLQUERYEXEC (Total) KB
---------------------------------------- -----------
VM Reserved 0
VM Committed 0
Locked Pages Allocated 0
SM Reserved 0
SM Committed 0
SinglePage Allocator 43192
MultiPage Allocator 208
Buffer Pool Value
---------------------------------------- -----------
Committed 28800000
Target 28800000
Database 24880874
Dirty 6459427
In IO 0
Latched 9
Free 1716
Stolen 3917410
Reserved 13508246
Visible 28800000
Stolen Potential 9934344
Limiting Factor 17
Last OOM Factor 0
Page Life Expectancy 371
(14 row(s) affected)
Process/System Counts Value
---------------------------------------- --------------------
Available Physical Memory 18337685504
Available Virtual Memory 8504458215424
Available Paging File 106100379648
Working Set 948097024
Percent of Committed Memory in WS 100
Page Faults 109165443
System physical memory high 1
System physical memory low 0
Process physical memory low 0
Process virtual memory low 0
(10 row(s) affected)
Procedure Cache Value
---------------------------------------- -----------
TotalProcs 11441
TotalPages 72254
InUsePages 4778
Memory Pool (internal) Pages
---------------------------------------- -----------
Allocations 7709
Predicted 7709
Private Target 0
Private Limit 0
Total Target 27360000
Total Limit 27360000
OOM Count 0
Memory Pool (default) Pages
---------------------------------------- -----------
Allocations 17417944
Predicted 18524594
Private Target 0
Private Limit 0
Total Target 27360000
Total Limit 27360000
OOM Count 0
Suresh Channamraju
Graphical Execution Plan not displayed
Hi,
I am on 2008 R2 SP1.I am trying to see execution plans for my stored procedures which are cached in memory.I queried some dmv which displayed a link to see the execution plan. But when I click there, it displays the plan in XML format and not in its graphical format. I never faced the issue earlier. Please guide me.
Thanks
Chandan
2005 how to output messages from job
I have created a job to run a few update groups. So I get many messages indicating how many rows were affected. I am using the job log to a file option but it is only capturing the messages for selects, not the updates? I want bothm how do I get it to send the messages to the job log file?
example output:
sql102
1 row affected
(6881 row(s) affected)
(129 row(s) affected)
(129 row(s) affected)
In log file iget:
sql102
1 row affected
View image stored in VARBINARY(MAX) column in SQL SERVER 2008
How to select and view the .jpg image stored in VARBINARY(MAX) column in SQL SERVER 2008?
Thanks!
Support for virtual labs?
TIA, ChrisRDBA
percent_complete in sys.dm_exec_requests DMV
Manish
Weird performance issue in SQL Server 2012
Hi, I have been experiencing a very weird problem.
I have a SQL 2012 SP1 running in a IBM server, and another running in a PC. OS is Windows 2008 R2. The IBM server has better performance than PC.
I developed a program to insert tens millions of data to one table. I am using C++ and ADO. The werd problem is the program run dramatically faster in PC than IBM server. It took 8 seconds to insert ten thousand records, while it 60 seconds in IBM server. The SELECT query in PC also is faster than IBM server, but not too much.
I believe in the IBM server has better performance than PC. While I use SQL script to insert ten thousand records in SSMS, IBM server just take 1 second, very faster, while PC take 4.5 seconds. The SQL is very simple, just likes:
while (i < 10000)
{
insert employee
value(@name, @age)
}
All configurations are same, and are default.
While I monitor the performance in SQL profiler,except for the During, others are same. The During value in IBM server is 5, while it is 0 in PC. Write is 0. Read is 20. Both CPU usages are low, about 24%. While running the program, the data transfer rate (IO) is 600K to 1M per second in IBM server, and 2M to 4M in PC.
Why is it slow while I run program to insert data, and faster while I using script in SSMS?
Does someone have run into same issue? Any suggestion?
Weird ID incrementation
Hello!
I've got a "Computers" table in my db with the ComputerID column set as PK, ID, not null.
Up till now when I was adding a row to the table the value of "ComputerID" column was being incremented by 1, for instance: 230, 231, 232...248. When I added one more row this morning this value was incremented by 1000 (the next row has ComputerID = 2048), the second added row has the value = 2049.
Tell me please whether it's normal behavour of auto-increment or not?
Thank you in advance,
Michael