Running sp_attach_single_file_db gives this error:
The log scan number (10913:125:2) passed to log scan in database 'myDB' is not valid
Isn't it supposed to re-create the log file?
How else would I be able to attach/repair that .mdf file?
It depends what mode your database was in when it was detached, it's possible there are uncommitted/unwritten transactions in that log file that are needed to attach the database, otherwise there would be data loss. Do you know what recovery mode you were in when it was detached?
It worked, when I installed another one (with .ldf log file) then the one in question, then detached the first one again. Don't ask me why.
Related
I want to restore my database on RavenDB from a backup. But take an error - Database.Document file is missing.
Can anyone explain me, what is this a file? Where can I get it?
This file is used to store the db settings for the database. For example, whatever incremental backup it on, what buffer size to use, etc.
I have been asked to analyze a issue regarding one of the biztalk servers. I was asked to free up space on a particular drive, where I found the only file BiztalkMsgBoxDB_log.bak is taking up close 90% of the drive.
Running the following query I later found out that the log space used is only 1.25%.
EXEC ('DBCC sqlperf(LOGSPACE) WITH NO_INFOMSGS')
**Database Name** **Log Size (MB)** **Log Space Used (%)** **Status**
BizTalkMsgBoxDb 24930.49 1.257622 0
currently the Recovery Mode is : FULL and the transaction log back up was taken an hour ago.
I have no clue as to why the log file was created so large.
How can I free up data on this drive.
Thanks in advance,
GHR
You have to shrink your database
Right click on your database => Shrink that's it
Make sure your "Backup BizTalk Server Job" is properly configured and is not failing (check the SQL Server Agent node on the BizTalk database server).
For reference on how to configure this job (and more details of what it does), check MSDN.
My problem is like this: I had a copy of SqlServer 2012 installed on my machine. It's been there for over 3 years without any glitches at all. Just 4-5 days ago, a problem sprouted up. When I started Management Studio it told me that
msdb got corrupted so it cannot be opened.
The complete message is something like this:
Cannot display policy health state at the server level, becuase the user doesn't have permission. Permission to the database msdb is required for this feature to work correctly.
So what could be wrong here? What sudden changes/anomalies could have crept in that has made this unstable? Someone told me it could be due to a wide range of possibilities. The reason could be anything. Even some nuget packages affect the database. Initially I though this could have been an issue with login, permissions etc. So I tried to run as administrator also. No, it did not cure this problem. If you try to create a new database it simply tells me, that I can't do it. The message is something like this:
An exception occurred while executing a T-SQL statement or batch.[Microsoft.SqlServer.ConnectionInfo]. Database msdb cannot be opened. It has been marked as SUSPECT by recovery. [Microsoft Sql Server, Error:926]
How do I recover from this? Can you provide me some guidance? Or a clue where precisely to look for the hints of problem? All my work is stalled. Any kind of assistance in recovering my ailing sqlserver installation will be humbly received.
So, I'm requesting you all to show me the way.
Thanks in anticipation.
I fixed mine with Solution C from the following website. my MSDB was corrupt and not loading so I stopped the services and replaced it with the files from the template in the SQL Server directory.
https://www.mssqltips.com/sqlservertip/3191/how-to-recover-a-suspect-msdb-database-in-sql-server/
"The templates are saved in "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn\Templates" (the path varies by version and install choices, this is the default for SQL Server 2012). By shutting down the instance and replacing the bad MSDB data (msdbdata.mdf) and transaction log (msdblog.ldf) files with the template files I was able to restart the instance without error!" (just incase the website link doesn't work I have quoted it here).
Fissh
If your MSDB is corrupted, restore from your most recent backup. That's the safest thing to do and that's why we have backups to begin with.
If you do not have a backup of MSDB, you have a couple of options.
Recreate it. Detailed instructions here: https://msdn.microsoft.com/en-us/library/dd207003(v=sql.110).aspx#CreateMSDB. This is the best way to ensure you get a clean, functional MSDB and is the fastest way to get up and running again. IMPORTANT: Doing this means you lose all jobs, backup history, etc... that is stored in MSDB. Remember to recreate all maintenance jobs after you're done else you're just waiting for the next thing to fall over (e.g. transaction log backups no longer run, tlogs grow till you run out of disk space - now you can't run any queries that will commit transactions).
DBCC CHECKDB WITH Repair_allow_data_loss is another option which you'll probably find if you google/bing the issue. This might work but it is not recommended. The problem is you don't really know what will be lost. It works by deleting what it can't read then fix the links to get the database physically functional again. Once that's done, you'll have to go back and figure out what remains and is still functional. That is tedious and error prone. Besides, if you're gonna do this very thorough manual check to ensure all your jobs are intact, you're better off just re-creating them on a new, clean MSDB.
I have backed up a database I had created on an other machine running SQL server 2012 express edition and I wanted to restore it on my machine, which is running the same. I have ticked the checkbox overwriting existing one, and got this error:
Backup mediaset is not complete. Files: D:\question.bak. Family count:2. Missing family sequence number:1
This happens if, when you made the backup, you had multiple files listed in the backup destination textbox. Go back to your source server and create the backup again; this time, make sure there's only one destination file listed.
If you had more than one file listed as the backup destination, the backup is striped across them; you'll need all the files to perform the restore.
You can verify this by performing a RESTORE LABELONLY against the single file you copied to your destination server.
Sandra Walter's Answer provides an accurate description of what has happened, but I found the answer a bit lacking.
To make a backup which isn't striped (which is what has occurred in this situation), go back to the window where you setup the backup of your database. At the bottom is a list of paths where the different stripes will go to.
Go to each of the listed paths and delete the stripe of the backup.
Then remove all but one of the paths from the list in the window. And click the "OK" button. Your unstriped backup will be created at that one path.
Hope that helps.
My backup was scheduled on two different locations. once I selected both options during restoration its worked for me.
Current situation:
Delete command executed on production database SQL Server
Rows are not available in last backup
Recovery mode: simple
According to windows, the log file was last modified a day ago. Which if true raises the question: where are the transactions of today if they are not yet written to the log files. Are they still in the buffer??
Question:
Is there a possible way to recover the deleted data?
Is there a way to read what's in the buffer?
Thanks in advance!
No
No
You may attempt to recover the data using a 3rd party log file reader but it probably won't work.
The choice of "Simple" recovery defines your RPO as "last full backup".