DB attach 오류
나의 경우 스크립트로 DB 생성부터 프로시저, 초기 데이터까지 한방에 넣는 프로그램을 짜 놨는데
저런에러만 뜨고 윈도우 계정이듯 SA계정이든 클라이언트 툴이든 아무것도 안되는거다.
네트워크 로그인 시스템이라 권한문젠가 해서 봤는데도 아니고. 쓰기제한인가 해서 봐도 안되고..
그래서 열심히 외쿡사이트를 뒤졌는데... 한참 찾다보니 나오네.
1. 이렇게 서비스 화면에서 SQL SERVER에 속성을 들어간다.

2. 지금 계정 지정 상태를 로컬 시스템 계정과 데스크탑 상호 연동으로 바꾼다.

3. 서비스를 재시작 한다.
그리고 다시 실행 해 보면 잘 된다.
이게 윈도우 권한 중에 어떤 권한을 막아놨거나 등등으로 인해 생기는 문제기 때문에 OS쪽 문제라서 어찌 해결방법은 모르겠다.
단지 파일 생성 권한을 안준다는 것 밖에는... 네트워크 로그인 관리자에게 문의를 해 봐야 알긴 개뿔이 -_-
그냥 로컬권한으로 해서 써라 별수 없다.
아래는 원본.
Operating system error 5: “5(Access is denied.)”
I spent a good number of hours the last couple days banging on a C# app trying to figure why I kept getting an “Access is denied” error when the application tried to attach to a local MDF file (SQL Server Express 2005). A Google search turned up numerous theories and “solution”. Based on the variety of solutions I’d venture to guess Microsoft, with its wonderful Vista, created several ways to arrive at this error.
For my case the solution was quite simple once I figured how to do it. First, I knew my app needed to run with elevated permissions, but even if I right clicked and selected “Run as administrator” the problem persisted. I read about creating SQL user accounts, and granting permissions, blah, blah, blah. None of those changes made a lick of different.
After much poking around the problem turned out to be the way the SQL Server service was configured. It was setup to run as a “Network Service” instead of the “Local System” account.
So here is the fix:
- Open ‘Services’ (type ’services’ in Start Search on Vista)
- Find SQL Server, right click, and select Properties
- Under the ‘Log On’ tab select Log on as ‘Local System account’
That’s it. Run as administrator and everything works perfect.
[출처] 운영 체제 오류 5(액세스가 거부되었습니다.)(으)로 인해..|작성자 신덕환