Monday, March 19, 2012

Database Attache Problems

When I attempt to attache an existing SQL Database in SQLExpress, I get sent to the attach databases dialog. I click on the add button and get an abend with the following message.
Locate Database Files - server\SQLEXPRESS dialog box. c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data
Cannot access the specified path or file on the server. Verify that you have the necessary security privledges and that the path or file exists.

If you know that the service account can access a specific file, type in the full path for the file in the File Name control in the Location dialog box. When I click on OK, the Location Database Files dialog box opens, pointing me to my cd drive and does not permit me to alter the drive letter.

Since the database is on my C: drive, this will not work for me.

I have been unable to find any reference to the E: drive for SQLExpress in either that program directory or in the registry.

I went as far as removing the entire suite, then deleting everything that I could find having to do with it, registry entries, settings, common files, etc. I then re-installed the entire package and guess what, same thing.

Anyone have any ideas of how I get around this or how to fix it?

Any and all help will be greatly appreciated.

Thx, Tom

hi,

are the database files in the c:\Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\Data directory or elsewhere?

by default SQLExpress installs setting the NetworkService account to be the one to run the service, and this account is "limited" in NTFS permissions (and that's ok... it's just too large in permissions as well ), but should access without problems the provided path... but not c:\ pr the like...

but I already heared problems about the browsing dialog... with no additional workarounds..

but you can try yourself writing the Transact-SQL code to be executed in a "New query window"..

say you created and detached a database named testDB in the C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ with physical files named testDB.mdf and testDB_log.LDF

just execute, as a logged sysadmin,

SET NOCOUNT ON;

USE master;

GO

USE [master]

GO

CREATE DATABASE [testDB] ON

( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\testDB.mdf' ),

( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\testDB_log.LDF' )

FOR ATTACH;

GO

this will "manually" attach the db, according that you have enought permissions to the folder containing the physical file (obviously the account running the SQL Server instance has enought permissions on this sample location)..

regards

|||Andrea, thank-you very much for the help. Worked like a charm.

Regards, T

No comments:

Post a Comment