Translate

Tuesday, April 21, 2009

Error When Configuring SSRS Database

Error is occurring when trying to configure SSRS Database Setup from the Reporting Service Configuration Manager. Following is the error you get.

The database version (C.0.8.40) does not match your reporting services installation.  You must upgrade your reporting services database.
Couldn't generate the upgrade script.  There is no upgrade script available for this version.

Answer:

Error is occurring when it can't match with the database version of your reporting service installation. This is happening when you install you components in following order.

1. Install SQL Server 2005 Database Services.

2. Install SQL Server 2005 Service Pack 3.

3. Install SQL Server Reporting Services.

Because of this, SQL Server Report Services and Database Services versions are mismatching. Therefore, you need to install SQL Server Service Pack 3again so that both versions are equal.

SQL Server Reporting Server (SSRS) Service is Failing to Start

After a server reboots the SQL Server Reporting Server (SSRS) service is failing to start giving following two errors in the event log.

1. The SQL Server Reporting Services (MSSQLSERVER) service failed to start due to the following error:

The service did not respond to the start or control request in a timely fashion.

2. Timeout (30000 milliseconds) waiting for the SQL Server Reporting Services (MSSQLSERVER) service to connect.

This issue may occur if the service times out before it starts successfully. This issue is more likely to occur if your computer is heavily loaded.

To resolve this issue, increase the time-out value for service startup process. When you increase this value, the Microsoft ISA Server Storage service has more time to load when the computer starts. To increase the service startup time, create the following registry entry:

Subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control

Name: ServicesPipeTimeout

Type: REG_DWORD

Data: The number of milliseconds that you want to give the services to start in

Typically, a data value of 35,000 is sufficient to keep the service from timing out. However, you can reduce or increase this value according to your specific startup requirements. For example, to use a time-out value of 60 seconds, assign a data value of 60,000 to the ServicesPipeTimeout registry entry. A larger data value does not decrease your computer's performance. To create this registry entry, follow these steps:

1. Click Start, click Run, type regedit, and then click OK.

2. Locate and then click the following registry subkey:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control

3. Right-click Control, point to New, and then click DWORD Value.

4. In the New Value #1 box, type ServicesPipeTimeout, and then press ENTER.

5. Right-click ServicesPipeTimeout, and then click Modify.

6. Click Decimal, type the number of milliseconds that you want to wait until the service times out, and then click OK.

For example, to wait 60 seconds before the service times out, type 60000.

7. Quit Registry Editor, and then restart the computer.

Thursday, April 16, 2009

Monday, April 13, 2009

How Send the SSRS Report From SSIS?

This is a requirement when you need to send a SSRS report in Excel, PDF format to different users from SSIS after performing a data load.

First you need to create subscription to the report. You can create a SSRS report subscription from Report manager. At the report subscription you can mention the report format and the email address of the recipient. When you create a schedule for the SSRS report, SQL Server Agent Job will be created.

From the SSIS, by using sp_start_job and passing the relevant job name you can execute the SSRS report subscription.

Saturday, April 11, 2009

How to uninstall SQL Server 2005 manually

Sometimes, you may find that, though you can't see any SQL Server 2005 instance in the programs list and when try to install the SQL Server 2005, it gives messages saying that there is SQL Server instance or some components like SQL Server Management Studio. Reason for this is existence of corrupted SQL Server instance and you need to remove the SQL Server instance manually.

At a command prompt, run the following command:
"%ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\ARPWrapper.exe /Remove"


Uninstall the SQL Server components one at a time until all the SQL Server components are uninstalled.

Note Add or Remove Programs also runs the ARPWrapper.exe program by using the /Remove option. However, the reference to the ARPWrapper.exe program may have been deleted. Make sure that all the services (if exists) relevant to this SQL Server instance is stopped.

Wednesday, April 8, 2009

SQL Server 2008 SP1 Download Available

You can download SQL 2008 SP1 here.  If you get a 404 error, come back and try it again.  Seems that the download servers aren’t all synced up.

The April 2009 update to the SQL Server 2008 Feature Packs is also available today. In this release few bugs were fixed.

Tuesday, April 7, 2009

SQL Heart Beat

There are plenty of tools to monitor your SQL Server Database engine. However, there are hardly any tools to measure performance of SQL Server Analysis Service (SSAS) database.

To fill this gap in the industry company named SQL Solutions who delivers top of the line database performance tools and specialized consulting services for the Microsoft SQL Server platform, has come with a FREE tool called SQL Heart Beat.

Basic features of SQL Heart beat are,

  • Monitor server wait categories
  • Monitor IO activity
  • Check your current Cache Hits ratio
  • Analyze your I/O system performance
  • Get details about active processes
  • Display locks and deadlocks

Following image shows how you can measure/views these from the SQL Heart beat tool.

sqlheartbeat

Also, you have the option of measuring these performance of multiple SSAS servers from a single instance of a SQL Heart beat.

You can download this tool and experience the benefits.

Wednesday, April 1, 2009

Tuesday, March 31, 2009

How to alter a User Defined Data Type?

 

The only way to do it is to create a new User Define Data Type (UDDT), and change out all existing column to that UDDT, then you can drop the original one, and recreate it and change out the change you made previously. The problem is that you can drop the UDDT if it is in use.(PN: this is same with SQL Server 2008)

In case of the UDDT is in use you need to follow these steps.

1. Allocate different data type for the fields which are using UDDT. Rather than allocating arbitrary data type it is better to allocate data type of the UDDT, so that there won’t be any issue with the existing data.

2.Drop Stored Procedures which are using UDDT. You can drop them by using following T-SQL. However, you need to get the scripts of those SPs to create them later.

DECLARE @dropsps VARCHAR(8000)
SET @dropsps = ''
SELECT  @dropsps = @dropsps + ',' +
        OBJECT_NAME(id)
FROM    sys.syscomments
WHERE   TEXT LIKE '%latitude%'
        AND OBJECT_NAME(id) LIKE 'usp%'
SET @dropsps = 'DROP PROC ' + RIGHT(@dropsps, LEN(@a) - 1)
EXEC ( @dropsps

    )

3. Drop the UDDT

4. Create new UDDT

5. Allocate new UDDT to the fields which had previous UDDT.

6. Create Dropped Stored Procedures

You can use following script and you can change the first variable value according to your requirement. This script was tested for few data types.

SET NOCOUNT ON

DECLARE @udt VARCHAR(150)

DECLARE @udtschema VARCHAR(150)

DECLARE @newudtschema VARCHAR(150)

DECLARE @newudtDataType VARCHAR(150)

DECLARE @newudtDataSize smallint

DECLARE @OtherParameter VARCHAR(50)

SET @udt = 'Name' -- Existing UDDT

SET @udtschema = 'dbo' -- Schema of the UDDT

SET @newudtDataType = 'varchar' -- Data type for te new UDDT

SET @newudtDataSize = 500 -- Lenght of the new UDDT

SET @newudtschema = 'dbo' -- Schema of the new UDDT

SET @OtherParameter = ' NULL' -- Other parameters like NULL , NOT NULL

DECLARE @Datatype VARCHAR(50),

@Datasize SMALLINT

DECLARE @varcharDataType VARCHAR(50)

DECLARE @Schemaname VARCHAR(50),

@TableName VARCHAR(50),

@FiledName VARCHAR(50)

CREATE TABLE #udtflds

(

Schemaname VARCHAR(50),

TableName VARCHAR(50),

FiledName VARCHAR(50)

)

SELECT TOP 1

@Datatype = Data_type,

@Datasize = character_maximum_length

FROM INFORMATION_SCHEMA.COLUMNS

WHERE Domain_name = @udt

SET @varcharDataType = @Datatype

IF @DataType Like '%char%'

AND @Datasize IS NOT NULL

AND ( @newudtDataType <> 'varchar(max)'

OR @newudtDataType <> 'nvarchar(max)'

)

BEGIN

SET @varcharDataType = @varcharDataType + '('

+ CAST(@Datasize AS VARCHAR(50)) + ')'

END

INSERT INTO #udtflds

SELECT TABLE_SCHEMA,

TABLE_NAME,

Column_Name

FROM INFORMATION_SCHEMA.COLUMNS

WHERE Domain_name = @udt

DECLARE @exec VARCHAR(500)

DECLARE alter_cursor CURSOR

FOR SELECT Schemaname,

TableName,

FiledName

FROM #udtflds

OPEN alter_cursor

FETCH NEXT FROM alter_cursor INTO @Schemaname, @TableName, @FiledName

WHILE @@FETCH_STATUS = 0

BEGIN

SET @exec = 'Alter Table ' + @Schemaname + '.' + @TableName

+ ' ALTER COLUMN ' + @FiledName + ' ' + @varcharDataType

EXECUTE ( @exec

)

FETCH NEXT FROM alter_cursor INTO @Schemaname, @TableName, @FiledName

END

CLOSE alter_cursor

SET @exec = 'DROP TYPE [' + @udtschema + '].[' + @udt + ']'

EXEC ( @exec

)

SET @varcharDataType = @newudtDataType

IF @newudtDataType Like '%char%'

AND @newudtDataSize IS NOT NULL

AND ( @newudtDataType <> 'varchar(max)'

OR @newudtDataType <> 'nvarchar(max)'

)

BEGIN

SET @varcharDataType = @varcharDataType + '('

+ CAST(@newudtDataSize AS VARCHAR(50)) + ')'

END

SET @exec = 'CREATE TYPE [' + @newudtschema + '].[' + @udt + '] FROM '

+ @varcharDataType + ' ' + @OtherParameter

EXEC ( @exec

)

OPEN alter_cursor

FETCH NEXT FROM alter_cursor INTO @Schemaname, @TableName, @FiledName

WHILE @@FETCH_STATUS = 0

BEGIN

SET @exec = 'Alter Table ' + @Schemaname + '.' + @TableName

+ ' ALTER COLUMN ' + @FiledName + ' ' + '[' + @newudtschema

+ '].[' + @udt + ']'

EXECUTE ( @exec

)

FETCH NEXT FROM alter_cursor INTO @Schemaname, @TableName, @FiledName

END

CLOSE alter_cursor

DEALLOCATE alter_cursor

SELECT *

FROM #udtflds

DROP TABLE #udtflds

Thursday, March 19, 2009

Application Name & SQL Server Profiler

SQL Server Profiler is a tool which you can use to gather information about what are the events happening at the SQL Server.  Following is the sample which you will get from the Profiler Trace file.

image

If you pay attention to the Application Name Column (3rd Column form your left hand side), You can see there are entries. For the First four rows, you can see a SQL Prompt and next four lines you will see Microsoft SQL Server Management Studio. This is due to the fact that those applications are using this particular instance of SQL server. If you look closer, you will see that next 3 lines has a entry name .Net SqlClient Data Provider.

Obvious question is what is this application. Well, this is because Application Name is not specified by the application. You have to set it from the client application by adding another parameter to the connection string.

string connectionstring = "Data Source=.; Integrated Security=SSPI; Initial Catalog=DB;Application Name=MyApplication";

NB: Whenever the Application Name is not specified it will use default application Name, .Net SqlClient Data Provider.

After if you analyze the Profiler trace again you will see the correct application name.

image

This very important option as this will allow you to analyze your Profiler Trace for application wise. Also, you can use filter option for Application Name in Profiler to filter by application.