October 18, 2017 at 8:37 am
Lowell - Wednesday, October 18, 2017 8:17 AMveepee78 - Tuesday, October 17, 2017 12:04 AMI'm quite sure I told that in opening post, though I had changed some names in that:
2017-10-11T16:37:22.5807622Z VERBOSE: 2017-10-11 19:37:20.1067547 SET SINGLE_USER...
2017-10-11T16:37:22.5807622Z VERBOSE: 2017-10-11 19:37:20.4348837 Rename DB...
2017-10-11T16:37:22.6744999Z Invoke-Sqlcmd : Database 'MWA_GO_Devel' is already open and can only have one user at a time.I loose connection in aon11DropAndRestore.sql, after set single user. Rename db will not go through. This happens about 50% of the time.
Lowell: As you can see, this happens inside one script..
I mean all the code must be contained in a single invoke-sql, not a stack of multiple invoke-sql commands, as each invoke is a new connection
If I read it correctly, I believe he is. He provided the whole stack of invoke-sql commands, but I think all of these alters that are failing are occurring in the script invoked by
Invoke-Sqlcmd -ServerInstance $(DBServer) -Database 'master' -Username $(DBUid) -Password $(DBPwd) -inputfile $(Build.SourcesDirectory)\installation\devel\aon11DropAndRestore.sql -QueryTimeout 600 -Verbose -ErrorAction Stop
October 24, 2017 at 4:12 am
Status update, I did add "use mwa_go_devel" command to the beginning of the script and after that it has been working.
October 24, 2017 at 7:59 am
That's interesting. I guess if you're a user in the db context and set single user with rollback, the other users are disconnected and then you have the only connection. As long as you have the database context, you're the only user.
October 24, 2017 at 7:59 am
Also, thanks for the update. Hope it keeps working for you.
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply