Sunday, March 25, 2012

Attach a DB that was never Detached

Sorry if this is the wrong place to ask this. I have a file "restored.mdf",
that was simply copied from the disk by backup software, i need the data
inside that file. It is 12GB. the file was backed up from
E:\SQLData\MSSQL\Data\ABC.mdf, and is now in
E:\SQLData\MSSQL\Data\restore\restored.mdf.
Is there any way to attach this database to any SQL Server 2000 Server ? If
so, i can then just copy the data from one table to another. I tried
EXEC sp_attach_single_file_db @.dbname = N'restored',
@.physname = N'E:\SQLdata\MSSQL\Data\restore\restored.mdf'
But when i run this i get:
Server: Msg 5105, Level 16, State 4, Line 1
Device activation error. The physical file name
'e:\SQLdata\MSSQL\data\ABC.ldf' may be incorrect.
Server: Msg 1813, Level 16, State 1, Line 1
Could not open new database 'restore_AVC'. CREATE DATABASE is aborted.
Device activation error. The physical file name
'e:\SQLdata\MSSQL\data\ABC.ldf' may be incorrect.
It looks like it is looking for the original logfile, i guess because this
database was never actually detached.Attaching databases that were not detached properly is unreliable, and does
not always work.
If there were open transactions, you will need to use sp_attach_db instead
(as these transactions will need to be rolled forward when the database is
attached). You will therefore need access to the log.
John.
hogwart wrote:
> Sorry if this is the wrong place to ask this. I have a file
> "restored.mdf", that was simply copied from the disk by backup
> software, i need the data inside that file. It is 12GB. the file
> was backed up from E:\SQLData\MSSQL\Data\ABC.mdf, and is now in
> E:\SQLData\MSSQL\Data\restore\restored.mdf.
> Is there any way to attach this database to any SQL Server 2000
> Server ? If so, i can then just copy the data from one table to
> another. I tried
> EXEC sp_attach_single_file_db @.dbname = N'restored',
> @.physname = N'E:\SQLdata\MSSQL\Data\restore\restored.mdf'
> But when i run this i get:
> Server: Msg 5105, Level 16, State 4, Line 1
> Device activation error. The physical file name
> 'e:\SQLdata\MSSQL\data\ABC.ldf' may be incorrect.
> Server: Msg 1813, Level 16, State 1, Line 1
> Could not open new database 'restore_AVC'. CREATE DATABASE is aborted.
> Device activation error. The physical file name
> 'e:\SQLdata\MSSQL\data\ABC.ldf' may be incorrect.
> It looks like it is looking for the original logfile, i guess because
> this database was never actually detached.|||Give the suggestion here a try (no guarantees). Make a backup of your files
first though.
http://tinyurl.com/3s4b6
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backups? Use MiniSQLBackup Lite, free!
"hogwart" <hogwart@.dannyland.com> wrote in message
news:%230tcOwzlEHA.3156@.TK2MSFTNGP12.phx.gbl...
> Sorry if this is the wrong place to ask this. I have a file
"restored.mdf",
> that was simply copied from the disk by backup software, i need the data
> inside that file. It is 12GB. the file was backed up from
> E:\SQLData\MSSQL\Data\ABC.mdf, and is now in
> E:\SQLData\MSSQL\Data\restore\restored.mdf.
> Is there any way to attach this database to any SQL Server 2000 Server ?
If
> so, i can then just copy the data from one table to another. I tried
> EXEC sp_attach_single_file_db @.dbname = N'restored',
> @.physname = N'E:\SQLdata\MSSQL\Data\restore\restored.mdf'
> But when i run this i get:
> Server: Msg 5105, Level 16, State 4, Line 1
> Device activation error. The physical file name
> 'e:\SQLdata\MSSQL\data\ABC.ldf' may be incorrect.
> Server: Msg 1813, Level 16, State 1, Line 1
> Could not open new database 'restore_AVC'. CREATE DATABASE is aborted.
> Device activation error. The physical file name
> 'e:\SQLdata\MSSQL\data\ABC.ldf' may be incorrect.
> It looks like it is looking for the original logfile, i guess because this
> database was never actually detached.
>

No comments:

Post a Comment