Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favourite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved in your SSC briefcase from the favorites tab.
Download now (direct download link)

Restore Database from MDF file without LDF

By Shans,

Hai raino,

I saw ur query posted in SQLServerCentral.It was very useful.But if try to run the query

dbcc traceon(3604)
dbcc rebuild_log ('Training','Training_Log')

Its showing the error
=================Error================
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Server: Msg 5105, Level 16, State 2, Line 2
Device activation error. The physical file name 'Training_LOG' may be incorrect.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
========================================

Can you please tell me why this error comes.this will be very very urgent and iam trying to restore the Database for the past two days.Please help me....


Full Query you have posted
=============================================
shutdown sql

move the current database file or rename it

restart sql server

create a new database of the same name and log file and location as the old database and log file

get rid of the old database.
you may be able to right click delete it in this situation or used sp_removedb

create a new database of the right size and shape with correct log and data file locations

stop sql

rename the new databases.mdf or delete it if you don't have enough space - do not touch the .ldf

move back in the old database .mdf file or rename it back again

restart sql server

it should come up suspect
--------------------------------
1. From a query window, set the status so that you can update the system
tables by running the following query:
use Master
go
sp_configure "allow", 1
go
reconfigure with override
go

2. Then set the status of the DB that is giving you the problem (XXXXX) into
Emergency Mode by running the following query:

update sysdatabases set status = 32768 where name = ''
go
checkpoint
go
shutdown with nowait
go

3. Go into the data directory (MSSQL7\DATA) and rename the log f

Total article views: 307 | Views in the last 30 days: 1
 
Related Articles
FORUM

Renaming a SQL 2K Server?

Renaming a SQL server

FORUM

Rename a database

renaming a database.

FORUM

renamed ReportServerTEMPDB now errors referencing dbo.executioncache

renamed ReportServerTEMPDB now errors referencing dbo.executioncache

FORUM

Rename SQL server Server

Rename SQL server Server

FORUM

To Rename Database in Primary Server For Logshipping

To Rename Database in Primary Server For Logshipping

 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones