开发者

SQL server suspect/Off line mode and Data lost

开发者 https://www.devze.com 2023-03-23 09:33 出处:网络
Suddenly I saw my SQL Server is in suspect/OFF Line mode. That\'s why I am not able to do any any operation in my db. For this re开发者_运维问答ason I restarted my server (Windows Server 2003) .

Suddenly I saw my SQL Server is in suspect/OFF Line mode. That's why I am not able to do any any operation in my db. For this re开发者_运维问答ason I restarted my server (Windows Server 2003) .

But when I get ready I found that some of my data has been lost. I have no any back up of my db.

Is there any way to get back the data that I have lost.

the error log:

Could not redo log record (5108:10151:5), for transaction ID (0:1552370), on page (1:3679), database '??'


The database may go in suspected/offline mode if the location of datafile and the log file have been misplaced accidentally or intentionally, and so after restart the database is unable to find its datafiles and goes in suspect or offline mode. This can be resolved by bringing the datafile and the log file back to the original path that has been configured for the database. After that, the database can be restored with no loss using the command 'Restore with recovery'. The original path for the datafile and the log file can be found in the error log of the server that contains the database. Try the solution, hope it will help as it did for me. In another case, the database may go in suspected/offline mode due to off and restart of the server in middle of a transaction and after the restart the transactions may not be committed or rolled back to a consistent state thus leaving database in an inconsistent state turning it suspected or offline. The solution for this is:

alter database <database name> set emergency dbcc checkdb (repair_allow_data_loss) 

As the commnand itself states allow data loss, this command may result in loss of some data from the transaction log and hence we may face a data loss, so it is not recommended for a frequent or unapproved use.


In this case, I suggest you check your log file (LDF). In SQL, this log file records all the INSERT, UPDATE, and DELETE query operations performed on a database.

Suppose you have an LDF file. You can work with Restore and recovery process. I used this process for one of my existing clients & It worked.

https://learn.microsoft.com/en-us/sql/relational-databases/backup-restore/restore-and-recovery-overview-sql-server?view=sql-server-ver16

If you do not have a log file,  you can use stellar repair for SQL this process helps me to recover my data many times.

Thanks

0

精彩评论

暂无评论...
验证码 换一张
取 消