Restore / Recover SQL Database From Data File
Feb 24, 2002Our SQL database log file got physically deleted. Now the database is in suspect mode. Is it possible to recover / restore the database just with the data file.
View 3 RepliesOur SQL database log file got physically deleted. Now the database is in suspect mode. Is it possible to recover / restore the database just with the data file.
View 3 RepliesI created a new database and want to recover data from a backup this script
use master
go
restore database new
from disk='D:
ew.bak'
go
but get an error
Message 3141, Level 16, State 0, Line 1
The database to be restored was named 'ats342'. Reissue the statement using the WITH REPLACE option to overwrite the 'new' database.
Message 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
DOES ANYONE KNOW HOW I CAN RESTORE A SQL7 DATABASE WITH JUST THE DATA FILE?
THERE IS NO GOOD BACKUP OF THE DATABASE AND THE LOG FILE IS MISSING. THE CLIENT THOUGHT THEY WHERE BACKING UP THE DATABASE BACKUP FILE TO TAPE, BUT THEY WHERE NOT. THE BACKUP FILE WAS BEING OVERWRITTEN EVERY NIGHT. THE LAST NIGHTS BACKUP DID NOT GET TO FINISH TO COMPLETION.
PLEASE, ANY INPUT WOULD BE APPRECIATED.
THANKS,
TIM
hi all,
i have SQL 2000 server with SP3, yesterday my database was suddenly goes to suspect mode. then i found log in sql server log. and it shows following text:
I/O error (bad page ID) detected during read at offset 0x00000000030000 in file 'C:Program FilesMicrosoft SQL ServerMSSQLDataMFS_Data.MDF'..
kindly, do needful for recover data from this file...
Tejas Kishanwala
I am working on SQL Server 2008 R2 and unfortunately I have lost my .mdf file after detaching it from my database, but the .ldf is still in my system. Is there a way to recover my database from .ldf file?
View 3 Replies View RelatedHello!
Hopefully someone can help me with the following (potentially huge) problem:
We've got a simple database application running on microsoft sql desktop engine. This database contains two tables. Up until now all worked fine, but probably due to a programma that crashed part of the database seems to be corrupted or broken while today only one table contains/returns data and the other table does not return any values!
When I open the .ldf and .mdf files in notepad I see that there is data belonging to both the tables. But how do I recover it??
The max. size of the database has not been reached by far (it's only 9Mbs), the sql queries are correct.
This .ldf file is a log file (?) I can't find detailed info about the principles of these .ldf and .mdf files on the internet, is it possible to trace back what has happened en recover the database that way?
Thanks in advance.
Greetings,
Rens Voogd
Recently i got task from Senior DBA, as : Recover a database without LOG file Currently Data File is available.
Log file is also available, but shows size as 0 KB. Means Log file is corrupted.
Currently existing DB is shown as Offline Mode in SSMS.
So i got below link:
[URL]
When i tried 1st/2nd solution from above link, i got below message: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.
To try that 3rd solution, I had to DELETE/Remove existing DB from SSMS, so i can create New DB with same name.
When i tried to delete Log file from Command Prompt, using below command, Windows replied that File is corrupted, so it cannot be deleted.
DEL /F /Q /A C:Program FilesMicrosoft SQL ServerMSSQL11.SQLEXPRESS2012MSSQLDATAMyDB.ldf
Meanwhile my Senior DBA brought DB in Recovery Pending mode.
So if i want to go for 3rd solution,then i need to DELETE file, But Windows is not allowing me.
[URL]
Hi All,
By mistake i delete database from sql server. Due to which the the mdf and ldf file of the datbase are removed from my system. Then i used file recover utility and retrived my mdf and ldf files.But now i am not able to attach those files into databse. These mdf and ldf files has been corrupted. Now how can i recover my data from those mdf and ldf files.Please answer me if you have any solution on this problem.
Regards,
Satish Rotella
I run MSDE on a Windows XP Server and my database was marked as "suspect" by Enterprise Manager and its icon become gray. I detach that database and try to re-attach it but there is an error as the following:
Error 3624:
Location : page.cpp:2801
Expression: rowLength >= offset + deleteLenght
SPID : 56
Precess ID:1612
After that, I uninstall the MSDE and re-install new MSDE SP4 and try to re-attach the database file again and there is still an error. Is there anyway i can recover the data from that database?
SQL server. By-mistake I updated values of a column in a database hosted online, is there any way undo the transaction. I didn't created any backup of the database. I read that still it can be recoverd through the .ldf (log file) but unable to access it. Is there anyway to get access of the Log file or is there any way to recover the data.
View 3 Replies View RelatedI have SQL server 2000 which recently crashed. I try to recover it andfound out that the Master database is corrupt. I never backup myserver using inline sql backup nor any third party backup program thataware to SQL server. But I have full system backup of volume c on tape(using NTBackup), which includes old version of Master database. Myquestions are:1. How can I recover this file into SQL server?2. If so, it is not risky to recover Master database from two weeksago?Thanks in advance!
View 1 Replies View RelatedHi all. A few days ago i installed mcafee total protection 2007 and that disabled my internet connection totally!! I couldn't fix it so i had to uninstall it. After uninstalling mcafee total protection 2007 still i couldn't join Internet!!
So i got mad and went and made repair installation of windows xp pro. After repair installation i couldn't activate it since Internet connection was still not working!! So i went and installed another copy of xp pro on different folder and named it WINDOWS (old one was WINDOWS2).Thanks god now i could join Internet but all my shortcuts and menu items are not visible.
Unfortunately I can't even start sql server 2000 either!! could any one tell me what should i do in order to get access to all database tables and data that i had in sql server and make a back up. I didn't install any new sql server yet. I be happy if an expert tell me what should i do. The installation folder of old windows(WINDOWS2) is still available along with sql server installation folder.Thank and looking forward for reply.
I accidentally deleted some useful data in my database. I have both .LDF and .MDF files for this database.
Is there a way to recover this database to a point of time?
Thx.
Hi all, I am working with SQL Server2000 and I have done a horrible thing here.
We here have an script that delete all data from all user tables of a database, and I run it in the master DATABASE.
As we don't made backups of this database, now somethings of the database aren't working.
Here is the script:
declare @table_name sysname
declare @alter_table_statement varchar(256)
declare @delete_statement varchar(256)
-- definindo o cursor...
declare table_name_cursor cursor local fast_forward for
select
name
from
sysobjects
where
xtype = 'U'
and
name <> 'dtproperties'
-- desligando os vínculos...
open table_name_cursor
fetch next from table_name_cursor into @table_name
select @alter_table_statement = 'alter table ' + ltrim(rtrim(@table_name)) + ' nocheck constraint all'
exec(@alter_table_statement)
while @@Fetch_Status = 0
begin
fetch next from table_name_cursor into @table_name
select @alter_table_statement = 'alter table ' + ltrim(rtrim(@table_name)) + ' nocheck constraint all'
exec(@alter_table_statement)
end
close table_name_cursor
open table_name_cursor
fetch next from table_name_cursor into @table_name
select @delete_statement = 'delete from ' + ltrim(rtrim(@table_name))
exec(@delete_statement)
while @@Fetch_Status = 0
begin
fetch next from table_name_cursor into @table_name
select @delete_statement = 'delete from ' + ltrim(rtrim(@table_name))
exec(@delete_statement)
end
close table_name_cursor
open table_name_cursor
fetch next from table_name_cursor into @table_name
select @alter_table_statement = 'alter table ' + ltrim(rtrim(@table_name)) + ' check constraint all'
exec(@alter_table_statement)
while @@Fetch_Status = 0
begin
fetch next from table_name_cursor into @table_name
select @alter_table_statement = 'alter table ' + ltrim(rtrim(@table_name)) + ' check constraint all'
exec(@alter_table_statement)
end
close table_name_cursor
deallocate table_name_cursor
I have tried to restore master table with the restore function, but it doesn't work. When I try to do this I received a message informing that it can't copy the data because one file was in use. The server was in a single user mode.
Is there anyway to recover the data that I have lost?
Hi,
The standby file (.tuf file) got deleted accidentally on the secondary. How can I recover the database without the standby file?
Hi
I have a question concerning backup / restore / recover of a MS-SQL-Server-Database.
Following configuration exists:
MS-SQL-Server running on NT
OS, Server located on a mirrored Raid 0 Disk -> C:
Transactionlog-Files (.ldf) on the same physical mirrored Disk -> E:
Database-Files (.mdf) located on a separate pyhisical Disk (Disk-Set, Raid 5) -> D:
I take a full backup every night of all databases, no Transaction-Log backup is made during a day (never)
Assuming following situation:
During a day one Database became corrupt. The physical-file (.ldf) of corrupted database is still accessible
on Drive E:
1. Step: I make a copy of the .ldf-File and put it on a secure place or in an other directory
2. Step: I restore the DB from the last full backup
3. Step: ???? How is it now possible to recover from the physical available .ldf-File? I know it should be
possible but I don't now how.
Has anybody tips or suggestion or has someone ever had a similar situation? Feedback would be appreciated.
Kind regards
Gabi
I need to recover some data in a table but i'm not 100% sure the right way to do this safely.
I'll need to query the two tables to compare the before and after but how do i go about restoring/attaching the backup database to SQL without causing conflicts?
If I restore, I assume this would just overwrite which is obviously the worst thing that can happen. if i attach the backup, how does this affect the current live DB? how do i make sure that it's not getting accessed and mistaken for the live DB?
The SQL server is 2008 R2 running as a VM.
If a SQL 2000 server instance is destroyed, but the database file (*.mdf) is saved on the disk, can a database within a newly created server instance be built on the saved file?
If I attempt to create a new database and choose the saved mdf file as the data file, then the server refuses to accept this file. Is there a way to create the new database and make it read the standalone mdf file?
Please help if at all possible. Thanks.
Hi,
Is it possible to restore a database with only a .bak file??
When I try to restore the system comes up with 2 paths where probably the original .mdf and .ldf files existed, but on my system they don't exist. How can I avoid this problem? (it's not possible to get the ldf and mdf files anymore...)
Grtz
Carlos
Hello guys,
is it possible to restore an SQL server database from the .ldf file only?
The last operation is a script execution that have drop and create all the tables.
have you some idea?
Thanks to all
Hello, I had backed up a database from SQL 2000, just before I format my computer. Now I have installed SQL 2005 and trying to restore that database to it, it doesn't work and I get the following error when doing that
===================================
Restore failed for Server 'localhostSQLEXPRESS'. (Microsoft.SqlServer.Express.Smo)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Smo.Restore.SqlRestore(Server srv)
at Microsoft.SqlServer.Management.SqlManagerUI.SqlRestoreDatabaseOptions.RunRestore()
===================================
System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than the existing '2for1' database. (Microsoft.SqlServer.Express.Smo)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&LinkId=20476
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQueryWithMessage(StringCollection queries, ServerMessageEventHandler dbccMessageHandler, Boolean errorsAsMessages)
at Microsoft.SqlServer.Management.Smo.BackupRestoreBase.ExecuteSql(Server server, StringCollection queries)
at Microsoft.SqlServer.Management.Smo.Restore.SqlRestore(Server srv)
========================================================
any help is appreciated
Thanks,
I have to do a database restore from tape from a couple of months ago. When I look at the SQL scheduled task history all databases were sucesfully backed up to a .DAT file. However, when I look at the .DAT file which I have just retrieved from tape - the database which I am looking for isn't listed under the backup information, so I can't choose it to carry out the restore.
Has anyone seen this problem before?
What do I do?
Thanks
Derek
I have been trying to use DMO(C++) to backup a database and then restore from that backup to a new db name AND physical data and log files, with no success. I have been able to successfully restore the backup to the same database and change the physical file names using the RelocateFiles property on the Restore object, but not change both.
Any help would be greatly appreciated.
Now i must restore a database from a backup file of MS SQL Sever 6.5,but this file is bad. When i restore database from this file, SQL Server tell me that the format of this file is not file format of SQL Server 6.5.So that I must repair this backup file firstly. I don't know database file format of SQL Server 6.5.
View 2 Replies View RelatedHello,I need to restore the Master DB in my SQL 2k server (with sp3). Theproblem is that i don't have SQL backups of this file I only havegeneral backup of the entire c: drive i made using NTBackup. So itried all I know and succesfully run the rebuildm utility. Now when Itry to restore it from the general backup (not SQL backup) using"restore database master from gen_backup" i got error: "The file ondevice 'gen_backup' is not a valid Microsoft Tape Format backup set."RESTORE DATABASE is terminating abnormally.Any ideas how I can restore it?
View 2 Replies View RelatedHi guys
I have backup my database with "file and filegroup"selected. I have dropped my database by accident. is it possible to restore my data back from "file and filegroup".bak??
Thanks
One of our database came to Restoring mode. I suddenly stop my SQL service and Copied only MDF files again Started SQL service ,unexpectedly i dropped the Database. Now i cant able to attach the database only with my MDF file.
I tried below Scripts. All scripts shows same error.
EXEC sp_attach_single_file_db @dbname='PhoenixPolice',
@physname=N'C:Program FilesMicrosoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLPhoenixPolice.mdf'
GO
CREATE DATABASE PhoenixPolice ON
(NAME = N'PhoenixPolice',
FILENAME = N'C:Program FilesMicrosoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLPhoenixPolice.mdf')
FOR ATTACH_REBUILD_LOG
GO
CREATE DATABASE phoenixPolice ON (FILENAME = N'C:Program FilesMicrosoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLPhoenixPolice.mdf')
FOR ATTACH
All scripts shows below error
File activation failure. The physical file name "F:Microsoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLDATAPhoenixPolice_1.ldf" may be incorrect.
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.
Msg 1813, Level 16, State 2, Line 1
Could not open new database 'PhoenixPolice'. CREATE DATABASE is aborted.
Hi SQL server experts,
I'm trying to restore from a backup file.
I need to restore the datafile and logfile to different names.
I modified the options page, changed the 'Restored As' file name.
I clicked on the General page and Clicked on the Options page again, the old values came back.
How do I handle this?
Thanks in advance.
Pingx
Hi Everybody,I use MS SQL server 2000 enterprise manager on a windows server 2003.I created a new database in enterprise manager, and try to restore the new database from a .bak file. I went to ---->restore database. I checked "from device" and select the right path to the .bak file.Then I click ok, but there is an error pop up." tend to override existing database", so I went to --->option, and checked "force override existing database". then I click ok, but get an error look like this http://ewwa.lo7.net/error.JPGI thought it was a problem with my .bak file. So I try to use another .bak file which I am sure it is 100% good. It prompt the restore is sucessfully. But when I checked the db, there nothing there(No tables).I think there must be something wrong with my enterprise manager's configuration.Do you know what happen with my enterprise manager? Thank you a lot in advance:)!!
View 2 Replies View RelatedHello,
I have a user database which has 1 data file and 1 logfile.
I did a complete backup of the database to a file on the disk drive, using Enterprise manager. Due to some reason, I had to drop the database. The only way I could restore it was by,
1. Create the database with the same name.
2. Restore the complete backup from the file device.
While doing so,
I get the message "Backup set holds the backup of daatabase other than the existing 'userdbname' database. BAckup terminating."
Is it because the database was dropped and recreated.
If I choose the option to overwrite, it restores successfully.
Is this normal and right way to do it? Is there any thing else that I need to take care of, while backup or restore?
Any suggestions welcome.
Thanks,
MMS
Hi.
I've following problem:
- Customer played with his logical drives in a CPQ smart array
- He played too much: he lost the drive with the LDF-File
- Now the SQL-Server is in a kind of wired mode; you can
start and stop it, but you cannot connect to (neiter 'sa' nor
any other user available before)
In fact the mode is not wired: what shall he do other when
most important file is missing... :o
- The problem for me now is:
> How can I get the Enterprise Manager or Query Analyzer
up and running again to start a restore?
PS: The restore is to be done from a tape-library running
Veritas Backup Exec + SQL-Agent
PPS: Error-log says (what I already know):
2005-10-04 17:18:02.69 spid11 Device activation error. The physical file name 'H:DEVLOG1DEVLOG1.ldf' may be incorrect.
Thanks in advance for assistance.
Regards,
Carsten Loeffler
hi
can you posible one tabel restore in database using full backfile
thanks
hi
i have restore database use backup file in another machine of same name of database there following error
TITLE: Microsoft SQL Server Management Studio
------------------------------
Restore failed for Server 'database name'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
The backup set holds a backup of a database other than the existing 'dbname' database.
RESTORE DATABASE is terminating abnormally. (Microsoft SQL Server, Error: 3154)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=3154&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------