Showing posts with label trouble shoot. Show all posts
Showing posts with label trouble shoot. Show all posts

Wednesday, January 8, 2014

Tempdb space lookup queries

Troubleshooting Insufficient Disk Space in tempdbhttp://msdn.microsoft.com/en-us/library/ms176029.aspx

Capacity Planning for tempdb
http://msdn.microsoft.com/en-us/library/ms345368.aspx

Optimizing tempdb Performance
http://msdn.microsoft.com/en-us/library/ms175527.aspx


SELECT
SUM(unallocated_extent_page_count) AS [free pages], (SUM(unallocated_extent_page_count)*1.0/128) AS [free space in MB]FROM sys.dm_db_file_space_usage;
--current free and used spaceSELECT SUM(size)*1.0/128 AS [size in MB]FROM tempdb.sys.database_files
--Determining the Amount of Space Used by User Objects
SELECT SUM(user_object_reserved_page_count) AS [user object pages used],(
SUM(user_object_reserved_page_count)*1.0/128) AS [user object space in MB]FROM sys.dm_db_file_space_usage;
--Determining the Amount of Space Used by Internal ObjectsSELECT SUM(internal_object_reserved_page_count) AS [internal object pages used],(
SUM(internal_object_reserved_page_count)*1.0/128) AS [internal object space in MB]FROM sys.dm_db_file_space_usage;
--Determining the Longest Running TransactionSELECT transaction_idFROM sys.dm_tran_active_snapshot_database_transactions ORDER BY elapsed_time_seconds DESC;--Determining the Amount Space Used by the Version StoreSELECT SUM(version_store_reserved_page_count) AS [version store pages used],(
SUM(version_store_reserved_page_count)*1.0/128) AS [version store space in MB]FROM sys.dm_db_file_space_usage;

Wednesday, December 21, 2011

Error: SSIS package : A rowset based on the SQL command was not returned by the OLE DB provider

I am trying to use a stored procedure in the OLE DB source, I am using the SQL Command for the Data Access mode.  It returns values when using the preview but when I test the SSIS package I receive the error, "A rowset based on the SQL command was not returned by the OLE DB provider


Solution

I just had to add SET NOCOUNT ON in the begining of the stored procedure that I was using.

Monday, June 27, 2011

Error:System.Data.SqlClient.SqlException: profile name is not valid

We were getting the following error

System.Data.SqlClient.SqlException: profile name is not valid
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()


The profile name is profile1@abc.com
user account associated to it was accountA@abc.com

We had to do the following to get rid of this error
Make sure that the account  accountA@abc.com is a role member of the Role DataBaseMailUserRole in the msdb database.This role is found under Security->Role in the msdb database
Set the profile profile1@abc.com to  public

use msdb
GO
EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@profile_name =  'profile1@abc.com'
@principal_name = 'public',@is_default = 1;


Once we did the above two setps after creating the profile the error was gone and everything started to work as normal.
=

Wednesday, June 1, 2011

Error:Row handle referred to a deleted row or a row marked for deletion

We got the error "Row handle referred to a deleted row or a row marked for deletion" from a sql job ( that calls a stored procedure) after we moved to sql 2008 R2. When we were running this job in sql 2000 it was running fine.
I had been looking for a solution to fix this and most of the internet articles points to the "mising primary key" issue.
The stored procedure moves the data from TABLE1 to TABLE2. TABLE2 did not have any primary key as this was just used as an intermediate table. I added the primary key to the TABLE2, but the job still continued to fail now and then with the above error.
Upon further look at the code I saw the following code in the stored proc that the job was calling

BEGIN TRANSACITON TRAN1

delete w from DATA2LINK.statusupdates.dbo.workqueue w
INNER JOIN DataUpdate_DTS d2
ON w.ptno = d2.ptno
AND status_Id = 6



SELECT @intErrorCode = @@ERROR
IF (@intErrorCode <> 0) GOTO Error_handler


--remove any deleted(declined) Data update request from workqueue
DELETE w FROM DATA2LINK.statusupdates.dbo.workqueue w
INNER JOIN DATA2LINK.statusupdates.dbo.DataUpdate d
ON w.ptno = d.ptno
AND w.status_Id = 6
AND d.deleted = 1


The culprit seems to be the second delete query because we are referring already marked for deletion row(in the first query) . I removed the second delete statement .

The job has not failed since then, though it has been only few days since the code change. I will revisit again, but for now I consider this as the resolution for the above error.

Monday, January 17, 2011

Error : The EXECUTE permission was denied on the object 'sp_OACreate', database 'mssqlsystemresource', schema 'sys'.

Once we migrated to the SQL 2008 R2 was getting the following error

The EXECUTE permission was denied on the object 'sp_OACreate', database 'mssqlsystemresource', schema 'sys'.

I had to do the following to resolve this

The following example shows how to view the current setting of OLE Automation procedures.

Copy
EXEC sp_configure 'Ole Automation Procedures';
GO

The following example shows how to enable OLE Automation procedures.


sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO


http://msdn.microsoft.com/en-us/library/ms191188.aspx