The operating system returned error 38

Avyayah 1,231 Reputation points
2020-10-20T22:46:52.007+00:00

The operating system returned error 38(Reached the end of the file.) to SQL Server during a read at offset 0x00000124674000 in file 'x.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.

Is space an issue on the data path file with this error ?

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,799 questions
0 comments No comments
{count} votes

Accepted answer
  1. Joyzhao-MSFT 15,566 Reputation points
    2020-10-21T06:05:02.103+00:00

    Hi @Avyayah ,
    If DBCC CHECKTABLE reports any errors, then we recommend restoring the database from a database backup instead of using one of the REPAIR options to run REPAIR. If there is no backup, running REPAIR can also correct the reported errors. Depending on the database, you might be able to restore the database to a new name, then delete the problematic table and copy it from the restored version. This will depend on data dependencies, foreign keys, etc., and may also cause data loss.
    If you run REPAIRde, I would recommend starting from the smallest risk to the largest risk. In other words, REPAIR_FAST first, if it doesn’t work, try REPAIR_REBUILD, if it doesn’t work, try REPAIR_ALLOW_DATA_LOSS. For more information, you can read carefully : DBCC CHECKDB (Transact-SQL).
    Regards,
    Joy


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Joyzhao-MSFT 15,566 Reputation points
    2020-10-21T01:49:42.78+00:00

    Hi @Avyayah ,
    The error will indicate the data file (usually a .MDF file) and can be read or written. The offset is the physical byte offset from the beginning of the file. The logical page is obtained by dividing the offset number by 8192.

    Reaching the end of the file usually means that the file is damaged. In this case, it is the TempDB data file (.mdf), not the log file (.ldf).

    For more information and solutions, you could refer to: https://www.stellarinfo.com/blog/how-to-fix-sql-server-error-823/
    Best Regards,
    Joy


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Avyayah 1,231 Reputation points
    2020-10-21T03:52:03.1+00:00

    Got the following message when running DBCC CheckDB

    DBCC CheckDB (xPC) with NO_INFOMSGS, ALL_ERRORMSGS

    Msg 8978, Level 16, State 1, Line 1
    Table error: Object ID 53575229, index ID 1, partition ID 72057594038583296, alloc unit ID 72057594042580992 (type In-row data). Page (1:381745) is missing a reference from previous page (1:302289). Possible chain linkage problem.
    Msg 8981, Level 16, State 1, Line 1
    Table error: Object ID 53575229, index ID 1, partition ID 72057594038583296, alloc unit ID 72057594042580992 (type In-row data). The next pointer of (1:302289) refers to page (1:598842). Neither (1:598842) nor its parent were encountered. Possible bad chain linkage.
    CHECKDB found 0 allocation errors and 2 consistency errors in table 'xData' (object ID 53575229).
    CHECKDB found 0 allocation errors and 2 consistency errors in database 'xPC'.
    repair_rebuild is the minimum repair level for the errors found by DBCC CHECKDB (xPC).

    Completion time: 2020-10-20T22:47:43.1563174-05:00

    0 comments No comments

  3. Avyayah 1,231 Reputation points
    2020-10-21T13:34:24.717+00:00

    ALTER DATABASE XPC SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
    GO
    DBCC CHECKDB (N'XPC',REPAIR_REBUILD) WITH NO_INFOMSGS, ALL_ERRORMSGS;
    GO
    ALTER DATABASE XPC SET MULTI_USER;

    Completed these steps and now no error messages found after running:

    DBCC CheckDB (ProcessPC) with NO_INFOMSGS, ALL_ERRORMSGS

    0 comments No comments