user24604008
user24604008

Reputation: 1

How can we make a secondary file group READ_ONLY without affecting connected users in SQL Server?

Let's assume I am working on SQL Server. Currently, the scenario is that I have a database, and that database has a primary file group and a secondary file group. Now, dynamically, via procedure, I want to create a new file group and mark the secondary file group as read-only without any connected user effect.

So, could you please provide me with a way to do this?

set @sqlexecute = n'exec master.sys.sp_executesql '+
        'n''alter database '+quotename(@dbname)+' modify filegroup '+@makereadonlyfilegroup+' read_only;''

I have tried this above code to make filegroup as a ready_only.

Database state cannot be changed while other users are using the database

Upvotes: 0

Views: 64

Answers (0)

Related Questions