Sau mấy lần sao chép file mdf từ máy cơ quan về nhà và ngược lại thỉnh thoảng lại bị lỗi không attach được vào SQL server 2008 với những thông báo lỗi đại loại như "An exception occurred while executing a Transact-SQL statement or batch". Copy file Database cần attach vào đúng thư mục có cấu trúc như ở máy cơ quan thì cũng có lúc được, cũng có lúc không, xét về nguyên tắc thì việc làm trên là vô lý nhưng sự thực là cũng có lúc nó được. Cuối cùng tìm kiếm trên internet thì có người bày cho cách xử lý như sau:

- Phân lại quyền truy cập trên hệ thống cho file .mdf và file .ldf
+ Chuột phải vào file .mdf chọn Properties chọn sang thẻ Security
+ Click chọn Edit tiếp theo chọn Add => click Advanced... => click Find Now =>tìm đến tài khoản EveryOne rồi click OK => click tiếp Ok sau đó click vào tài khoản EveryOne vừa Add nhìn xuống dưởi click chọn vào Full Control => click Ok và Ok 
+ Làm tương tự cho file .ldf
- Vào trong SQL server attach lại file CSDL trên!

OK!

5 nhận xét

  1. Nặc danh Says:
  2. em ko attach được file .sql trong SQL Sever 2008? Các các giúp em với

     
  3. Unknown Says:
  4. báo lỗi old version..mong bạn chỉ giúp mình..hienanhaptech@gmail.com

     
  5. Nặc danh Says:
  6. (y) Làm như bạn nói là ok!

     
  7. Unknown Says:
  8. TITLE: Microsoft SQL Server Management Studio
    ------------------------------

    Attach database failed for Server 'ADMINPC'. (Microsoft.SqlServer.Smo)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.2100.60+((SQL11_RTM).120210-1917+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

    ------------------------------
    ADDITIONAL INFORMATION:

    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

    ------------------------------

    Database 'Chat' cannot be upgraded because its non-release version (539) is not supported by this version of SQL Server. You cannot open a database that is incompatible with this version of sqlservr.exe. You must re-create the database.
    Could not open new database 'Chat'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 950)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=950&LinkId=20476

    ------------------------------
    BUTTONS:

    OK
    ------------------------------

     
  9. Unknown Says:
  10. lỗi gì ạ
    TITLE: Microsoft SQL Server Management Studio
    ------------------------------

    Attach database failed for Server 'ADMINPC'. (Microsoft.SqlServer.Smo)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.2100.60+((SQL11_RTM).120210-1917+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

    ------------------------------
    ADDITIONAL INFORMATION:

    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

    ------------------------------

    Database 'Chat' cannot be upgraded because its non-release version (539) is not supported by this version of SQL Server. You cannot open a database that is incompatible with this version of sqlservr.exe. You must re-create the database.
    Could not open new database 'Chat'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 950)

    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=950&LinkId=20476

    ------------------------------
    BUTTONS:

    OK
    ------------------------------

     

Đăng nhận xét