Wednesday
- Give proper resource name for each disk in the available storage: This can be done right clicking the disk and selecting the properties option and change the resource name.This will help us to identify the disks in the future steps.I suggest to do it for old disk also for easy identification of disks.In many places it will never show the drive letter.
- Move the new disk to resource group : This can be done right clicking on the available disk and selecting more actions. Do this for each disk and move to appropriate application group(SQL instance)
- Add dependency on the disks for the SQL server instance : This can be done by selecting the right instance under the Services and Application group available in the left pane. Then right click on the SQL server engine resource (which will listed under the Other resource in the detail pane) and select the properties.On the dependencies tab add the new disks.
- Test the failover to make sure that the disks are failing over to the other nodes with out any issue.
Thursday
- Change the recovery model of the user database which are in simple recovery to full recovery.Note down the list of database which were in simple recovery.This will help us to revert back the database to simple recovery after moving to new SAN.
- Schedule a full backup on friday early morning of all availabe user database in that instance. This can be changed depend on the environment and backup policy.The output of the below script can be used to schedule the full backup of all user database.
SELECT 'Backup database ['+name +'] to disk =''R:\DISKmoveFullBackup\'+ REPLACE(name,' ','')+'_Diskmovefriday.bak'' with password =''Password@121''' FROM sys.databases WHERE name NOT IN ('MAster','model','msdb','tempdb','distribution')
- Take a copy of current database file location to excel file.It will be helpful if you need to refer the location at the later stage. I have copied the output of the below query to excel sheet.
SELECT database_id,DB_NAME(database_id),FILE_ID,type_desc,name,physical_name,state_desc FROM sys.master_files
Friday
Sunday : The Big Day
SELECT 'backup database ['+name +'] to disk =''R:\DiskMoveDiffBackup\'+REPLACE(name,' ','')+'_diffsunday.bak'' with DIFFERENTIAL'FROM sys.databases WHERE name NOT IN ('Tempdb','Master','model','msdb'
, 'distribution') AND name NOT LIKE '%_new'
- Disable all logins used by the application. This will be helpful to avoid unnecessary connection request from the application.
- Stop the SQL server agent service from the cluster admin window.
- Kill all existing user session especially from application and agent service.
- Remove mirroring and replication using the script which we have prepared on Friday.
- Take transition log backup of all user database and rename the existing database as _OLD.
- Restore the transaction log backup on top of _new databases with recovery.
- Rename _new database (remove the _new).Each section of this script will help us to perform the the steps 5,6 and 7.
- Detach and attach the distribution database to new drive.
- System databases and resource database will be there in one of the disk and moving them to new disk is a tedious task. We followed following step to do that
- Identify the drive in which the system database and resource database resides .In our case it was M drive and associated new drive is U.
- Alter all database file which is there in M drive (many _old database) to point to U drive.This script will be useful to perform this task.
- Alter all database file which is there in U drive (newly restored databases) to point to M drive.This script
will be useful to perform this task.
- Alter the tempdb database to point the data and log file to new disk.
- Bring down the instance offline through the cluster admin tool. Make sure that that, disks are online.
- Copy the system database root folder from M drive to U drive with all sub folders. We have used the XCOPYcommand to move the all the files along with folder structure to the new drive.
- Swap the drive letter M and U. We can perform this task through the cluster admin.
- Bring the instance online.
- Set up the replication
- Enable the logins disabled in the step 1 and the instance is ready to use.
- Set up the mirroring.
- Change recovery model to simple for those recovery changed as part of Thursday task.
- Enable all backup jobs.
- Drop the _OLD database and remove the dependency on old disks.
- Now the old disks will be available under the 'Available disk group'. Right click on each one and delete.
- Inform your SAN team