Help Center/ Elastic Cloud Server/ User Guide (Kuala Lumpur Region)/ FAQs/ Database Applications/ What Should I Do If a Msg 823 Error Occurs in Oracle, MySQL, or SQL Server System Logs After a Disk Initialization Script Is Executed?
Updated on 2024-04-19 GMT+08:00

What Should I Do If a Msg 823 Error Occurs in Oracle, MySQL, or SQL Server System Logs After a Disk Initialization Script Is Executed?

Symptom

After a disk is added to an ECS and the disk initialization script is automatically executed upon ECS startup, the Msg 823 error occurs in the database system logs of the Oracle, MySQL, and SQL Server databases.

Possible Causes

During the execution of the disk initialization script WinVMDataDiskAutoInitialize.ps1, diskpart is invoked to enable the virtual disk service. After the execution is complete, diskpart exits and the virtual disk service is disabled. The automatic startup period of the built-in WinVMDataDiskAutoInitialize.ps1 overlaps the automatic startup period of the customer's database services, which may cause I/O operation errors.

The database uses Windows APIs (for example, ReadFile, WriteFile, ReadFileScatter, WriteFileGather) to perform file I/O operations. After performing these I/O operations, the database checks for any error conditions associated with these API calls. If the API calls fail with an operating system error, the database reports error 823. For details, see o obtain Microsoft official instructions, see MSSQLSERVER error 823.

The 823 error message contains the following information:

  • Whether the I/O operation is a read or write request
  • The offset within the file where the I/O operation was attempted
  • The database file against which the I/O operation was performed
  • The operating system error code and error description in parentheses

The 823 error message usually indicates that there is a problem with underlying storage system or the hardware or a driver that is in the path of the I/O request. You can encounter this error when there are inconsistencies in the file system or if the database file is damaged.

Solution

  1. Log in to the ECS, open the Run dialog box, enter services.msc, and press Enter.
  2. Search for the virtual disk service and ensure that it has been stopped.
    Figure 1 Checking the virtual disk status

    If the virtual disk service is running, stop it in either of the following ways:

    • On the Services page of the Windows operating system, right-click Virtual Disk and choose Stop.
    • Open PowerShell and run the following command to stop the virtual disk service:

      Get-Service -Name "vds" | Where {$_.status -eq 'Running'} | Stop-Service -Force

  3. Disable the disk initialization script WinVMDataDiskAutoInitialize.ps1 from automatically initializing Windows data disks upon ECS startup.
    1. Open the Run dialog box, enter taskschd.msc, and press Enter. The Task Scheduler window is displayed.
    2. Open Task Scheduler Library, right-click WinVMDataDiskInitialize in the scheduled task list, and choose End.
      Figure 2 Ending WinVMDataDiskInitialize
  4. Restart the ECS or take the data disk offline and then online.
    1. Open the Run dialog box, enter diskmgmt.msc, and press Enter. The Disk Management window is displayed.
    2. Right-click the block to which the disk belongs and choose Offline.
      Figure 3 Setting disk offline
    3. Right-click the block to which the disk belongs and choose Online.
      Figure 4 Setting disk online