是否有方法在不卸载的情况下完全重置SQL Server示例?

vfhzx4xs  于 2022-12-17  发布在  SQL Server
关注(0)|答案(3)|浏览(135)

这是使用Microsoft SQL Server 2012。
我有一个有多个版本的程序,每个版本都对底层SQL数据库进行了一些模式更改。在尝试进行一些手动升级时,一些数据库从当前版本中分离或删除,一些备份被还原。在尝试和错误过程中,多个数据库发生了无法遵循的附加/还原/分离/删除混乱。
我们现在尝试从头开始,我们删除了示例中的所有数据库,并尝试重新运行安装程序。数据库创建脚本总是失败。我无法轻松地指出创建脚本的哪个部分失败了,但我的直觉是,它与留在sys表中的某种对象有关。但实际上并不在示例中,因此数据库创建脚本会跳过一些步骤,因为它们认为某些东西存在(它们正在检查sys表以确定是否存在)。
长话短说,我们时间紧迫,并试图找出是否有一种方法,我们可以“工厂重置”现有的SQL示例,或如果我们需要找到一种方法,让SQL安装程序回到系统上,删除现有的示例,并添加一个新的。

vwkv1x7d

vwkv1x7d1#

我认为你将被迫做一个重新安装,你 * 可能 * 运气与修复选项。
如果您将不得不走这条路,重新安装,我一定会删除所有剩余的文件从主数据库和临时数据库只是为了安全起见。
如需了解更多信息:MSDN Uninstall
我还想借此机会评估一下您的备份策略,并为您的SQL Server对象实施源代码控制,如果您目前还没有这样做的话。

zte4gxcn

zte4gxcn2#

如果您有master、model和msdb的副本,并且可以还原它们,则您将拥有所需的内容。您可能不必重新安装二进制文件(如您所述)。如果没有这些备份,您将必须重新安装SQL Server。
https://msdn.microsoft.com/en-us/library/ms190679.aspx

vhipe2zx

vhipe2zx3#

Putting my answer here years later, but it might help somebody else.

!!! Before attempting any of the below, make sure:
!!! -- either make a clone of the VM in question, work from that
!!! -- if no clone possible: backup your databases and its procedures etc. 

As a first option/bet, selecting a System recovery point from 
within Windows might be the way.
(On any Windows you get to work with, check/enable System Recovery as 
the first step!)

A second way might be to have a dedicated 3rd party uninstaller clean 
up MSSQL (and all the other MSSQL programs?) *completely*, 
before doing a reinstall.
If you have an incompleted uninstall like I do (see below), you could
do a reinstall, and remove the new instance with the dedicated 3rd 
party installer.

A third way might be to locate the install directory and wipe that
completely, then clean up the registry with a registry cleaner.

My case (2021, Win10, MSSQL 2019 dev edition):
I messed up my MSSQL by creating a second user with the same name/pass
within MSSQL, but with no rights yet. In effect, I overwrote/reset 
my admin account to have zero rights. Pretty dumb (and MSSQL should
have warned/refused).
Neither a reinstall of MSSQL(,SSMS) MSSQL wipes the user(!?).

相关问题