How can we restore DB without LDF file ?
We try ...
EXEC sp_attach_single_file_db @.dbname = 'Ascue_10',
@.physname = 'C:\temp\Ascue_10_Data.MDF'
______________________________________
Server: Msg 945, Level 14, State 2, Line 1
Database 'Ascue_10' cannot be opened because some of the files could not be activated.
Server: Msg 1813, Level 16, State 2, Line 1
Could not open new database 'Ascue_10'. CREATE DATABASE is aborted.
Please Help !!!If you do not want the log file SQL will automaticall create one for you when you attach a database in the same loc as the mdf file.
Try this,
sp_attach_db test,
N'c:\program files\microsoft sql server\mssql\data\test_data.mdf'.
You still will get an activation error but the database can be used with the new log file created.
Hope this helps
Anup|||Hello,
I tried to attach my MD and or work with the stored procedures but always it is complaining about the log file which is not able to create...
I tried two options but none is working !!!
EXEC sp_attach_db @.dbname = N'AeXNS_Data',
@.filename1 = N'E:\AeXNS_Data.mdf',
@.Filename2 = N'F:\AeXNS_Log.LDF'
Server: Msg 5105, Level 16, State 4, Line 1
Device activation error. The physical file name 'F:\AeXNS_Log.LDF' may be incorrect.
EXEC sp_attach_single_file_db @.dbname = N'AeXNS_data',
@.physname = N'E:\AeXNS_Data.mdf'
Server: Msg 1813, Level 16, State 2, Line 1
Could not open new database 'AeXNS_data'. CREATE DATABASE is aborted.
Device activation error. The physical file name 'F:\AeXNS_Log.LDF' may be incorrect.
But there is no file with that name AeXNS_Log.LDF as I want to create it from scratch...
Any ideas?
Thanks,
Dom
__________________|||What is a LDF file?|||Dom ... sounds familiar ... have you checked the F:\ drive to ensure the file it is trying to create does not exist?
ck ...ldf = log data file ... not to be confused with MDF or NDF.|||yes I checked C, E and F there is no log files on any drive...|||/*You need to execute "sp_attach_single_file_db" for MSSQL to create the log file
For example if yu want to create a database called rantest with just the MDF file ..you need to execute sp_attach_single_file_db as
EXEC sp_attach_single_file_db @.dbname = 'rantest',
@.physname = 'C:\MSSQL2000\SQLDATA\MYLONEMDF_data.mdf'
A new ldf file will be created in the same path as the MDF. Dont worry about the all the warnings and errors.Refresh it and yu should get back yur database complete with all tables and stored procedures !! :)
Regards,
-Ranjit. */
Commenting it out .. Looks like yu've already tried this option ;)
No comments:
Post a Comment