如何使用tsql检测SQL Server数据库的只读状态 [英] How to detect a SQL Server database's read only status using tsql
本文介绍了如何使用tsql检测SQL Server数据库的只读状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要知道如何询问我的Microsoft SQL Server,知道给定的数据库是否已设置为只读。那可能吗?
I need to know how to interrogate my Microsoft SQL Server to know if a given database has been set to read only or not. Is that possible?
推荐答案
信息存储在 sys.databases
。
SELECT name, is_read_only
FROM sys.databases
WHERE name = 'MyDBNAme'
GO
--returns 1 in is_read_only when database is set to read-only mode.
这篇关于如何使用tsql检测SQL Server数据库的只读状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文