i am sure this is a very basic question but I need to create a batch run that I can schedule that disconnects all user from the databases relating to our ERP system.
Article: How to disconnect all self and remote users from a database?
Thank you. I did find this KB but I want to run this in a scheduled background batch run and I cannot seem to get it working. There are 8 databases to disconnect. I will play around a bit more with the code
Hello Meave,
how to do in detail is sometimes different. It will be helpful to know what you are would like to accomplish.
In general there is a simple way:
- Shut down AppServer
- Shud down DB
- Restart DB without AppServer on a _different_ service port and/or with a RO broker as primary broker
(This will empty the cache, that may be negative)
But as I said, this may be the wrong answer, depending on the purpose :)
Klaus
Hi Klaus
Thank you for your reply. If I can explain what I am trying to do - I do not want to shutdown the databases. I just want to log everyone out of an application at 7pm every evening. Once they have been logged out the night shift can log straight back in. It has to be a program running in the Windows scheduler.
Meave
> I just want to log everyone out of an application at 7pm every evening.
Untested:
FOR FIRST DICTDB._Filelist NO-LOCK, FIRST DICTDB._MyConnection NO-LOCK, EACH DICTDB._Connect NO-LOCK WHERE LOOKUP(DICTDB._Connect._Connect-Type, "SELF, REMC") GT 0 AND DICTDB._Connect._Connect-Usr NE DICTDB._MyConnection._MyConn-UserId: ASSIGN vCommand = SUBSTITUTE("&1 &2 -C disconnect &3":U, /* &1 */ SEARCH("proshut.bat"), /* &2 */ DICTDB._Filelist._FileList-Name, /* &3 */ DICTDB._Connect._Connect-Usr) . /* ASSIGN */ OS-COMMAND SILENT VALUE(vCommand). END. /* FOR FIRST _Filelist etc */