Hi all,
I have deleted the .ldf file now i am having only the .mdf file. Is it possible to attach the database without shutdown the sql server.
Thanks.
you can make use of this,
sp_attach_single_file_db [ @.dbname= ] 'dbname' , [ @.physname= ] 'physical_name'but its not possible for multiple data files.....your db will not be accessible if ldf is deleted so you need to attach as said above and a new ldf file willbe created.........|||I tried this solution but i am getting error.File activation failure. The physical file name "C:\Program Files\Microsoft SQL Server\MSSQL\data\details_Log.LDF" may be incorrect.
The log cannot be rebuilt because the database was not cleanly shut down
I want to attch the database without restarting the sql server.
Thanks.|||
this article can help, if you can reading on russian language
http://www.sql.ru/faq/faq_topic.aspx?fid=123
|||Have you bothered to look at the post ONLY 2 posts below yours?
It provides the solution you seek.
|||I didnt get the solution. I dont know Russian language.|||
sp_attach_single_file_db this sp has lot of limitaiton. IF you have properly detached then only you can attachy the db using this System sp.And also it will not work if the db have multiple LOG files. i
You follow these step and see
(a) create a database with the same name in another directory as the one you're trying to attach
(b) re-create all filesgroups and files as necessary
(c) shutdown the server
(d) swap in the old mdf file and any ndf files
(e) bring up the server and let the database attempt to be recovered and then go into suspect mode
(f) put the database in single_user and emergency modes
(g) run DBCC CHECKDB (dbname, REPAIR_ALLOW_DATA_LOSS) which will rebuild the log and run full repair
(h) return database to online, multi_user mode
Madhu
And ofcourse you must get back and tell us whether this solved the prob.
|||Thanks Madhu. This is working fine. But i want to attach without shutdown or restarting the sql server thats very important.|||its good to know that it solved the problem. if the issue is with restarting the server, then you can do all the steps in a standby server (which you can restart ) and once the database is only take the bakcup and restore it in the orginal server
Madhu
No comments:
Post a Comment