database files movement from one drive to another drive in sql server
Get link
Facebook
X
Pinterest
Email
Other Apps
1) Capture the .mdf and ldf file namesof that particular datbase to which you want tomoveSELECT*FROM sys.master_files
2) Ensure that you have latest .BAK file available forrollback plan
3) Take that particular database alone into OFFLINE
ALTERDATABASE database_name
SET OFFLINE
4) Move the files tonewlocation5) Run the below command make changes atsystem catlogue level
USE master
GOALTERDATABASE AdventureWorks2012
MODIFY FILE( NAME = AdventureWorks2012_Log,
FILENAME ='C:\NewLoc\AdventureWorks2012_Log.ldf');
GOALTERDATABASE AdventureWorks2012
MODIFY FILE ( NAME = AdventureWorks2012_Data,
FILENAME ='C:\NewLoc\AdventureWorks2012_data.mdf');
6) Bring the database ONLINE
ALTERDATABASE database_name
SET ONLINE
7)Once the database came online run the below commmand to chek whether the new path appearing at catlogue levelSELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N'<database_name>');
We can run below PowerShell and SQL Server commands when we want to find ou when the failover has happened. cls Get-winEvent -ComputerName ListerNameHere -filterHashTable @{logname = 'Microsoft-Windows-FailoverClustering/Operational' ; id = 1641 } | Where-Object { $_ . Timecreated -like '*05/09/2020*' } | Format-Table -AutoSize -Wrap <# 35201-->timeout alert run this by changing -LogName to System 41-->41 is power shutdown run this in system #> clear Get-EventLog -LogName Application -After ( Get-Date ) . AddHours( -48 ) | Where-Object { $_ . EventID -in ( 1100 , 1074 , 35201,41,1561,7024,1135,7032,1146 )} | Format-Table -AutoSize -Wrap cls Get-EventLog ` -LogName System |Where-Object{$_.EventID -in (1054,1053,1055,1138,1141,1142,5140,5142,1559,1560,1563,1588,1068,5144,1562,5143,5168,1564,1177)}|Format-Table -AutoSize -Wrap EXEC sp_readerrorlog 0,1,'lease worker' EXEC sp_readerrorlog 0,1,'...
One day in one of my Active-Passive cluster environments while patching SQL Server 2012 environment I found the below Error. Here are the observations 1) Failover cluster Health is good, all the roles, drives and nodes are running fine. Both the nodes are running pinging one to another. Though the Error message says cluster is disabled or needs to start, cluster service is running fine in the services.msc Below are the error screenshots. The below command did the trick in my environment. Seems to be issue with MOF files. mofcomp C:\Windows\System32\WBEM\cimwin32.mof
Comments