none
求大神帮助 RRS feed

  • 问题

  • 服务器 "LAPTOP-R3MOJGTD\SQLEXPRESS" 的 附加数据库 失败。  (Microsoft.SqlServer.Smo)

    ------------------------------
    For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=15.0.18142.0+((SSMS_Rel).190722-0816)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=附加数据库+Server&LinkId=20476

    ------------------------------
    Program Location:

       在 Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files)
       在 Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabaseData.PrimaryFile.Attach()
       在 Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabase.SendDataToServer()

    ===================================

    执行 Transact-SQL 语句或批处理时发生了异常。 (Microsoft.SqlServer.ConnectionInfo)

    ------------------------------
    Program Location:

       在 Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType, Boolean retry)
       在 Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType, Boolean retry)
       在 Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries, Boolean retry)
       在 Microsoft.SqlServer.Management.Smo.Server.AttachDatabaseWorker(String name, StringCollection files, String owner, AttachOptions attachOptions)
       在 Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files)

    ===================================

    无法打开物理文件“D:\图形界面创建\student_3.6.mdf”。操作系统错误 5:“5(拒绝访问。)”。
    CREATE DATABASE 失败。无法创建列出的某些文件名。请查看相关错误。 (.Net SqlClient Data Provider)

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

    ------------------------------
    Server Name: LAPTOP-R3MOJGTD\SQLEXPRESS
    Error Number: 5120
    Severity: 16
    State: 101
    Line Number: 1


    ------------------------------
    Program Location:

       在 Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
       在 Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType, Boolean retry)
    2019年10月2日 1:48

全部回复

  • Is d:\ a local disk on the machine? What's sql service account? Did you connect to sql as sysadmin?
    2019年10月2日 16:27
  •  是机器上的磁盘,其他问题我也不知道如何回答
    2019年10月3日 5:13
  • Hi giboijhui,

     

    这应该是个权限问题,你做附加数据库时,连接sql server的是admin账户嘛?其次看看你的sql server服务账户是否对D:\图形界面创建\student_3.6.mdf有读写权限?我建议你找个懂这方面的同事,这样你能更快解决问题。

     

    Best regards,

    Dedmon Dai


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    2019年10月3日 7:50
  • 多谢我试试
    2019年10月3日 13:48
  • 希望我的回复能帮助到你

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    2019年10月4日 7:23