SQL Server Torn Page Repair: Without Worrying About Data Loss or Corruption


It can often be bugs and errors in fetching data from the server. This can leave system administrators baffled as all work comes to a standstill. Incomplete or incorrect transaction cause confusion among employees working on the different sections of a database.

One such frequent issue is the SQL Server torn page error. It can be quite a hassle for a non-technical user facing such a situation. There are ways to fix it easily without worrying about any data loss. This post covers all there is to know about this topic. Continue reading to find out more.

What is the Torn Page in SQL Server?

It is the inability of the server to fetch a particular data during a transaction. It is caused when an Input/Output header tries to access a page that was written incorrectly to the disk. It reports a message saying ‘I/O error (torn page) detected during read’. The reason for this can be primarily contributed to power failure causing partial writes. Other factors include damaged disk or other hardware to which data is being written to. If a torn page is detected by SQL Server, it will sever all connections as the requested data is inaccessible. During the restore process, detecting a torn page sends the database into SUSPECT mode.

sql server torn page repair

Continue reading “SQL Server Torn Page Repair: Without Worrying About Data Loss or Corruption”

Cannot add new node in SQL Server 2014


Problem 

Hi my followers today i have task to build two new SQL Server Clusters when i am working i go to for adding new Node at this time i revived very new issue for me Rule “SQL Server Database Services feature state” failed

—————————
Rule Check Result
—————————
Rule “SQL Server Database Services feature state” failed. The SQL Server Database Services feature failed when it was initially installed. The feature must be removed before the current scenario can proceed.
—————————
OK
—————————

This error meaning When you are adding the first node the cluster installed with some issues and this relay what is happened with me when i installed the First node i faced some issues so based on that adding second node is blocked

How i can fix this issue :

  • To fix this issue at the first you should check the Cluster error log in the first node and try to do prepare for this node

If this step not success with you to fix this issue you can try the second solution :

  1. Go for the Run
  2. Write Regedit
  3. Go for this path (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQLServer\MSSQL12.MSSQLSERVER2014\ConfigurationState )
  4. Check all the value for all the Component if you found the value is 2 this meaning you have failures in this Component change it to 1

Component name :

MPT_AGENT_CORE_CNI, SQL_Engine_Core_Inst, SQL_FullText_Adv, SQL_Replication_Core_Inst

Note : to find the correct place in the registry you  after this path (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQLServer\) we have to know Our SQL Server Version and SQL Server instance name

  • SQL Server 2008     : MSSQL10.      (InstanceName)
  • SQL Server 2008R2 : MSSQL10_50. (InstanceName)
  • SQL Server 2012     : MSSQL11 .     (InstanceName)
  • SQL Server 2014     : MSSQL12.      (InstanceName)

I hope the issue and How to fix the issue is clear

Follow Us :

LinkedIn Slideshare ,Youtube Channel.MSDN POSTS , WHO WE ARE

SQL Server Configuration Manger Error


Today i face error when i need to check my SQL Server Configuration manger for SQL Server 2008R2 Sp1 When the SQL Server Services “Remote Procedure Call Failed”

Error :

SQLConfig Error

 

How to Fix this Error ?

I try more salutation but the best one of them is “Upgrade SQL Server Services from SP1 to SP2” after i run this update this error is go out to download this Update go to this link

http://www.microsoft.com/en-us/download/details.aspx?id=30437

 

 

How to install Adventure Work Database


Problem :

When I download Database Adventure Work  I see it MDF file only ok but now how can I attach this database without LDF file . SQL Server give me ERROR

AdventureWork Without LDF File

 

 

ERROR

 

Solution : 

to fix this error and install the database on the production we will create the LDF file by this script .

 

Create Database AdventureWorks2008R2

ON (FILENAME=‘E:\AdventureWorks2008R2_Data.mdf’)

FOR ATTACH_REBUILD_LOG

by this Script I Create Database AdventureWorks2008R2 and put the File name for the MDF file the ( Full path ) then I make REBUILD for the LOG by this Command  (ATTACH_REBUILD_LOG)

Now after you EXCE this Query Check the path of the MDF file you will see the new File LDF for the database adventure work also you check the Databases on SQL Server management studio you will find the Database ADVENTUREWORK2008R2

Regards ,

Eng. Mustafa Elmasry

Database Administrator

 

 

TRY…CATCH and ERROR Handling


CREATE TABLE TPA
(ID  INT , [NAME]  NVARCHAR(50))
GO
INSERT TPA VALUES (1,’MOSTAFA’)
INSERT TPA VALUES (2,’ELMASRY’)

BEGIN TRY
— Generate a divide-by-zero error.
SELECT ID+[NAME] FROM TPA
END TRY
BEGIN CATCH
SELECT * FROM TPA
END CATCH;
GO

BEGIN TRY
— Generate a divide-by-zero error.
SELECT ID+[NAME] FROM TPA
END TRY
BEGIN CATCH
SELECT
ERROR_NUMBER() AS ErrorNumber,
ERROR_SEVERITY() AS ErrorSeverity,
ERROR_STATE() AS ErrorState,
ERROR_PROCEDURE() AS ErrorProcedure,
ERROR_LINE() AS ErrorLine,
ERROR_MESSAGE() AS ErrorMessage;
END CATCH;
GO