Sometimes its necessary to quickly get rid of the mappings of your nintex databases and this script lets you do that. I use this when a site setup goes south on me and I have to start over. I use a specific naming convention for my datbases so if they aren’t removed before running the setup script again, an error occurs because the DB already exists. So this script is run after the spsite has been removed and the spcontentdatabase has been dismounted from the web application. Not before because that adds some new errors that will need fixing.
/****** You must be absolutely certain that the ID is the correct one or you'll need to restore from backups or manually readd the info you've removed! ******/ use Nintex_Config SELECT * FROM [Storage] order by DatabaseID desc SELECT * FROM [ContentDbMapping] order by NWContentDbId desc SELECT * FROM [Databases] order by DatabaseID desc /* You best be sure this is right. This is the DatabaseID in the Databases table. use Nintex_Config Declare @DBID INT = 269 delete from [Databases] where DatabaseID = @DBID delete from [Storage] where DataBaseID = @DBID delete from [ContentDbMapping] where NWContentDbId = @DBID */
Notice the second set of queries is commented out. The first query is run and the databaseid id retrieved. It should be the top of the resultset. That integer is put pasted into the @DBID in the second query then the second query is highlighted and the entries are removed.
There are more efficient ways to do this but when I’m going under the covers to do things I prefer that the process require more steps and require me to be very very intentional. I run this in both dev and production farms so the extra steps are a good safeguard. The warnings were added in case I’m hit by a bus and someone stumbles across these scripts who may not be all that familiar with these tables.