SQL 2008 Reporting services – ReportServerStorageException: An error occurred within the report server database. This may be due to a connection failure, timeout or low disk condition within the database.

Had some strange error accessing the history tab and some of the other tabs of some scheduled reports in SQL 2008 SP1.

With a misleading error “   ReportServerStorageException: An error occurred within the report server database.  This may be due to a connection failure, timeout or low disk condition within the database.”

I at one time restored these databases after a server reinstall from a failed SP1 upgrade. Everything worked for the most part but these odd errors on some reports kept happening.

This error pointed me in the right direction when expanding the schedules tab in SSMS connected with Reporting services

EXECUTE permission denied on object ‘xp_sqlagent_notify’, database ‘mssqlsystemresource’, schema ‘sys’.

To resolve this ensure the rsexecrole exists in Master, MSDB, ReportServer & ReportServerTempDB

then run the following script

USE master
GO
GRANT EXECUTE ON master.dbo.xp_sqlagent_notify TO RSExecRole
GO
GRANT EXECUTE ON master.dbo.xp_sqlagent_enum_jobs TO RSExecRole
GO
GRANT EXECUTE ON master.dbo.xp_sqlagent_is_starting TO RSExecRole
GO

USE msdb
GO
GRANT EXECUTE ON msdb.dbo.sp_help_category TO RSExecRole
GO
GRANT EXECUTE ON msdb.dbo.sp_add_category TO RSExecRole
GO
GRANT EXECUTE ON msdb.dbo.sp_add_job TO RSExecRole
GO
GRANT EXECUTE ON msdb.dbo.sp_add_jobserver TO RSExecRole
GO
GRANT EXECUTE ON msdb.dbo.sp_add_jobstep TO RSExecRole
GO
GRANT EXECUTE ON msdb.dbo.sp_add_jobschedule TO RSExecRole
GO
GRANT EXECUTE ON msdb.dbo.sp_help_job TO RSExecRole
GO
GRANT EXECUTE ON msdb.dbo.sp_delete_job TO RSExecRole
GO
GRANT EXECUTE ON msdb.dbo.sp_help_jobschedule TO RSExecRole
GO
GRANT EXECUTE ON msdb.dbo.sp_verify_job_identifiers TO RSExecRole
GO
GRANT SELECT ON msdb.dbo.sysjobs TO RSExecRole
GO
GRANT SELECT ON msdb.dbo.syscategories TO RSExecRole
GO

SQL 2000 and Vsphere 4 drivers

Looks like an old bug came back in VSPhere4 concerning SQL 2000 – When you update the VM tools MSVCP71.dll goes missing and the SQL service will not start.

Version 4.0.0, build 164009

This can be resolved by placing the file back into the %SYSTEMROOT%\System32 folder

The application-specific permission settings do not grant Local Launch permission for the COM Server application with CLSID {46063B1E-BE4A-4014-8755-5B377CD462FC}

When using a domain account that is not a local administrator in SQL 2008 & SP1 as the SQL Agent service account I see the error:


The application-specific permission settings do not grant Local Launch permission for the COM Server application with CLSID
{46063B1E-BE4A-4014-8755-5B377CD462FC}
to the user *DOMAIN ACCOUNT* SID (S-1-5-21-651981998-221456604-1849977318-14822). This security permission can be modified using the Component Services administrative tool.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

To correct this

– open com permissions
Component services, computers, my computer,
DCOM config, find the MSDTSServer100
Properties
Security
Launch and Activate permissions – edit
Add the local SQL AgentUser group and enable local launch and Local activation

More powershell SQL cmdb type stuff

I think there is a lot of potential using powershell to build a cmbd.

rhyscampbell on twitter has a great post on his site

Also Chad Miller cmille19 on twitter has done some great stuff with the  sqlpsx project

I  am still pursuing using merge but there is definately an advantage to dropping to csv and then using etl in in one go.

updated – with version check, uptime

I figured out how to do get variables from a query. So i added a second get-sqldata function within the loop

Because i have a mixed environment i need a version check to set the sysprocess table or view -The new columns will need to be added to the merge statement in the the previous script and the table updated

if ($srv.Version.ToString() -lt "9.00.0000.00")
{$sysprocesses = "sysprocesses"}
else
{$sysprocesses = "sys.sysprocesses"}
#Write
-Host $sysprocesses
function Get
-SqlListsstarttime
{
Get
-SqlData $Server "master"  "SELECT login_time AS Started ,DATEDIFF(DAY, login_time, CURRENT_TIMESTAMP) AS daysUptime FROM $sysprocesses where spid = 1;
"
| foreach {$_.started,$_.daysUptime} |
foreach { $uptimeList.Add("$_") > $null }
}# gets time started and uptime
Get
-SqlListsstarttime
$started
= $uptimelist[0]
$daysuptime
= $uptimelist[1]

Powershell, Monitoring and the Central Management Server


/****** Object:  Table [dbo].[ServerInfo]    Script Date: 05/29/2009 15:46:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ServerInfo](
[ServerID] [int] IDENTITY(1,1) NOT NULL,
[LastUpdated] [datetime] NULL,
[Server] [varchar](50) NULL,
[Instance] [varchar](50) NULL,
[Version] [varchar](50) NULL,
[Edition] [varchar](50) NULL,
[ServicePack] [varchar](50) NULL,
[TimeStarted] [datetime] NULL,
[BackupDirectory] [varchar](250) NULL,
[defaultfile] [varchar](250) NULL,
[defaultlog] [varchar](250) NULL,
[installdatadirectory] [varchar](250) NULL,
[osversion] [varchar](50) NULL,
[physicalmemory] [int] NULL,
[errorlogpath] [nvarchar](250) NULL,
CONSTRAINT [PK_ServerInfo] PRIMARY KEY CLUSTERED
(
[ServerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,

IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

I have been looking at gathering basic information in my environment using powershell. There is some good stuff out there. I have been using the CMS server registered server function to query multiple servers but the problem is you can only query against them and not write to your CMS without using linked servers.

So I looked at some of the projects on Codeplex  – Buck Woody’s SQLCMS got me interested in extending the CMS datawarehouse.

Sqlserverpedia has some good info on building a CMDB and extending the CMS datawarehouse too

Then I took a look at Chad Millers SQLPSX project he has written some excellent functions and has a complete Powershell “base” on codeplex. I learnt a lot from looking throught the scripts and functions.

Using the SQLPSX library and functions, I wrote a powershell script that queries each server in your Central Management Server by group or as a whole returning basic information like version, Service pack, default backupfolder, OS version, Memory and path location information and merges it into a table so it can be run repeatedly.

*use at your own risk of course :-)

**this requires the SQLPSX library – see above

[void][reflection.assembly]::LoadWithPartialName(“Microsoft.SqlServer.Smo”)

##Point to library files

$scriptRoot = Split-Path (Resolve-Path $myInvocation.MyCommand.Path)

#. $scriptRoot\LibrarySmo.ps1

Set-Alias Test-SqlConn $scriptRoot\Test-SqlConn.ps1

##Define variables

#CMS Server

$sqlServer = “YOURSERVERNAMEHERE”

$dbName = “msdb”

$ServerList = New-Object System.Collections.ArrayList

##CMS server Group

$serverGroup = “CMS SERVER GROUP NAME OR % FOR ALL”

##CMS database

$dbTARGET = “DATABASE WITH THE TABLE _SCRIPT AT THE BOTTOM”

##CMS Table

$tblServerInfo = “TABLENAME”

#######################

function Get-SqlList

{

Get-SqlData $SQLServer $dbname  “SELECT DISTINCT

s.server_name as server

FROM    dbo.sysmanagement_shared_server_groups_internal g

INNER JOIN dbo.sysmanagement_shared_registered_servers_internal s ON g.server_group_id = s.server_group_id

where   g.NAME LIKE ‘$serverGroup’

” | foreach {$_.Server} | Test-SqlConn |

foreach { $ServerList.Add(“$_”) > $null }

#Write-Host $ServerList

}# Get-SqlList

Get-SqlList

while ($ServerList.Count -gt 0)

{

$server = $ServerList[0]

#Launch Another Thread

#Write-Host $server

## open database connection

$conn = New-Object System.Data.SqlClient.SqlConnection(“Data Source=$sqlServer;

Initial Catalog=$dbtarget; Integrated Security=SSPI”)

$conn.Open()

$cmd = $conn.CreateCommand()

##read servernames and update/insert the table

#get-content C:\Working\SQLCMS\Powershellscripts\servers.txt | foreach {

#$server = $_

$srv = New-Object Microsoft.SqlServer.Management.Smo.Server $server

$lastUpdated = Get-Date

$servername = $srv.Name

$instance = $srv.InstanceName

$version = $srv.VersionString

$edition = $srv.Edition

$ServicePack = $srv.ProductLevel

$BackupDirectory = $srv.BackupDirectory

$defaultfile = $srv.DefaultFile

$defaultlog = $srv.DefaultLog

$installdatadirectory = $srv.InstallDataDirectory

$osversion = $srv.OSVersion

$physicalmemory = $srv.PhysicalMemory

$errorlogpath = $srv.ErrorLogPath

$cmd.CommandText = ”

MERGE $tblServerInfo AS target

USING (VALUES (‘$lastupdated’,'$server’

,’$instance’

,’$version’

,’$Edition’

,’$ServicePack’

,’$BackupDirectory

,’$defaultfile’

,’$defaultlog’

,’$installdatadirectory’

,’$osversion’

,’$physicalmemory’

,’$errorlogpath’))

AS src

([LastUpdated]

,[Server]

,[Instance]

,[Version]

,[Edition]

,[ServicePack]

,[BackupDirectory]

,[defaultfile]

,[defaultlog]

,[installdatadirectory]

,[osversion]

,[physicalmemory]

,[errorlogpath])

ON (Target.SERVER = (‘$servername’))

WHEN MATCHED THEN

UPDATE SET lastupdated = (‘$lastupdated’)

,instance = (‘$instance’)

,Version = (‘$version’)

,Edition = (‘$Edition’)

,Servicepack = (‘$ServicePack’)

,BackupDirectory = (‘$BackupDirectory’)

,defaultfile = (‘$DefaultFile’)

,defaultlog = (‘$DefaultLog’)

,installdatadirectory = (‘$InstallDataDirectory’)

,osversion = (‘$OSVersion’)

,physicalmemory = (‘$PhysicalMemory’)

,errorlogpath = (‘$ErrorLogPath’)

WHEN NOT MATCHED THEN

INSERT

([LastUpdated]

,[Server]

,[Instance]

,[Version]

,[Edition]

,[ServicePack]

,[BackupDirectory]

,[defaultfile]

,[defaultlog]

,[installdatadirectory]

,[osversion]

,[physicalmemory]

,[errorlogpath])

VALUES  (‘$lastupdated’

,’$server’

,’$instance’

,’$version’

,’$Edition’

,’$ServicePack’

,’$BackupDirectory’

,’$defaultfile’

,’$defaultlog’

,’$installdatadirectory’

,’$osversion’

,’$physicalmemory’

,’$errorlogpath’);”

$cmd.ExecuteNonQuery()

#}

$conn.Close()

#Set the Server as processed

$ServerList.Remove(“$server”)

}

I imagine there is an easier way of doing this but it was fun figuring it out. One thing i wanted to get was the start time of the server. I usually use crdate of tempdb in master but i couldn’t work this into the script. That will be my next step.

Below is the table that the script inserts into


/****** Object:  Table [dbo].[ServerInfo]    Script Date: 05/29/2009 15:46:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ServerInfo](
[ServerID] [int] IDENTITY(1,1) NOT NULL,
[LastUpdated] [datetime] NULL,
[Server] [varchar](50) NULL,
[Instance] [varchar](50) NULL,
[Version] [varchar](50) NULL,
[Edition] [varchar](50) NULL,
[ServicePack] [varchar](50) NULL,
[TimeStarted] [datetime] NULL,
[BackupDirectory] [varchar](250) NULL,
[defaultfile] [varchar](250) NULL,
[defaultlog] [varchar](250) NULL,
[installdatadirectory] [varchar](250) NULL,
[osversion] [varchar](50) NULL,
[physicalmemory] [int] NULL,
[errorlogpath] [nvarchar](250) NULL,
CONSTRAINT [PK_ServerInfo] PRIMARY KEY CLUSTERED
(
[ServerID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,

IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

70-453 and certifications in general

So I passed 70-453 today, 70-453 is the upgrade exam for MCITP Database administrators on 2005. It made me think about a few things.

Is certification useful?

Is it truly reflective of a person’s skill or there “trade”? Here meaning database administration.

Personally I have used certification for two reasons, firstly I always learn something! It may sound silly but there are often parts of a technology we use for years that we never touched. If you work for a very small company you often don’t have time to dig into features you are just covering a wide area of basics. Too large a company and you get pigeon holed into specific task or roles. The sweet spot is where you are large enough to be able to specialize somewhat but small enough to get your fingers in lots of technologies beyond  the database servers like Active directory, SAN’s, virtualization, SharePoint, exchange etc.

The second reason I use certification is simple – it makes it easier for companies to hire me. It may sound strange but often the people making decisions are not technical, there can be many reasons for this, so certifications makes it easier for IT management to hire a new position or hire the person they want. Of course certifications do not help you through a technical interview nor do they make your personality any more appealing so don’t think that they buy you anything no-one will be in awe of your uber certifications!.

Are certifications reflective of skills – yes and no? Perhaps they demonstrate the ability to read understand and remember information yes – beyond that no not really. I would be interested to hear from other people out there- do you actually use in your job all the technologies you are tested on? There are certainly many things in Database administration that I do that are not in the exam but I feel are part of day to day administration, Reporting services and Analysis services administration from an administrative perspective for one. There are many things that I don’t do. In my experience with other administrators I have worked with I am sure there are many that never actually do any form of high availability like mirroring or specifically clustering. How many DBA’s get to design and implement a monitoring system as opposed to inheriting.  When you look at the skills measured http://www.microsoft.com/learning/en/us/Exams/70-453.aspx there is a lot of good stuff covered that is basic and should be included. Maybe Microsoft has the test right? I think personally I knew 50% of the answers and I made educated guesses at the other 50% this was pretty reflective in my score.  Perhaps certification demonstrates that someone is at least aware of the underlying functions of the “trade” being measured. There always seems to be quite a few off the wall bizarre exceptions as questions though which always leaves me somewhat disturbed.

I guess it comes down to the fact we are all different and have different opinions and skills, personally the exams I have taken have always left me feeling somewhat insecure in some way. I have often felt that by being certified I was setting myself up for failure that I was somehow misleading people/management that I had skills in something I did not or that I was opening myself up to criticism if I didn’t know the answer to something on the spot!.  On the flip side I have often been able to bring up lesser know features as potential solutions, often people are surprised about features they had never heard about so there are swings and roundabouts

So for me certifications are a way of learning a product, they make me more marketable in some ways. I used to wear them as a badge on my email signature, these days they just come out on my resume when I am looking for a job.

Does Microsoft have its certifications right? Is it just the way other people/hiring managers/the industry itself that has a misconception about what they represent?

Drop me a line or leave a comment if you have any strong views

I currently work as a senior database administrator and I hold/held the following certifications

MCITP DBA 2008

MCITP DBA 2005

MCST SQL 2008

MCTS SQL 2005

MCSE 2003

MCSA 2000

MCDST charter member

MCP

Server+

Network+

A+

Compaq accredited Platform Specialist

Zenworks Administrator

sql 2008 Books

I don’t feel competent enough for full reviews but here are my high level view’s of some of the current SQL 2008 books on the market that I have read. (all links go to Amazon)

First though, about myself. I come from a system engineering background not a programming background so I’m sure I bias in that direction

The first 2008 The first 2008 book I read was Itzik Ben-gan’s Microsoft® SQL Server® 2008 T-SQL Fundamentals -I really enjoy Itzik’s books and this is no disapointment, some books miss a basic learning fundamental of not building on previous lessons. This is definately not the case. A great book, an enjoyable read, great as a reference to. I definately reccomend

The next book I was Professional Microsoft SQL Server 2008 Administration by by Brian Knight (Author), Ketan Patel (Author), Wayne Snyder (Author), Ross LoForte (Author), Steven Wort (Author)

This has to be one of the best SQL server books I have read. A great read, goes into a good depth. I have bookmarks all through this book and find myself constantly refering back to it. A must have in my opinion.

I haven’t gone into much detail and my opinion doesn’t really count for anything, but here you are my two cents.

I am currently reading Microsoft SQL Server 2008 Management and Administration – then I have SQL Server Forensic Analysis on my shelf, not to mention the books I have preordered from amazon :-)

Restore From Database

When you restore a database “FROM Database” in SSMS you are restoring from the last backup set of the database not from the live database itself. This might not appear apparent in the GUI.

Notice when you choose from the database dropdown list you are seeing backup sets.

If you use the script button in the gui you will see “FROM DISK” -

Another clue will be that any database that has not been backed up will not appear in the drop down list.

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!