Wednesday, March 7, 2012

restore a sql db

Hi,
I received a sql xxx.mdf file. I believe it is a copy
after detached from the server.
But I don't know the path. When I tried to attach it back
to my sql server, I received error "Error 5173 Cannot
associate files with different databases."
Any suggestion?
ThanksIF the database is a single mdf file... use
sp_attach_single_file_db databasename, "Fully qualified mdf filename"
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"frankie" <frank.su@.harlandfs.com> wrote in message
news:028201c3debe$7ba77370$a101280a@.phx.gbl...
> Hi,
> I received a sql xxx.mdf file. I believe it is a copy
> after detached from the server.
> But I don't know the path. When I tried to attach it back
> to my sql server, I received error "Error 5173 Cannot
> associate files with different databases."
> Any suggestion?
> Thanks|||this is what I got when I used sp_attached_single db
Server: Msg 5123, Level 16, State 1, Line 1
CREATE FILE encountered operating system error 3(The
system cannot find the path specified.) while attempting
to open or create the physical
file 'E:\NewData\Log\ezteller_log.LDF'.
Server: Msg 1813, Level 16, State 1, Line 1
Could not open new database 'ezteller'. CREATE DATABASE is
aborted.
Device activation error. The physical file
name 'D:\Program Files\Microsoft SQL
Server\MSSQL\data\EZTeller_Log.LDF' may be incorrect.
I know the database name, but I don't the file path. Does
it matter?
>--Original Message--
>IF the database is a single mdf file... use
>sp_attach_single_file_db databasename, "Fully qualified
mdf filename"
>
>--
>Wayne Snyder, MCDBA, SQL Server MVP
>Computer Education Services Corporation (CESC),
Charlotte, NC
>www.computeredservices.com
>(Please respond only to the newsgroups.)
>I support the Professional Association of SQL Server
(PASS) and it's
>community of SQL Server professionals.
>www.sqlpass.org
>
>"frankie" <frank.su@.harlandfs.com> wrote in message
>news:028201c3debe$7ba77370$a101280a@.phx.gbl...
>> Hi,
>> I received a sql xxx.mdf file. I believe it is a copy
>> after detached from the server.
>> But I don't know the path. When I tried to attach it
back
>> to my sql server, I received error "Error 5173 Cannot
>> associate files with different databases."
>> Any suggestion?
>> Thanks
>
>.
>|||No, the file path doesn't matter... You simply use the path you copy the
file to... Let's say you copy the file to D:\data\SQL\ezteller.mdf, then
the command would be
Sp_attach_single_file_db ezteller, 'D:\data\SQL\ezteller.mdf'
The error message is whining about the log file however... Are you sure you
are
1. Using sp_attach_single_file_db and NOT sp_attach_db and
2. The file you are attaching is ACTUALLY an MDF file and not a log file?
and
3. The directory etc actually already exists with the mdf file copied to it?
AND
4. the SQL Server login has read/write permissions on the file?
--
Wayne Snyder, MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
www.computeredservices.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"frankie" <frank.su@.harlandfs> wrote in message
news:0a5501c3dec6$e6f9b040$a501280a@.phx.gbl...
> this is what I got when I used sp_attached_single db
> Server: Msg 5123, Level 16, State 1, Line 1
> CREATE FILE encountered operating system error 3(The
> system cannot find the path specified.) while attempting
> to open or create the physical
> file 'E:\NewData\Log\ezteller_log.LDF'.
> Server: Msg 1813, Level 16, State 1, Line 1
> Could not open new database 'ezteller'. CREATE DATABASE is
> aborted.
> Device activation error. The physical file
> name 'D:\Program Files\Microsoft SQL
> Server\MSSQL\data\EZTeller_Log.LDF' may be incorrect.
> I know the database name, but I don't the file path. Does
> it matter?
>
> >--Original Message--
> >IF the database is a single mdf file... use
> >sp_attach_single_file_db databasename, "Fully qualified
> mdf filename"
> >
> >
> >
> >--
> >Wayne Snyder, MCDBA, SQL Server MVP
> >Computer Education Services Corporation (CESC),
> Charlotte, NC
> >www.computeredservices.com
> >(Please respond only to the newsgroups.)
> >
> >I support the Professional Association of SQL Server
> (PASS) and it's
> >community of SQL Server professionals.
> >www.sqlpass.org
> >
> >
> >"frankie" <frank.su@.harlandfs.com> wrote in message
> >news:028201c3debe$7ba77370$a101280a@.phx.gbl...
> >> Hi,
> >> I received a sql xxx.mdf file. I believe it is a copy
> >> after detached from the server.
> >> But I don't know the path. When I tried to attach it
> back
> >> to my sql server, I received error "Error 5173 Cannot
> >> associate files with different databases."
> >>
> >> Any suggestion?
> >>
> >> Thanks
> >
> >
> >.
> >|||I was able to restore the db by create some folders which
I believed the original physical files were at.
Thanks
>--Original Message--
>this is what I got when I used sp_attached_single db
>Server: Msg 5123, Level 16, State 1, Line 1
>CREATE FILE encountered operating system error 3(The
>system cannot find the path specified.) while attempting
>to open or create the physical
>file 'E:\NewData\Log\ezteller_log.LDF'.
>Server: Msg 1813, Level 16, State 1, Line 1
>Could not open new database 'ezteller'. CREATE DATABASE
is
>aborted.
>Device activation error. The physical file
>name 'D:\Program Files\Microsoft SQL
>Server\MSSQL\data\EZTeller_Log.LDF' may be incorrect.
>I know the database name, but I don't the file path. Does
>it matter?
>
>>--Original Message--
>>IF the database is a single mdf file... use
>>sp_attach_single_file_db databasename, "Fully qualified
>mdf filename"
>>
>>--
>>Wayne Snyder, MCDBA, SQL Server MVP
>>Computer Education Services Corporation (CESC),
>Charlotte, NC
>>www.computeredservices.com
>>(Please respond only to the newsgroups.)
>>I support the Professional Association of SQL Server
>(PASS) and it's
>>community of SQL Server professionals.
>>www.sqlpass.org
>>
>>"frankie" <frank.su@.harlandfs.com> wrote in message
>>news:028201c3debe$7ba77370$a101280a@.phx.gbl...
>> Hi,
>> I received a sql xxx.mdf file. I believe it is a copy
>> after detached from the server.
>> But I don't know the path. When I tried to attach it
>back
>> to my sql server, I received error "Error 5173 Cannot
>> associate files with different databases."
>> Any suggestion?
>> Thanks
>>
>>.
>.
>

No comments:

Post a Comment