Thursday, February 9, 2012

attach_db problem

Hi all,
i have a problem with attaching database,
i have 3 files: one for data, one for temporary data and one for log, they
are copied to a new location after being detached from a server.
when i try to attach them again as a new database i get a message :
The files 'D:\DATA.mdf' and 'D:\LOG.ldf' are both primary files. A database
can only have one primary file.
in a attach command i list them according to the information i get from DBCC
checkprimaryfile command executed prior to detaching database
if anyone has any idea what can cause such behaviour
mndrWhat version of sql server are you using?
Can you try something like this
exec master..sp_attach_db
@.dbname = 'yourdbname',
@.filename1= 'd:\Data.mdf',
@.filename2='d:\Data.ndf',
@.filename3='d:\LOG.ldf'
"Malgorzata Ndreu" wrote:
> Hi all,
> i have a problem with attaching database,
> i have 3 files: one for data, one for temporary data and one for log, they
> are copied to a new location after being detached from a server.
> when i try to attach them again as a new database i get a message :
> The files 'D:\DATA.mdf' and 'D:\LOG.ldf' are both primary files. A database
> can only have one primary file.
> in a attach command i list them according to the information i get from DBCC
> checkprimaryfile command executed prior to detaching database
> if anyone has any idea what can cause such behaviour
> mndr
>
>|||Could you try to post the exact code you are running?
Regards
Steen
Malgorzata Ndreu wrote:
> Hi all,
> i have a problem with attaching database,
> i have 3 files: one for data, one for temporary data and one for log,
> they are copied to a new location after being detached from a server.
> when i try to attach them again as a new database i get a message :
> The files 'D:\DATA.mdf' and 'D:\LOG.ldf' are both primary files. A
> database can only have one primary file.
> in a attach command i list them according to the information i get
> from DBCC checkprimaryfile command executed prior to detaching
> database
> if anyone has any idea what can cause such behaviour
> mndr

No comments:

Post a Comment