[英]How to detect a SQL Server database has been restored
Is there anything unique to a SQL Server database instance which makes it possible to detect it has been restored. SQL Server数据库实例是否具有唯一的东西,可以检测到它是否已还原。 If a client is using a database and decides to restore and run another copy of the same database on a different server - is there a way to tell the difference between the two with a t-sql query?
如果客户端正在使用数据库,并决定在另一台服务器上还原并运行同一数据库的另一个副本-是否可以通过t-sql查询来区分两者之间的区别?
There are several ways to identify a database as a restore/copy of another database: 有几种方法可以将一个数据库标识为另一个数据库的还原/副本:
service_broker_guid
is usually the easiest way. service_broker_guid
通常是最简单的方法。 It is generated when the database was created and is preserved during restore/attach operations. ALTER DATABASE ... SET NEW_BROKER;
ALTER DATABASE ... SET NEW_BROKER;
显式ALTER DATABASE ... SET NEW_BROKER;
so different GUIDs do not necessarily imply different DBs. As you see there are several ways, varying in level of expertise required and in the degree of tampering evidence they provide. 如您所见,有几种方法,所需的专业知识水平和提供的篡改证据的程度各不相同。 It boils down to your requirements and real use case.
它归结为您的要求和实际用例。 Ultimately, remember that SQL Server is not a DRM product.
最终,请记住,SQL Server 不是 DRM产品。 If you have some code/design which you believe is invaluable and must be protected then you should provide the application as a hosted service so that this perceived IP never leaves your physically controlled environment.
如果您认为某些代码/设计非常宝贵且必须受到保护,则应将应用程序作为托管服务提供,以使该感知IP永远不会离开您的物理控制环境。
Database developers and administrators often use GUIDs as primary keys for database tables to ensure uniqueness between databases. 数据库开发人员和管理员经常使用GUID作为数据库表的主键,以确保数据库之间的唯一性。 This material in about comparing GUIDs: http://msdn.microsoft.com/en-us/library/ms254976.aspx
有关比较GUID的材料: http : //msdn.microsoft.com/zh-cn/library/ms254976.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.