database attached is read only

后端 未结 12 1150
借酒劲吻你
借酒劲吻你 2020-12-08 19:03

I used the following the script to attach a database. But the database created is read only.
What modifications should I make in the script to make it read-write. Pl

12条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-08 19:50

    Answer from Varun Rathore is OK but you must consider that starting from Windows Server 2008 R2 and higher the SQLServer service will run under a local virtual account and not anymore under the old well known "NETWORK SERVICE". Due to this, to switch a newly attached DB to "not read only mode", you must setup permissions on the ldf and mdf files for local machine user line "NT SERVICE\MSSQLSERVER" where MSSQLSERVER would be the service name in a pretty standard installation.

    Checkout this https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/configure-windows-service-accounts-and-permissions#VA_Desc for details configuring service permissions

提交回复
热议问题