Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Database on SQL Server


  • Please log in to reply
2 replies to this topic

#1 SterlingCross

SterlingCross

  • Members
  • 1 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Chicago
  • Local time:02:12 AM

Posted 24 February 2018 - 10:43 AM

I have been using SQL Server 2012 during some years. I was working during all the night yesterday evening. After I almost finished my work, I tried saving my changes, and SQL Server stopped responding and it was closed. I opened it again and I got Corruption on data pages. I've no idea what to do next. I applied SQL Server Management Studio, but it was useless.



BC AdBot (Login to Remove)

 


#2 RecursiveNerd

RecursiveNerd

  • Malware Study Hall Junior
  • 180 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Louisville, KY
  • Local time:03:12 AM

Posted 24 February 2018 - 12:50 PM

What is it exactly that you're asking for help on?

Do you need help fixing the data corruption or help understanding how it happened and where to go next? Applying SQL Server Management Studio doesn't do anything as far as I'm aware, since it's simply a front-end to manage your databases.

 

Have you tried running the statement DBCC CHECKDB, with the relevant MSDN documentation here. With that said, there are a few things worth noting:

  • Don't run DBCC CHECKDB with any REPAIR option, unless you are willing to lose data. If CHECKDB returns any error messages, you can then decide whether you want to run the command again with a REPAIR option, or just restore from a last known good backup. In most cases, if you're following proper database management, your best option is going to be restoring from a backup because the REPAIR option commonly causes more lost data than what a backup would.
  • The command needs to be run in a single-user instance
  • Backup the entire database (.mdf, .ndf, .ldf, and other data files) before performing any repair operations.


#3 Lucgentr

Lucgentr

  • Members
  • 1 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Montreal
  • Local time:02:12 AM

Posted 27 February 2018 - 02:37 PM

I have been using SQL Server 2012 during some years. I was working during all the night yesterday evening. After I almost finished my work, I tried saving my changes, and SQL Server stopped responding and it was closed. I opened it again and I got Corruption on data pages. I've no idea what to do next. I applied SQL Server Management Studio, but it was useless.

Pat, there is a tutorial below, especially for cases like your, in case nothing helped typed in Google mssql database repair tool – it is one of the most popular queries, on it Google gave following articles, guides, etc…

https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/restore-and-recovery-overview-sql-server

https://www.mssqltips.com/sqlservertutorial/112/recovering-a-database-that-is-in-the-restoring-state/

https://www.repairtoolbox.com/sqlserverrepair.html

There might be other options out there. This is something that worked for me once but there are no guarantees that it will work at all times.

Stop SQL Server instance -> Copy MDF and LDF files to another location -> Delete original MDF and LDF files -> Start SQL Server instance again -> Create new database with exact same name and file names -> Stop SQL Server -> overwrite newly created MDF and LDF.

After this your database should be back online. If it is then go ahead and put it into EMERGANCY mode and SINGLE USER mode.

Finally go ahead and execute DBCC CHECKDB like this

DBCC CHECKDB (databaseName, REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS

If you can get to this and execute last command successfully, you should be good on.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users