I am trying to attach a database just from the MDF file, cause the server crashed and could never find the LDF. I am on a 2019 MS SQL Server. I am following the instructions from this page. I have created the database, took it offline and swapped my MDF and deleted the created LDF. Then put back online. When I run the following command I get the following:
UPDATE sysdatabases
SET status = 32768
WHERE name = 'MyDB'
Ad hoc updates to system catalogs are not allowed.
I ran the previous command without problems
USE MASTER
GO
sp_CONFIGURE 'allow updates', 1
RECONFIGURE WITH OVERRIDE
GO
Configuration option 'allow updates' changed from 0 to 1. Run the RECONFIGURE statement to install.
Furthermore, if I run the next command, I get the following:
DBCC TRACEON (3604)
DBCC REBUILD_LOG(Database_Name, 'g:\Program Files\Microsoft SQL Server\MSSQL15.AUS\MSSQL\Data\MyDB.ldf')
GO
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Msg 2526, Level 16, State 3, Line 2
Incorrect DBCC statement. Check the documentation for the correct DBCC syntax and options.
The log cannot be rebuilt because there were open transactions/users when the database was shutdown, no checkpoint occurred to the database, or the database was read-only. This error could occur if the transaction log file was manually deleted or lost due to a hardware or environment failure.