Dec 14, 2023

Copy User DB and System Data and Log Files from One Drive to Another Due to Disk Slowness Issue

Hi guys, in this blog I am going to explain you about copy User DB and System Data and Log Files from One Drive to Another Due to Disk Slowness Issue.

Issue-

Client Disk Slowness Issue.

Solution-

These guys set up a 1TB SSD in the server and made partitions from it as well.

In SQL Server, we can copy user and system database files from the old drive to the new drive by using the Robocopy command.

 

Step 1-

  • Take the snapshot of the Server.
  • Down the SQL Services of the Server.
  • Open the SQL server configuration Manager-> SQL Server Services->SQL Server (MSSQLSERVER)->Right Click ->Stop the Services.
  • The Agent of the server will immediately quit if you stop the SQL Server Services.









Step 2-

  • Next, launch CMD, select Run as Administrator, and use the CMD shell's Robocopy command.



  • then create a command to copy files to the new drive from the old one.

Syntax-

Robocopy source destination [files] [options]

 

Example-

Robocopy E:\ Z:\ /E /COPYALL

E:\- Old drive name

Z:\- New drive name

/E- Copies subdirectories, including empty ones.

/COPYALL- Copies all file information, including attributes, timestamps, and security information.






Step 3-

  • After the copying process is complete, rename the new drive using the older drive letter. If you don't rename the new drive using the older drive letter, SQL services won't start and an error will appear.

Check the error log for Windows.

  • Event Viewer->Windows Logs-> Application-> Check the error




Step 4 –

To avoid this error, rename the new drive letter with older drive letter.

  • Server Manager->Tools->Computer Management->Storage-> Disk Management->Right Click on disk->Change drive letter->select change->change the drive letter->click ok.








Step 5-

Start the SQL Server Services.





Step 6-

Once SQL Services is started then Start the Agent also of the server.





Step 7-

Now Check the SQL error logs and windows error logs of the Server.

To Check the SQL Error Logs-

  • Connect to server through SSMS ->Management->SQL Error Logs->check the current error logs.

To check the Windows Error Logs-

  • Login on the Server through RDP -> Event Viewer->Window logs->Application-> check the latest windows error logs.

No comments:

Post a Comment

If you have any doubt or question, please contact us.