Showing posts with label item. Show all posts
Showing posts with label item. Show all posts

Wednesday, March 28, 2012

Problems in attaching db

Does anyone know why trying to attach a db (.mdf and .ldf files) to a new db, the "Attach database" item in the menu is disabled, please? do I have to reinstall SQL Server?Originally posted by atorlone
Does anyone know why trying to attach a db (.mdf and .ldf files) to a new db, the "Attach database" item in the menu is disabled, please? do I have to reinstall SQL Server?

You could try to attach your db with a t-sql statement.

sp_attach_db @.dbname = 'db name',
@.filename1 = 'path_to/file.mdf' ,
@.filename2 = 'path_to/file.ldf'|||I entered the following in the Query Analyzer and got the result shown:

EXEC sp_attach_db @.dbname = N'AARETAIL',
@.filename1 = N'C:\MSSQL7\Data\AARETAIL_Data.MDF',
@.filename2 = N'C:\MSSQL7\Data\AARETAIL_Log.LDF'

Server: Msg 5172, Level 16, State 15, Line 1
The header for file 'C:\MSSQL7\Data\AARETAIL_Log.LDF' is not a valid database file header. The PageAudit property is incorrect.

I can find nothing about PageAudit property.

What is it and how do I need to modify the command?

Many thanks!|||Originally posted by atorlone
I entered the following in the Query Analyzer and got the result shown:

EXEC sp_attach_db @.dbname = N'AARETAIL',
@.filename1 = N'C:\MSSQL7\Data\AARETAIL_Data.MDF',
@.filename2 = N'C:\MSSQL7\Data\AARETAIL_Log.LDF'

Server: Msg 5172, Level 16, State 15, Line 1
The header for file 'C:\MSSQL7\Data\AARETAIL_Log.LDF' is not a valid database file header. The PageAudit property is incorrect.

I can find nothing about PageAudit property.

What is it and how do I need to modify the command?

Many thanks!

Do you run MsSql 7 or 2000 ?|||Originally posted by atorlone
I entered the following in the Query Analyzer and got the result shown:

EXEC sp_attach_db @.dbname = N'AARETAIL',
@.filename1 = N'C:\MSSQL7\Data\AARETAIL_Data.MDF',
@.filename2 = N'C:\MSSQL7\Data\AARETAIL_Log.LDF'

Server: Msg 5172, Level 16, State 15, Line 1
The header for file 'C:\MSSQL7\Data\AARETAIL_Log.LDF' is not a valid database file header. The PageAudit property is incorrect.

I can find nothing about PageAudit property.

What is it and how do I need to modify the command?

Many thanks!

try attaching the database without the logfile:
EXEC sp_attach_db @.dbname = N'AARETAIL',
@.filename1 = N'C:\MSSQL7\Data\AARETAIL_Data.MDF'