Question : How to attach SQL 2000 database (MDF) without a LDF file.

Hi..

I have a big problem, hope that you can help...

I have windows 2003 server with CA brightstor 11.0 (Build 2670)

and is making backup to all my SQL Servers.

so I need to restore a database where the MDF file is 4 GB and the LDF file 111 GB.

So right now I already restore the MDF file of 4 GB. but I cannot restore the LDF file..

So I want to attach this MDF file to a test server that have SQL 2000 with SP4.

so I check in this site how to restore the MDF to SQL but not good luck...

can someone help.. how to attach the MDF file on the query analyzer..

if I miss something that cannot be understand , please let me know...

thanks

Regards.

RTL

Answer : How to attach SQL 2000 database (MDF) without a LDF file.

If you need to ignore the current LDF file and if your database is not detached properly and if you do not have the backup, follow the below steps to bring up your database. In the below step-7 is a undocumented DBCC command.

1. Create a new database with the same name and same MDF and LDF files 2. Stop sql server and rename the existing MDF to a new one and copy the original MDF to this location and delete the LDF files.
3. Start SQL Server
4. Now your database will be marked suspect 5. Update the sysdatabases to update to Emergency mode. This will not use LOG files in start up

Sp_configure "allow updates", 1
go
Reconfigure with override
GO
Update sysdatabases set status =  32768 where name = "BadDbName"
go
Sp_configure "allow updates", 0
go
Reconfigure with override
GO

6. Restart sql server. now the database will be in emergency mode

7. Now execute the undocumented DBCC to create a log file

DBCC REBUILD_LOG(dbname,'c:\dbname.ldf')  -- Undocumented step to create a new log file.

(replace the dbname and log file name based on ur requirement)

8. Execute sp_resetstatus

9. Restart SQL server and see the database is online.
Random Solutions  
 
programming4us programming4us