Skip to content

Posts tagged ‘SQL Server’

SQL Server database restarting every couple of minutes

ISSUE:

You may face an issue when your database is just restarting every couple of minutes and you can see check DB is running at same frequency under same spid, when you look into the SQL Server error log. But users are able to connect to database without any issues.

Below is the error message that you will find in SQL Server error log stating that database is starting:

Date                         6/6/2013 10:10:43 AM

Log                            SQL Server (Current – 6/6/2013 10:10:00 AM)

Source                     spid69

Message

Starting up database ‘WW_Testing’.

Below is the error message that you will find in SQL Server error log stating that checkdb is running on this database:

Date                         6/6/2013 10:10:43 AM

Log                            SQL Server (Current – 6/6/2013 10:10:00 AM)

Source                     spid69

Message

CHECKDB for database ‘WW_Testing’ finished without errors on 2013-06-01 11:00:24.160 (local time). This is an informational message only; no user action is required.

CAUSE:

Regarding database restart, this will happen because you have set auto close database setting to enabled. So, your database is closed as soon as the last connection to this database is closed, but DB again restarts as soon as a new request to connect to database comes to SQL Server instance.

You can run below query to find if it is enabled or not. If output is 1 then its enabled If 0 then its disabled.

select is_auto_close_on from sys.databases

where name='DBNAME'

Now regarding checkDB running at same frequency, This is not a issue. SQL Server always performs checkDB whenever any database is started. This is to make sure a consistent copy of database is available before coming online. You will notice that this message comes every time after the Starting database message.

RESOLUTION:

Only thing you need to do is to disable database auto close parameter by running below query in master database or by changing that by going to SSMS –> Databases –> DBNAME –> Right Click –> Properties –> Options –> Auto Close and set it to FALSE.

USE [master]

GO

ALTER DATABASE [Test] SET AUTO_CLOSE ON WITH NO_WAIT

GO

How to modify PSSDiag to run on different server?

If you already have a PSSDiag.exe provided by Microsoft and for some reason you have to run the same PSSdiag to collect same information in different server or database instance then you can do it easily just by making coule of chnages in PSSDiag.xml file.

NOTE:- When you run PSSDiag.exe, it will extract all the required files and one of that will be PSSDiag.xml

Steps to do:
1) Open PssDiag.xml in notepad.

2) Update Machine name. This will be server where your database instance is installed.
<Machine name=”TESTMachine.usa.com”>

If you are planning to run PssDiag by copying all files to srever and run from there, then you can just put “.” also. Dot means local serevr and should run fine.

3) Update database instance name.For named instance:
<Instance name=”SQL2008″ windowsauth=”true” ssver=”10″ user=””>

For default instance:
<Instance name=”MSSQL” windowsauth=”true” ssver=”10″ user=””>

4) Save the file and then pssdiag.

PSSDiag is created based on OS version, 32/64 bit machine, SQL Server version and database instance name. SO, above changes will work fine only if you are editting PSSDiag.xml file which was originally created for same OS version and 32/64bit machine.
For different SQL Server version and instance name, the above changes will work fine.