Sql server 2012 express - 有没有办法将其重置为默认出厂设置? [英] Sql server 2012 express - is there a way of resetting this to default factory settings?

查看:356
本文介绍了Sql server 2012 express - 有没有办法将其重置为默认出厂设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我最近安装了Microsoft SQL Server 2012 Express,并添加了一些空白的数据库。我想删除这些自定义数据库,只保留安装附带的数据库(如果有的话)。



有谁知道怎么把它带回原来的,我应删除/保留数据库中的默认设置或数据库?



谢谢



我尝试了什么:



试着记住我手动做的事情。

解决方案

除了删除您创建的数据库之外,还有更多内容;还有所有的服务器主体(用户)。



正如@ CHill60建议的那样,SSMS将是最好的工具,然后你可以删除根据需要。



您可以使用

 SA (系统管理员)未创建的所有数据库的列表SQL>  SELECT  [Name]  FROM  sys.databases 其中 owner_sid<> 0x01 



您也可以通过代码删除数据库

  DROP   DATABASE  [DatabaseName] 



对服务器主体有类似的查询,类似的 DROP 命令



有经验的SQL用户可以使用快速游标并利用执行sp_ExecuteSql 来执行此操作,但我强烈建议不要使用它


Hello,

I recently installed Microsoft SQL Server 2012 Express and I have added some databases which are blank. I would like to delete these custom databases and keep only those that came with the installation (if any).

Does anyone know how to take it back to the original, default settings or which databases within the Database I should delete / keep?

Thanks

What I have tried:

Tried to remember what I did manually.

解决方案

There is more to it than deleting the DBs that you created; there are all of the server principals (users) as well.

As @CHill60 suggested, SSMS would be the best tool to get and then you can delete away on an as needed basis.

You can retrieve a list of all databases not created by SA (System Administrator) by using

SELECT [Name] FROM sys.databases where owner_sid <> 0x01


You can delete a DB via code as well

DROP DATABASE [DatabaseName]


There is a similar query for the server-principals, and a similar DROP command

Experienced SQL Users could right a quick cursor and utilize Execute sp_ExecuteSql to do this, but I would highly recommend against it


这篇关于Sql server 2012 express - 有没有办法将其重置为默认出厂设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆