In SQL Server 2005 when I try to attach my database (MDF) it shows 'not a primary database', but this database has one MDF and one LDF only. How can I fix it?
A search on the term "Primary Database" in Books Online lists entries for log shipping and database mirroring. These are pretty advanced topics. It sounds very much like you need to find out a lot more about where the database you're working with is coming from, i.e. was it part of a log shipping or database mirroring setups. Which this knowledge, you'll know what it is you need configure on your new (?) system.
Can you show us exactly how do you try to attach the database? A common mistake is to run
sp_attach_db w/o specifying the database name:
exec sp_attach_db 'c:\mypath\mydb.mdf', 'c:\mypath\mydb.ldf'
Because the database mane is missing, the first paramter passed in (the path to the MDF) is actually the database name and the MDF is missing, resulting exactly in the error you mention. The correct way is:
exec sp_attach_db 'mydb', 'c:\mypath\mydb.mdf', 'c:\mypath\mydb.ldf'