这是使用Microsoft SQL Server 2012。
我有一个包含多个版本的程序,每个版本都对底层SQL数据库进行了一些架构更改。在尝试进行一些手动升级时,分离或删除了当前版本的某些数据库,并恢复了一些备份。在试验和错误期间,多个数据库发生了无法跟踪的附加/恢复/分离/删除混乱。
我们现在尝试从头开始,我们从实例中删除了所有数据库并尝试重新运行安装程序。它一直在数据库创建脚本失败。我无法轻易确定创建脚本的哪个部分失败,但我的预感是,它与某些类型的对象相关,这些对象在sys表中被遗漏,但实际上并不在实例中,因此数据库创建脚本跳过步骤,因为他们认为存在某些东西(他们正在检查sys表以确定是否存在)。说实话,我甚至不确定这是否可行。
长话短说,我们时间紧迫,试图弄清楚我们是否有办法重置"工厂重置"现有的SQL实例,或者我们需要找到一种方法来获取系统上的SQL安装程序并删除现有实例并添加新实例。
答案 0 :(得分:0)
我认为您将被迫重新安装,并且可能运气好修复选项。
如果您将不得不走这条路线,重新安装,我将确保从master和temp数据库中删除所有剩余的剩余文件,以确保安全。
有关详细信息:MSDN Uninstall
如果您当前没有这样的东西,我还会借此机会评估您的备份策略并实施SQL Server对象的源代码控制。
答案 1 :(得分:0)
如果您拥有master,model和msdb的副本,并且可以恢复它们,那么您将拥有所需的一切。您可能不必重新安装二进制文件(对于您正在描述的内容)。如果没有这些备份,您将不得不重新安装SQL Server。
答案 2 :(得分:0)
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(!?).