Question:
I backed up a database:
BACKUP DATABASE MyDatabase
TO DISK = 'MyDatabase.bak'
WITH INIT --overwrite existing
And then tried to restore it:
RESTORE DATABASE MyDatabase
FROM DISK = 'MyDatabase.bak'
WITH REPLACE --force restore over specified database
And now the database is stuck in the restoring state.
Some people have theorized that it’s because there was no log file in the backup, and it needed to be rolled forward using:
RESTORE DATABASE MyDatabase
WITH RECOVERY
Except that, of course, fails:
Msg 4333, Level 16, State 1, Line 1
The database cannot be recovered because the log was not restored.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
And exactly what you want in a catastrophic situation is a restore that won’t work.
The backup contains both a data and log file:
RESTORE FILELISTONLY
FROM DISK = 'MyDatabase.bak'
Logical Name PhysicalName
============= ===============
MyDatabase C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\MyDatabase.mdf
MyDatabase_log C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\MyDatabase_log.LDF
Similar Posts:
- SQL Server 2019 opens the data file MDF with an error
- [Solved] Operating system error 995(The I/O operation has been aborted because of either a thread)
- Bt-Panel Type error: cannot concatenate ‘STR’ and ‘nonetype’ objects
- How to Sovle mysqldump backup Error on the MySQL command line
- [Solved] SVN Error: “Failed to run the WC DB work queue associated with”
- Error reported in vscode after installing Git
- Database Backup Error: mysqldump: Got error: 1146: Table ‘enwei_hq.tb_classification’ doesn’t exist when using LOCK TABLES
- C2471 or LNK1140 errors [How to Solve]
- How to Solve Mac Sed Error: command c expects followed by text
- How to Backup MySQL database regularly