• Please help support our sponsors by considering their products and services.
    Our sponsors enable us to serve you with this high-speed Internet connection and fast webservers you are currently using at ADSM.ORG.
    They support this free flow of information and knowledge exchange service at no cost to you.

    Please welcome our latest sponsor Tectrade . We can show our appreciation by learning more about Tectrade Solutions
  • Community Tip: Please Give Thanks to Those Sharing Their Knowledge.

    If you receive helpful answer on this forum, please show thanks to the poster by clicking "LIKE" link for the answer that you found helpful.

  • Community Tip: Forum Rules (PLEASE CLICK HERE TO READ BEFORE POSTING)

    Click the link above to access ADSM.ORG Acceptable Use Policy and forum rules which should be observed when using this website. Violators may be banned from this website. This notice will disappear after you have made at least 3 posts.

Select Node From Where Repl_state

TaSMania

ADSM.ORG Member
#1
why is this select statement not working? I want to query for nodes that is NOT enabled.
I can find couple doing Q N * F=D on smaller server under 100 nodes and see replication state: n/a or none

Select node_name from nodes where repl_state='enabled' or 'disabled' or 'none'
is it repl_state or replstate?
I have in my table as REPL_STATE
and per command, we user UPDATE NODE REPLSTATE=enabled
 

moon-buddy

ADSM.ORG Moderator
#2
The right syntax is:

Select node_name from nodes where repl_state='ENABLED' or repl_state='DISABLED' or repl_state='NONE'

If you want to see the replication state as a table entry for all state, in order or ascending by repl_state:

Select node_name,repl_state from nodes where repl_state='ENABLED' or repl_state='DISABLED' or repl_state='NONE' order by repl_state,node_name

Just remember that select statements are case sensitive UNLESS you specify otherwise (as part of the select statement itself).
 

scr1pt

ADSM.ORG Member
#3
The right syntax is:

Select node_name from nodes where repl_state='ENABLED' or repl_state='DISABLED' or repl_state='NONE'

If you want to see the replication state as a table entry for all state, in order or ascending by repl_state:

Select node_name,repl_state from nodes where repl_state='ENABLED' or repl_state='DISABLED' or repl_state='NONE' order by repl_state,node_name

Just remember that select statements are case sensitive UNLESS you specify otherwise (as part of the select statement itself).
Is that select statement not the same as simply saying "SELECT node_name FROM nodes" since you give repl_state all possible values or am I misunderstanding something?

You could run this also if you wanted all upd n lines:
SELECT 'upd n '||node_name||' repls=enabled' FROM nodes WHERE repl_state='DISABLED' or repl_state IS NULL or repl_state='NONE'

Or perhaps cleaner:
SELECT 'upd n '||node_name||' repls=enabled' FROM nodes WHERE repl_state IN ('DISABLED', NULL, 'NONE')
 

moon-buddy

ADSM.ORG Moderator
#4
Is that select statement not the same as simply saying "SELECT node_name FROM nodes" since you give repl_state all possible values or am I misunderstanding something?

You could run this also if you wanted all upd n lines:
SELECT 'upd n '||node_name||' repls=enabled' FROM nodes WHERE repl_state='DISABLED' or repl_state IS NULL or repl_state='NONE'

Or perhaps cleaner:
SELECT 'upd n '||node_name||' repls=enabled' FROM nodes WHERE repl_state IN ('DISABLED', NULL, 'NONE')
The SELECT statement I gave covers all conditions and ordered by repl_state, and is generally a generic select statement. Alternatively, one can list only enabled, disabled, none or NULL by removing appropriate where statements.
 
Last edited:

scr1pt

ADSM.ORG Member
#5
The SELECT statement I gave covers all conditions and ordered by repl_state, and is generally a generic select statement. Alternatively, one can list only enabled, disabled, none or NULL but removing appropriate where statements.
Right, my point was just that it is excessive to have the WHERE statement in this case (if you wanted all records regardless of the value stored in the repl_state column).

Just nitpicking on my part, but; instead of having DB2 examine all repl_state values and seeing if they are equal to any of the valid repl_state values I think it would be better to just fetch records in that case without examining them :)
 

Advertise at ADSM.ORG

If you are reading this, so are your potential customer. Advertise at ADSM.ORG right now.

UpCloud high performance VPS at $5/month

Get started with $25 in credits on Cloud Servers. You must use link below to receive the credit. Use the promo to get upto 5 month of FREE Linux VPS.

The Spectrum Protect TLA (Three-Letter Acronym): ISP or something else?

  • Every product needs a TLA, Let's call it ISP (IBM Spectrum Protect).

    Votes: 12 16.0%
  • Keep using TSM for Spectrum Protect.

    Votes: 48 64.0%
  • Let's be formal and just say Spectrum Protect

    Votes: 9 12.0%
  • Other (please comement)

    Votes: 6 8.0%

Forum statistics

Threads
31,321
Messages
133,392
Members
21,453
Latest member
RRhodes
Top