add server name to query

TaSMania

ADSM.ORG Member
Joined
Nov 17, 2015
Messages
126
Reaction score
1
Points
0
PREDATAR Control23

I'm querying multiple servers.
This is what it looks like now
Code:
bkp:select filespaces.node_name,filespaces.filespace_name,filespaces.backup_end,occupancy.physical_mb from filespaces,occupancy,nodes where.........

Would I just add servers.server_name to the beginning after select?


Currently I have:
NODE FILESPACE DATE

I would like for it to show like this:
SERVER NODE FILESPACE DATE.
 
PREDATAR Control23

bkp:select st.server_name,filespaces.node_name,filespaces.filespace_name,filespaces.backup_end,occupancy.physical_mb from filespaces,occupancy,nodes, status st where.........
 
PREDATAR Control23

Thank you. That worked! So what is "st"? I thought it was STATUS but noticed "from status st". I didn't see st in the table but saw status.

bkp:select st.server_name,filespaces.node_name,filespaces.filespace_name,filespaces.backup_end,occupancy.physical_mb from filespaces,occupancy,nodes, status st where.........
 
PREDATAR Control23

Thank you. That worked! So what is "st"? I thought it was STATUS but noticed "from status st". I didn't see st in the table but saw status.
It is a table alias. The table is STATUS, but since I put "status st" I give it an alias of st so instead of status.column I can do st.column.
 
PREDATAR Control23

awesome thanks for the info. I also added to another query. Just for nodes excludes the filespace.
Getting issue when I put
Code:
 where NOT like 'abc%'
nodes with abc still shows up.
Code:
dsmadmc -id=username_admin -pa=password -comma -dataonly=yes -outfile=D:\Reports\orphanednode.csv "SELECT server_name,node_name,TO_CHAR(lastacc_time,'YYYY-MM-DD HH24:MI') as "lastacc_time" FROM nodes,status WHERE node_name not like 'ABC%' and DAYS(current_date)-DAYS(lastacc_time)>30 ORDER BY server_name"
 
PREDATAR Control23

what's the different between:
1. script.bat
c:
cd "c:\program files\tivoli\tsm\baclient"
dsmadmc -id=userID -pa=password -comma -dataonly=yes -outfile=D:\Reports\orphanednode.csv "SELECT server_name,node_name,TO_CHAR(lastacc_time,'YYYY-MM-DD HH24:MI') as "lastacc_time" FROM nodes,status WHERE node_name not like 'VE%' and DAYS(current_date)-DAYS(lastacc_time)>30 ORDER BY server_name"

vs.
2. manual run from dos command line above?

because outputs are different.
 
PREDATAR Control23

awesome thanks for the info. I also added to another query. Just for nodes excludes the filespace.
Getting issue when I put
Code:
 where NOT like 'abc%'
nodes with abc still shows up.
Code:
dsmadmc -id=username_admin -pa=password -comma -dataonly=yes -outfile=D:\Reports\orphanednode.csv "SELECT server_name,node_name,TO_CHAR(lastacc_time,'YYYY-MM-DD HH24:MI') as "lastacc_time" FROM nodes,status WHERE node_name not like 'ABC%' and DAYS(current_date)-DAYS(lastacc_time)>30 ORDER BY server_name"
This query looks fine to me. When I tried it did in fact work.
 
PREDATAR Control23

what's the different between:
1. script.bat
c:
cd "c:\program files\tivoli\tsm\baclient"
dsmadmc -id=userID -pa=password -comma -dataonly=yes -outfile=D:\Reports\orphanednode.csv "SELECT server_name,node_name,TO_CHAR(lastacc_time,'YYYY-MM-DD HH24:MI') as "lastacc_time" FROM nodes,status WHERE node_name not like 'VE%' and DAYS(current_date)-DAYS(lastacc_time)>30 ORDER BY server_name"

vs.
2. manual run from dos command line above?

because outputs are different.
Should be no difference as far as I know. What kind of outputs are you getting and what are you expecting to get?
 
PREDATAR Control23

Should be no difference as far as I know. What kind of outputs are you getting and what are you expecting to get?
Actually it could be character escaping that is needed; I am not very familiar with Windows/Batch scripts but from here http://www.robvanderwoude.com/escapechars.php it suggests that %% could be required to indicate a % so perhaps it is something like this. Hard to say without seeing the difference between the outputs.
 
PREDATAR Control23

There are so many ways to script. I jump from one way to another. I really appreciate your help.
 
Top