Showing posts with label Error. Show all posts
Showing posts with label Error. Show all posts

Tuesday, May 17, 2016

"Operating system error 112(There is not enough space on the disk.) encountered." Error When Starting SQL Server Service After Changing The Initial Size or Location of [tempdb] Data File.

You've changed the location or the initial size of the data file of the [tempdb], then you restarted SQL Server services, but that failed with errors in the Event Viewer like the following:

The operating system returned error 38(Reached the end of the file.) to SQL Server during a read at offset 0000000000000000 in file '[some path]\tempDB.mdf'. Additional messages in the SQL Server error log and system event log may provide more detail. This is a severe system-level error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online.

and

[some path]\tempDB.mdf: Operating system error 112(There is not enough space on the disk.) encountered.


Solution:

  1. Go to SQL Server Configuration Manager and change the SQL Server services account to [NT AUTHORITY\NetworkService].
  2. Make sure you are login into windows using a machine administrator.
  3. Run CMD as administrator.
  4. Execute the following command:
     net start mssqlserver /f
    this will start SQL Server services with the minimal requirement and configuration, and in single user mode that allows just one administrator to login.
  5. Immediately after that run the following command:
    osql -E
    you will connect to SQL Server using the current windows user (which should be machine admin), through CMD, and using command line.
  6. Now change the initial size to a size you think it is available on where the tempdb data file is located. For example, the following will change the initial size of the tempdb data file to 1GB:
    alter database tempdb modify file ( name=tempdev ,size=1000MB);
    go
  7. If the above point finished successfully, go back to SQL Server Configuration Manager and change back the account that runs SQL Server service to the one you want, then try to start the service again.

Saturday, April 5, 2014

Error: Computed column 'X' in table 'Y' cannot be persisted because the column is non-deterministic.

This error could appear when you try to add a persisted computed column to a table, for example:


or
Percentage AS [dbo].[fn_getPercentage](Total) PERSISTED

you may get an error like:
Computed column 'Actor' in table 'Tmp_OrgData' cannot be persisted because the column is non-deterministic.

The reason is that the function that fills this column is not flagged to be deterministic (a deterministic function is the function that returns the same value every time it is executed with the same parameters values; so GETDATE() is non-deterministic function because it returns different value (date/time) every time we run it). And to mark a function as deterministic you have to add WITH SCHEMABINDING between RETURNS... and AS BEGIN... in the function definition. For example:

CREATE FUNCTION fn_getPercentage( @Total INT)
    RETURNS INT
WITH SCHEMABINDING  
AS
BEGIN
    RETURN SELECT @Total/countOfSomething FROM tblOrgData
END

Note: you cannot make a persisted column out of a recursive function.

Sunday, February 2, 2014

"A duplicate attribute key has been found when processing: Table..." Error Causes & Fixes

"Errors in the OLAP storage engine: A duplicate attribute key has been found when processing: Table: 'dbo_TheTable', Column: 'TheColumn', Value: 'XYZ'. The attribute is 'The Attribute'."

There is a number of causes and ways to fix the above error:

  • Could be a result of having both blanks and NULLs in the source table/view. SSAS does
     SELECT DISTINCT  COALESCE(attr,'') FROM SOURCE 
    which converts NULLs to blanks, resulting in duplicate value blanks in the resulting feed - hence the error.
    Solutions : Remove all nulls from the data source by either filtering out rows containing nulls, or update null values with another value before processing the cube. Another solution is to change the way SSAS process nulls, and to do so: go to the cube's Dimension Usage tab, open to edit the relation between the dimension contains the attribute with the error and the measure group, click Advance button, select the attribute in the Measure Group Bindings window, choose the appropriate "Null Processing" option, finally reprocess the cube. The following explains the options for Null Processing:
    • ZeroOrBlank: This tells the server to convert the NULL value to a zero (for numeric data items) or a blank string (for string data items).
    • Preserve: This tells the server to preserve the NULL value. The server has the ability to store NULL just like any other value.
    • Error: This tells the server that a NULL value is illegal in this data item. The server will generate a data integrity error and discard the record.
    • UnknownMember: This tells the server to interpret the NULL value as the unknown member. The server will also generate a data integrity error. This option is applicable only for attribute key columns.
    • Default: This is a conditional default. It implies ZeroOrBlank for dimensions and cubes, and UnknownMember for mining structures and models.
  • Actually, when I was searching for the descriptions of the Null processing, I found a nice two posts by Hilmar Buchta where he list even more than the reasons I wanted to write about:

Sunday, January 26, 2014

A loop involving the member with the key [no.], was detected in the parent-child relationship between the attribute [child_id] and the attribute [parent_id].

As the error implies there is a loop in the parent-child hierarchy in one of the dimensions you are trying to process. For example if you have an Employee dimension and there is a parent-child relationship between employee_id and supervisor_id attributes, having this error means that you have in your source table _for example_ Ali as a supervisor for John but in another record John is ALSO the supervisor of Ali!.

To find such loop run the following query on your source table:

select * from      tableName tl1
         left join tableName tl2
         on tl1.child_id = tl2.parent_id
where tl1.parent_id = tl2.child_id

Tuesday, August 6, 2013

"Property IsLocked is not available for Login 'sa'. This property may not exist for this object, or may not be retrievable due to insufficient access rights. " error fix

ALTER LOGIN [sa] WITH PASSWORD=N'123', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF 
GO  
ALTER LOGIN [sa] ENABLE

Tuesday, December 11, 2012

Cannot process the object "EXEC [DB_Name].dbo.SP_Name". The OLE DB provider "SQLNCLI10" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions on that object.

If you are trying to run a stored procedure using OPENROWSET, for example:


SELECT *
   FROM OPENROWSET('SQLNCLI','Server=(LOCAL);Trusted_Connection=Yes;Database=DB_Name','EXEC [DB_Name].dbo.SP_Name')


and you got the following error:


Cannot process the object "EXEC [DB_Name].dbo.SP_Name". The OLE DB provider "SQLNCLI10" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions on that object.


to solve this, just add SET FMTONLY OFF as the following:


SELECT *
   FROM OPENROWSET('SQLNCLI','Server=(LOCAL);Trusted_Connection=Yes;Database=DB_Name','SET FMTONLY OFF
EXEC [DB_Name].dbo.SP_Name'
)