The Activity Monitor is unable to execute queries against the server !


I’m generally not a great fan of Activity Monitor which is built in with SSMS,however today I wanted to check some processes details and opened Activity Monitor after a long long time.

Straight away I was struck with this error.

Activity Monitor1

By using the ‘Show Technical Details’ button I tried to see if there is something which I can fix by myself,however there were no much details other than the program details for which I don’t have any visibility.

I was connected to a SQL2005 (9.0.5000) Instance using SSMS 2012 (11.0.3339.0) and was trying to launch Activity Monitor. Ideally this should have worked well without issues as higher version of SSMS should not have any issues connecting working with lower versions of Database Engine.

The error message also says that Activity Monitor is in paused state and use the context menu in the overview pane to resume it.

Activity Monitor2

This resume did not worked and apparently I received the same error message which I received in the beginning.

I tried multiple options, however there is nothing which I could find to get this fixed and start Activity Monitor properly.

Note – Rebooting SSMS unfortunately wont fix any problem permanently here.

I finally decided to use SQL 2008 R2 SSMS 10.50.4000 ( Yes, I had one !) and connected to the instance.

Viola, that worked ! Activity Monitor was just fine this time.

Activity Monitor3

This clearly means that the inability of SSMS 2012 to pull Activity Monitor for a SQL2005 Instance is because of a BUG.

A quick search on connect revealed some items related to this issue. Even though this connect item is dealing with a different version of SSMS and a SQL Engine, the issue seems to be the same.

I also tried connecting SQL2012 SSMS with SQL2012 and SQL2008 R2 instances and launched Activity Monitor successfully. Apparently the issue seems to be floating around with higher version of SSMS connecting to SQL2005 and trying to launch Activity Monitor.

Workaround –  I generally maintain major versions of SSMS on my work machine and this  comes handy during some instances.

Conclusion

Again this is not a mission critical bug which will cause work stoppage, however this should be fixed eventually and I hope SQLServer Product Team will fix this during upcoming SPs.

Thanks for reading and keep watching this space for more.

Linked Server created using a script is missing Product name and Data source fields !


Today I will discuss about an issue which was observed while creating a linked server via script.

The existing linked server was scripted out from a SQL2005 instance and the same script was used to create a linked server under a SQL2012(SP1/CU2) instance.

This a common procedure to follow if you are doing a side by side upgrade of SQLServer and ensure you have all objects in place under the new server.

After running the script the linked server was created successfully, however important details like Product name, Data source fields were found missing.

Here is the view which will explain the problem -

Linked Sever Issue Missing

The newly created linked server will work just fine, and users wont be facing any issues other than the missing details.

This looked like a bug to me right away and I opened a case with Microsoft.

Connect Item details - https://connect.microsoft.com/SQLServer/feedback/details/782793/linked-server-created-using-a-script-is-missing-product-name-or-data-source-fields

This is not a critical bug which will impact anyone badly, so I have a strong feeling that Microsoft might set low priority for this item and a fix might come only during the next release.

Conclusion

This is not an issue which is major, however details like Product name, Data source available to view comes handy if you need to trouble shoot issues related to linked server.

CU3 for SQL2012 SP1 – Couple of interesting hotfixes.


Here comes CU 3 (Build 11.0.3349.0.) for SQLServer 2012 SP1. You can download the same from http://support.microsoft.com/kb/2812412

Similar to CU2 there are some interesting hotfixes which are included in this CU release, and its worth testing it out.

The ones which attracted my attention are -

2800013

(http://support.microsoft.com/kb/2800013/  )

FIX:   Access violation when you put a FILESTREAM-enabled database offline in SQL   Server 2008 R2 or in SQL Server 2012

 

2803529

(http://support.microsoft.com/kb/2803529/  )

FIX:   Poor performance in SQL Server 2012 when you run a SQL Server trace

 

2807974

(http://support.microsoft.com/kb/2807974/  )

FIX:   Error 3456 after you add new file groups to the principal database in a SQL   Server 2012 asynchronous database mirroring environment

 

2813214

(http://support.microsoft.com/kb/2813214/ )

FIX:   CPU spike when there is no load on a server after you install SQL Server 2012   on the server

 

2819662

(http://support.microsoft.com/kb/2819662/  )

SQL   Server 2012 experiences performance issues in NUMA environments

The last 2 fixes attracted me a lot, however these are type of issues might not occur for all the environments. The CPU spike fix has a situation like a server with 64 or 128 cores +NUMA and 256GB – 1TB of Memory.These specifications are beyond imagination for small environments and majority of the enterprise(As of now !),so these might not even be a concern for the admin’s.

Conclusion

The decision to test or deploy CU3 for SQL2012SP1 varies from environment – environment and your approach towards CUs.

Thanks for reading and keep watching this space for more.

Apply CU2 for SQL2012 SP1 – Fix for Windows Installer starting repeatedly and causing CPU spikes !


CU2 for SQLServer 2012 SP1 is one key update which you should review and deploy if found necessary. I have found this very much needed for all my SQL2012 SP1 deployments. This CU contains a very important fix(KB2793634).

Note - The choice to deploy CU2 or just the fix (KB2793634) depends on your environment needs.

Here is why you need this fix -

As soon as you deploy SP1 for SQL2012 the Windows Installer (Msiexec.exe) process is repeatedly started to repair certain assemblies. Additionally, the following events are logged in the Application log:

EventId: 1004 Source: MsiInstaller Description: Detection of product ‘{A7037EB2-F953-4B12-B843-195F4D988DA1}’, feature ‘SQL_Tools_Ans’, Component ‘{0CECE655-2A0F-4593-AF4B-EFC31D622982}’ failed. The resource”does not exist.

EventId: 1001 Source: MsiInstaller Description: Detection of product ‘{A7037EB2-F953-4B12-B843-195F4D988DA1}’, feature ‘SQL_Tools_Ans’ failed during request for component ‘{6E985C15-8B6D-413D-B456-4F624D9C11C2}’

Source  – http://support.microsoft.com/kb/2793634

Here are the screenshots of the application log. These are shown as warnings, and could easily be missed.

InstallerIssue2

InstallerIssue1

When this occurs there is a spike in CPU.

This process is repeated every 2 minutes and can cause heavy registry usage issues.

Registry issues can cause multiple failures and a sample one is

InstallerIssue3

Note - Again, this varies from environment to environment.

Conclusion

Deploying the fix or the CU will resolve the issues related to the installer process.

Thanks for reading and keep watching this space for more.

Adding a Linked Server with ‘Oracle Provider for OLE DB’ as the provider – Proceed with caution !


Adding a linked server is an easy task which can be done at any point of time. I was under this same assumption until I came across a strange scenario.

CautionHere is the scenario for you all.

Use SSMS to create a New Linked Server and choose provider as ‘Oracle provider for OLE DB’

This one small step can bring the whole SQLServer to grinding halt if certain steps are not followed.

SSMS will be in frozen state during the New linked server creation step and eventually queries againt the databases will run forever.

Detailed explanation of the scenario

You wanted to create a new linked server with provider as Oracle provider for OLE DB.

Step 1 - The initial step to start of the whole process is to install the Oracle client on the SQLServer machine for which you want to add the linked server.

Step 2 – Oracle client installation will not force a reboot after the install is completed.

Step 3 – Without rebooting the server or recycling the SQLServices you will open SSMS and connect to the instance and see that the oracle provider is available.

LinkedServerIssue2

Step 4You will use SSMS wizard to create a new linked server and will choose the provider as Oracle provider for OLE DB.

LinkedServerIssue1

As soon as you select the provider you can notice that new linked server creation window will be in frozen state.

Any queries made against the databases will run indefinitely.

This situation will continue till you force a reboot of the machine. You cannot even recycle SQLServices as the service will fail to restart.

Think about a situation  -  You are doing this on a live production environment during normal business hours. As mentioned earlier this simple task can slowdown everything and can bring the server to a halt.In case the server is business critical, then rest is history(Start updating the resume !)

Right way of doing things

You will need to schedule changes like these ideally during a change window. You will need to recycle the SQL services or even bounce the box soon after the Oracle client is installed. This is a very important step. Once the server is up and running after the reboot you can either use SSMS to create the linked server or can opt to use sp_addlinkedserver system stored procedure. This time there wont be any slowness or performance related issues.

Conclusion

This simple scenario forced me to think twice and made up my mind to stick to one policy ‘Changes to business critical servers occurs only during a dedicated change window period’ no deviations what so ever.

Thanks for reading and keep watching this space for more.

Get Database information in mail using PowerShell !


Would you love to get a weekly status report of all the databases hosted on your mission critical servers? ,Would you love to get a report which will help you maintain and manage your large shared SQLServer environments neat and clean?

If your answer is Yes, then powershell is your solution. Welcome to the world of powerful powershell(Well, that sounds like a good marketing buzz word !).

logo-powershell

Lets’ think about a large enterprise situation where in you are managing a huge SQLServer shared server which has many databases. Each day your DBA team members will be adding new databases to the server, and you would like to get a status report to ensure that the databases are compliant to the regular database ‘rules’ as you are responsible for the well being of the environment.

Example – No database can have a compatibility level which is less than 110,No databases can have owner other than SA etc.

I’m a great fan of the articles written by Microsoft Scripting Guy, Ed Wilson(B) and one of his articles gave me a quick idea of deploying a powershell function which will pull the database details on a weekly basis.

I slightly modified his code mentioned in the article here (This is a very useful/detailed article, and I highly recommend this to everyone ) and my little function will pull database information such as Name,PageVerify,CompatibilityLevel,Size,LastBackupDate,Recoverymodel,Owner etc and will send across an email.

Note – All credits goes to Ed for his original code. I have great respect for Ed,and if you are interested in powershell, then I highly recommend reading his articles.

Here is the powershell function   -

#Remember to make changes for SMTP area

Function Get-DBInfo ($SQLInstance)

{

    if ($SQLInstance.Contains(“`\”))

        { $location = “SQLSERVER:\SQL\$SQLInstance\Databases” }

    else

        { $location = “SQLSERVER:\SQL\$SQLInstance\DEFAULT\Databases” }

    $style = ‘<style>’

    $style = $style + ‘BODY{background-color:peachpuff;}’

    $style = $style + ‘TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}’

    $style = $style + ‘TH{border-width: 1px;padding: 2px;border-style: solid;border-color: black;background-color:thistle;font-size:16}’

    $style = $style+ ‘TD{border-width: 1px;padding: 5px;border-style: solid;border-color: black;background-color:palegoldenrod;font-size:14}’

    $style = $style + ‘</style>’

        $body=dir -force  $location | where-object {$_.Name; $_.Refresh()} |

        Select Name, CompatibilityLevel,Pageverify,Size,LastBackupDate,RecoveryModel,Owner |ConvertTo-Html -Head $style -Property Name,CompatibilityLevel,Pageverify,Size,LastBackupDate,RecoveryModel,Owner |Out-String

        #Set your smtpserver information

        Send-MailMessage -To “anupsiva.das@abc.com” -Subject “Database Details from SQL2012 – Notification” –From “dba@abc.com” -SmtpServer “mailserver.abc.com” -Body $Body -BodyAsHtml

}

Get-DBInfo SQL2012

<Modified 01/27/2013> Above code was modified to pass the correct variable <Modified>

If you schedule this function as a SQL Job then you will receive automated emails according to your requirements.

Here is a sample email which was generated by the Get-DBInfo function.

Powershell Notification

Conclusion

Automated reports is going to help DBAs a lot and powershell is making life more easier by helping us to create highly flexible functions.

Thanks for reading and keep watching this space for more.

Check the version of Windows Installer !


This post is a quick tip to find the version of Windows Installer installed on your box.

You might wonder why I ever need to check this version, so here is my small story -

Today I was installing SQLServer 2008 Upgrade advisor for a Windows Server 2003(SP2) box(Pretty old one) and right away got this error -

CopyIssue3

The error message was pointing that the server might be running an old version of windows installer.

I decided to check what was the basic system requirements to install SQLServer 2008 Upgrade Advisor. Oh btw, that check should have been done earlier, but you know these things happen sometimes ! [With a promise not to repeat it later on].

SQLServer 2008 Upgrade Advisor needs Windows Installer 4.5 to work and that’s clearly mentioned in the download page.

WindowsInstaller1

Now I was curious to see what is the version of windows installer which is currently running.

How do I do that? I haven’t bothered to check that in the past too.

Confusedboy

After doing some random search I finally got a simple answer to my question, thanks to http://stackoverflow.com/.

The best and easiest way to check the version is by typing msiexec in Run prompt to get

WindowsInstaller2

This quickly tells you about the version.

I did little more checks to find that there is yet another way to check the version details and that’s by directly checking the .DLL files.

Note – System files should never be modified, moved or deleted.

WindowsInstaller3

The above picture shows the details of Windows Installer version once it was updated to 4.5 which was the basic requirement for SQLServer 2008 Upgrade Advisor.

I know you are now thinking of Windows Installer 5.0,here is that information for you.

The Windows Installer 5.0 is part of the Windows Server 2012, Windows 8, Windows Server 2008 R2, and Windows 7. There is no redistributable for Windows Installer 5.0.

SQL Server 2012 Upgrade Advisor also needs Windows Installer 4.5.

Conclusion

One error helped me to learn something more about windows installer and if you are interested too,then here are some links for you

http://msdn.microsoft.com/en-us/library/windows/desktop/cc185688(v=vs.85).aspx

http://en.wikipedia.org/wiki/Windows_Installer

http://www.advancedinstaller.com/user-guide/msiexec.html

Thanks for reading and watch this space for more.

Quick alert on servers which are not compliant for policies set using PBM


Last month I wrote about leveraging policy based management for regular DBA compliance checks. You can read that post here.

Policy based management(PBM) is indeed one of my favorite features. I normally like to play around exploring more and more about it, and eventually end up learning something new(Yay!).

Today’s post is based on that surprise learning. Small but very useful feature.

PBM currently lacks flexible reporting capabilities like sending an automated email to the DBA every week stating compliance status or even a reporting dash-board for the DBA to constantly monitor the details. I hope Microsoft is working on these enhancements, and we can expect some good news when next major bits of SQLServer is out.

Note - Enterprise policy management framework has great enterprise wide policy compliance reporting capabilities, and I’m still exploring this great tool. This is a codeplex project and you can explore the same by following http://epmframework.codeplex.com/

So here is my little story – When I walk in to office on a Monday morning I wanted to know which servers are having compliance issues. To start of I ‘m interested to check my super critical business servers. I used to connect to those servers and do a View History(Under Management->Right click Policy Management)  to get the details of compliance issues.

Note - I evaluate my policies on a schedule.

Recently I observed a quick alert when connected to a  server from SSMS which was telling me that there was a policy compliance issue, and I need to act on it.

The alert looks like – PBM Visual Alert There was indeed a policy violation which was picked by a schedule which ran on the weekend. Monday morning when I connected to that box,SSMS reported me that there is a policy violation via the above described small(but very helpful) graphical alert.

Once we fix the compliance issues, the alert is removed. PBM Visual Alert2 Conclusion

These simple but useful features is indeed helpful for DBA’s to have better control over compliance issues and I’m really looking forward for more and more features and enhancements for PBM from Microsoft SQLServer team.

Thanks for reading and keep watching this space for more.

Leverage Policy Based Management for regular Page Verify =Checksum compliance monitoring


Page Verify = Checksum is one option which I like all my servers to be compliant. By default all the new databases which gets created will have page verify = checksum as this option is inherited from the model database.

NOTE – APPLICABLE FROM SQL2005 AND ABOVE.

SELECT name,page_verify_option_desc FROM sys.databases
WHERE database_id=3

name                                page_verify_option_desc
=======                         ==================
model                               CHECKSUM

So far so good. But what will happen if we restore a database from SQL 2000 or even restore a database which is having a different page verify option other than checksum.

Lets check that out -

For the demo purpose on Server A we already have a database named Check_Page_Verify which is having a different page_verify option set as NONE(Bad idea !).

****Server A****

--Check the page_verify option of the db
SELECT name,page_verify_option_desc FROM sys.databases
WHERE database_id=6

name                         page_verify_option_desc
=====                       ==================
Check_PageVerify     NONE

We will back this database up and will restore it in Server B.

****Server A****

--Backup the database
BACKUP DATABASE Check_PageVerify
TO DISK='I:\Check_PageVerify.bak'
****Server B****

--RESTORE the database
RESTORE DATABASE Check_PageVerify
FROM DISK='I:\Check_PageVerify.bak'
WITH MOVE 'Check_PageVerify' TO 'D:\Check_PageVerify.mdf',
MOVE 'Check_PageVerify_log' TO 'D:\Check_PageVerify_log.LDF'

“Data file and log file in the same drive ! (Bad idea),however as this is a demo we can ignore this.”

In Server B lets check the page_verify option

****Server B****

--Check the page_verify option of the db
SELECT name,page_verify_option_desc FROM sys.databases
WHERE database_id=6

name                              page_verify_option_desc
=====                            ==================
Check_PageVerify          NONE

I started this post by saying Page Verify = Checksum is one option which I like all my servers to be compliant. Now after this restore my server is not complaint anymore for page verify. I will never come to know about this miss until and unless I regularly do compliance checks.

So how do we do that compliance checks ? This is where Policy Based Management (PBM) comes into picture.
We will need to create a condition first using the wizard.

PBM PageVerify1

I’m using facet ‘Database options’ for this demo and added the expression @pageverify= checksum.

Now, lets create a policy for this condition.

PBM PageVerify2

When creating the policy we will need to choose the condition which we created earlier. The evaluation mode for this policy are of 3 types

1. On demand 2.On schedule and 3.On change Log only.

To know more about PBM concepts please ref http://technet.microsoft.com/en-us/library/bb510667.aspx 

We are picking On schedule for this demo. This option needs a schedule to be created. We will create a schedule which will run at 12 AM every Sunday.

PBM PageVerify3

Once the schedule is created we need to ensure that policy is enabled.

PBM PageVerify4

The idea is to have the schedule run every Sunday to check if there are any databases which are violating the rule of page verify = checksum and on Monday morning when we come to work we will just need to check history of the policy to see if there are any violations.

For the demo purpose, lets trigger the schedule to run manually.

PBM PageVerify5

This is the job which was created automatically for the schedule which we created earlier.

After running the job successfully, all we need to do is check the history of the policy

PBM PageVerify6

There you go, we got the first violation details of the policy

PBM PageVerify7

It clearly says database Check_PageVerify is not compliant for the policy which we created.

If you have multiple databases which are not compliant, then you have the option to evaluate the policy manually ,choose the one which are not complaint and force them to be complaint.

PBM PageVerify8

PBM PageVerify9

PBM PageVerify10

PBM PageVerify11

Great, now we have everything under control and all the databases are compliant.

Conclusion

There are great things which we can do with PBM and if you have a better way to achieve this using PBM(Alternate facets,condition etc) or any other methods, then I’m eager to hear from you.

Keep watching this space for more.

Thanks for reading.

DBCC Memorystatus SQL2012 – A quick observation for node Process/System Counts


This post is not a detailed explanation of DBCC Memorystatus for SQL2012,but a quick observation I made recently for the node Process/System counters.

This is one area to look at under DBCC Memorystatus output to get a quick snap shot of the current state of memory and understand if there is a memory pressure.

In SQL 2012 you are provided with this information,ie info from the Process/System counters right away you run DBCC Memorystatus. This is the first set of data which is retrieved by the DBCC command.

DBCCMem1

I really liked the idea of getting information like system physical memory high/low, Process physical/virtual memory low etc right away I run DBCC as this info is one which I look at all the time during initial analysis phase.

In SQL 2008 R2,you still have this data but you will need to scroll all the way down to get this info. Still good, atleast we have this info for a quick ref.

In SQL2005,you don’t have this info at all.Yes,things are not so easy during the early days !

Conclusion

The process and system counters section is very useful and keep watching this space for more.

Thanks for reading.