If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > How to Disable login during End Of Day?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-01-03, 12:26
whmelvin whmelvin is offline
Registered User
 
Join Date: Aug 2003
Location: Atlanta GA, USA
Posts: 9
How to Disable login during End Of Day?

Hello, All,

Is there a way to stop DB2 from accepting connection request? I would like to do this during certain part of an End Of Day process that I am running.

Also, does anyone have a clever way of knocking users off that may have attached in an inopportune time?

Thanks for your help.

BTW, I am running DB2 7.2.8 EE and some clients on 8.x UDB. All installations are Windows.

William
Reply With Quote
  #2 (permalink)  
Old 10-01-03, 14:13
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
William,

To knock off the users:

db2 force applications all

To prevent further connections:

for each group you want to prevent:
REVOKE CONNECT ON DATABASE FOR GROUP myGroup BY ALL

When you are ready to let them connect again:

GRANT CONNECT ON DATABASE TO GROUP myGroup

HTH

Andy
Reply With Quote
  #3 (permalink)  
Old 10-01-03, 14:22
whmelvin whmelvin is offline
Registered User
 
Join Date: Aug 2003
Location: Atlanta GA, USA
Posts: 9
Thanks, Andy. That sounds like that will do it.

Quote:
Originally posted by ARWinner
William,

To knock off the users:

db2 force applications all

To prevent further connections:

for each group you want to prevent:
REVOKE CONNECT ON DATABASE FOR GROUP myGroup BY ALL

When you are ready to let them connect again:

GRANT CONNECT ON DATABASE TO GROUP myGroup

HTH

Andy
Reply With Quote
  #4 (permalink)  
Old 10-01-03, 14:36
dlafreni dlafreni is offline
Registered User
 
Join Date: Jun 2003
Location: Canada
Posts: 35
A way to implement this and make sure that it keep updated (especially in the case you have many GROUP or USER) would be to implement in a script the results of the following sql:

-- For the groups

select 'REVOKE CONNECT ON DATABASE FROM GROUP' || grantee || ';'
from SYSCAT.DBAUTH
where GRANTEETYPE = 'G'
and GRANTEE NOT IN ('<listofgroup>' , ... ); -- not to revoke

select 'GRANT CONNECT ON DATABASE TO GROUP ' || grantee || ';'
from SYSCAT.DBAUTH
where GRANTEETYPE = 'G'
and GRANTEE NOT IN ('<listofgroup>' , ... ); -- not to revoke


-- For the users

select 'REVOKE CONNECT ON DATABASE FROM USER' || grantee || ';'
from SYSCAT.DBAUTH
where GRANTEETYPE = 'U'
and GRANTEE NOT IN ('<listofuser>' , ... ); -- group not to revoke

select 'GRANT CONNECT ON DATABASE TO USER ' || grantee || ';'
from SYSCAT.DBAUTH
where GRANTEETYPE = 'U'
and GRANTEE NOT IN ('<listofuser>' , ... ); -- user not to revoke
Reply With Quote
  #5 (permalink)  
Old 10-01-03, 16:18
whmelvin whmelvin is offline
Registered User
 
Join Date: Aug 2003
Location: Atlanta GA, USA
Posts: 9
Thanks for the information. I will give that a try.

Quote:
Originally posted by dlafreni
A way to implement this and make sure that it keep updated (especially in the case you have many GROUP or USER) would be to implement in a script the results of the following sql:

-- For the groups

select 'REVOKE CONNECT ON DATABASE FROM GROUP' || grantee || ';'
from SYSCAT.DBAUTH
where GRANTEETYPE = 'G'
and GRANTEE NOT IN ('<listofgroup>' , ... ); -- not to revoke

select 'GRANT CONNECT ON DATABASE TO GROUP ' || grantee || ';'
from SYSCAT.DBAUTH
where GRANTEETYPE = 'G'
and GRANTEE NOT IN ('<listofgroup>' , ... ); -- not to revoke


-- For the users

select 'REVOKE CONNECT ON DATABASE FROM USER' || grantee || ';'
from SYSCAT.DBAUTH
where GRANTEETYPE = 'U'
and GRANTEE NOT IN ('<listofuser>' , ... ); -- group not to revoke

select 'GRANT CONNECT ON DATABASE TO USER ' || grantee || ';'
from SYSCAT.DBAUTH
where GRANTEETYPE = 'U'
and GRANTEE NOT IN ('<listofuser>' , ... ); -- user not to revoke
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On