Icon View Thread

The following is the text of the current message along with any replies.
Messages 11 to 16 of 16 total
Thread Clear out other users, I want to Restore a backup
Sun, Jun 29 2014 5:16 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Thanks Roy, Uli and Raul for your input.

I think I have enough in my armoury now to put some useful code together.

Probably won't really know for sure how it works out as in "real life"
restores rarely happen and if they do, it is probably because of unforseen
circumstances - hence hard to test.

Thanks again

Jeff
--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz

Sun, Jun 29 2014 5:33 PMPermanent Link

Barry

"Jeff Cook" wrote:

Someone suggested quite a while ago that if you want exclusive access to your C/S db and shut everyone else out, then just have two EDB servers running. Shut down the public EDB server to prevent users from reconnecting and you use the private EDB server to do the backup. Then when the backup is complete, restart the public EDB server. (Each server of course has their own port# and points to the same database)

Barry
Sun, Jun 29 2014 6:27 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Hi Roy

Not so sure about DISCONNECT SERVER SESSION.

BUT it has lead me to REMOVE SERVER SESSION which does seem to do what I
want.

So tentative plan is:-

Start Restore.
If Error then list the connected users in simple MessageDlg, <Retry> or
<Cancel>
if Retry then REMOVE sessions and try again.

Loop on this until Restore is successful or the user cancels.

I'll leave the messaging bit for now - if I have a problem then I can add
that later. (Eric Reiss would be proud of me)

Cheers

Jeff

--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz

Sun, Jun 29 2014 6:38 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

<Barry> wrote in message
news:648DFB90-5D98-47AB-B5B4-A9E2EC91966C@news.elevatesoft.com...
> "Jeff Cook" wrote:
>
> Someone suggested quite a while ago that if you want exclusive access to
> your C/S db and shut everyone else out, then just have two EDB servers
> running. Shut down the public EDB server to prevent users from
> reconnecting and you use the private EDB server to do the backup. Then
> when the backup is complete, restart the public EDB server. (Each server
> of course has their own port# and points to the same database)
>


Hi Barry

Interesting, but how would you do those steps programmatically?

1. Shut down the public server from a remote client that is connected to it.
2. Start a server on a remote machine

then the reverse, stop one server and start another.

I'm sure someone will be able to tell me a clever way to so it - but I
suspect it will be of the nature of using a sledgehammer to crack a peanut.

Cheers

Jeff

--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz

Mon, Jun 30 2014 12:42 AMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Hi All

To round off this thread, what I needed to so was quite simple really.

Thanks to Roy, Uli, Raul and Barry for your contributions.

I have pasted my code below my sig.  It perhaps needs some error checking to
finish it off - now it is done it seems trivial Wink

Cheers

Jeff

--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz

I created a query that is refreshed on a 10 second timer.

SELECT DISTINCT
 User, LEFT(Process FOR POSITION(':' IN Process) - 1) AS Computer,
 SessionName AS Session, SessionID, Process, Created, LastConnected
FROM Configuration.ServerSessions
LEFT OUTER JOIN Configuration.ServerSessionLocks ON (SessionID = ID)
WHERE DatabaseName = :DataBase
 AND SessionID <> :CurrentRemoteID
 AND Connected = True
ORDER BY User, Process

procedure TUsersForm.FormActivate(Sender: TObject);
begin
 inherited;
 qrySessions.ParamByName('CurrentRemoteID').AsInteger :=
   apmDM.EDBSession.CurrentRemoteID;
 qrySessions.ParamByName('Database').AsString := apmDM.APM.Database;
 Refresh(Self);
end;

procedure TUsersForm.Refresh(Sender: TObject);  // runs on timer every 10
seconds
var
 i: integer;
begin
 Timer.Enabled := False;
 qrySessions.DisableControls;
 try
   if qrySessions.Active then
   begin
     i := qrySessionsSessionID.AsInteger;
     qrySessions.Close;
   end
   else
     i := 0;
   qrySessions.Open;
   if i > 0 then
     qrySessions.Locate('SessionID', i, []);
 finally
   qrySessions.EnableControls;
 end;
 Timer.Enabled := True;
end;



Mon, Jun 30 2014 12:52 AMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

... For some reason my previous post truncated.

I displayed the query in a DBGrid and had a button that does this

procedure TUsersForm.btnDisconnectClick(Sender: TObject);
begin
 apmDM.EDBSession.Execute('REMOVE SERVER SESSION ' + qrySessionsSessionID.AsString);
 Refresh(Self);
end;
« Previous PagePage 2 of 2
Jump to Page:  1 2
Image