Sponsored Content
Top Forums Shell Programming and Scripting Return db2 query value to shell script Post 302867339 by krishmaths on Thursday 24th of October 2013 04:05:47 AM
Old 10-24-2013
You may try this.

Code:
#!/bin/ksh
db_name=db
db_user=usr
db_pwd=pwd

db2 "connect to $db_name user $db_user using $db_pwd"
db2 "select count(1)  from table" > $HOME/count.dat
db2 "connect reset"

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

return DB2 SQLCODE

Hello All, I have 2 shell scripts. script1.sh script2.sh script1.sh call script2.sh script2 will connect to DB2 database and execute a insert statement. I am capturing the return value of insert statement in an variable called SQLCODE. I want to return this SQLCODE to the calling script... (0 Replies)
Discussion started by: kjaisan
0 Replies

2. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies

3. Shell Programming and Scripting

Db2 query with script

Hi All, I want to connect two tables in DB2 using shell script and then compare the contents of two tables field by field.and i should return on the screen the un matched records .. Could any one please help me in connecting database tables using Unix and retriving data from the same. (1 Reply)
Discussion started by: kanakaraju
1 Replies

4. Shell Programming and Scripting

access db2 from shell script

How to connect to db2 through shell script using cygwin? (0 Replies)
Discussion started by: supriyat
0 Replies

5. Shell Programming and Scripting

How to put db2 query result into an array in shell script?

Hello, Can someone please advise me how to put the db2 query reult into an array? For example, the query reults are: string A string B string C Then how do I put them into array=string A array=string B ... (2 Replies)
Discussion started by: hanul
2 Replies

6. Shell Programming and Scripting

connect to db2 using shell script

Guys, I am trying to write a shell script that connect to wcsprod database and read the query #!/bin/ksh sqlplus -s < connect to wcsprod user wcsadm using pwd > select * from catentry fetch first 1 row only with ur; databse: wcsprod user: wcsadm pwd: pwd thanks (1 Reply)
Discussion started by: skatpally
1 Replies

7. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

8. Shell Programming and Scripting

Query the table and return values to shell script and search result values from another files.

Hi, I need a shell script, which would search the result values from another files. 1)execute " select column1 from table_name" query on the table. 2)Based on the result, need to be grep from .wft files. could please explain about this.Below is the way i am using. #!/bin/sh... (4 Replies)
Discussion started by: Rami Reddy
4 Replies

9. Shell Programming and Scripting

Problem in shell script db2 query for fetching and comparing records

hi.. my requirement is following: i want to have a shell script that queries a table i.e. fcm_auth in database fcmcore (I use db2) to get no of rows present for a given combination eg org and logo for past 5-10 mins interval. You can take some values of org(numerical values) and corresponding... (2 Replies)
Discussion started by: nishantrefound
2 Replies

10. Shell Programming and Scripting

Db2 query on other host

Hello, i need some help with a script. I made a script, which connect to different hosts to get some informations. But i got now some problems with getting informations of a database (db2) which is on a other host. I tried something like var=$(rsh HOST su - db2adm -c "db2 connect to database;... (2 Replies)
Discussion started by: Cyver
2 Replies
BOS_GETRESTART(8)					       AFS Command Reference						 BOS_GETRESTART(8)

NAME
       bos_getrestart - Displays the automatic restart times for server processes

SYNOPSIS
       bos getrestart -server <machine name> [-cell <cell name>]
	   [-noauth] [-localauth] [-help]

       bos getr -s <machine name> [-c <cell name>] [-n]
	   [-l] [-h]

DESCRIPTION
       The bos getrestart command displays two restart times from the /etc/openafs/BosConfig file on the server machine named by the -server
       argument:

       o   The general restart time at which the BOS Server process automatically restarts itself and all processes marked with status "Run" in
	   the BosConfig file. The default is Sunday at 4:00 a.m.

       o   The binary restart time at which the BOS Server automatically restarts any process for which the time stamp on the binary file in the
	   /usr/lib/openafs directory is later than the last restart time for the process. The default is 5:00 a.m. Use the bos getdate command to
	   list a binary file's timestamp, and the -long flag to the bos status command to display a process's most recent restart time.

       Use the bos setrestart command to set the restart times.

OPTIONS
       -server <machine name>
	   Indicates the server machine for which to display the restart times. Identify the machine by IP address or its host name (either fully-
	   qualified or abbreviated unambiguously). For details, see bos(8).

       -cell <cell name>
	   Names the cell in which to run the command. Do not combine this argument with the -localauth flag. For more details, see bos(8).

       -noauth
	   Assigns the unprivileged identity "anonymous" to the issuer. Do not combine this flag with the -localauth flag. For more details, see
	   bos(8).

       -localauth
	   Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. The bos command interpreter presents the ticket
	   to the BOS Server during mutual authentication. Do not combine this flag with the -cell or -noauth options. For more details, see
	   bos(8).

       -help
	   Prints the online help for this command. All other valid options are ignored.

OUTPUT
       The output consists of two lines:

	  Server <machine_name> restarts at <time>
	  Server <machine_name> restarts for new binaries at <time>

       Possible values for <time> include:

       o   "never", indicating that the BOS Server never performs that type of restart.

       o   "now", indicating that the BOS Server performs that type of restart only each time it restarts.

       o   A specified day and time, indicating that the BOS Server performs that type of restart once per week. Example: "sun 4:00 am".

       o   A specified time, indicating that the BOS Server performs that type of restart once per day. Examples: "11:00 pm", "3:00 am".

EXAMPLES
       The following example displays the restart times for the machine "db2.abc.com":

	  % bos getrestart db2.abc.com
	  Server db2.abc.com restarts at sun 4:00 am
	  Server db2.abc.com restarts for new binaries at 2:15 am

       In the following example, the issuer abbreviates the machine name "fs1.abc.com" to "fs1", relying on the cell's name server to resolve the
       name. The output echoes the abbreviated form.

	  % bos getrestart fs1
	  Server fs1 restarts at sat 5:00 am
	  Server fs1 restarts for new binaries at 11:30 pm

PRIVILEGE REQUIRED
       None

SEE ALSO
       BosConfig(5), KeyFile(5), bos(8), bos_getdate(8), bos_setrestart(8), bos_status(8)

COPYRIGHT
       IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.

       This documentation is covered by the IBM Public License Version 1.0.  It was converted from HTML to POD by software written by Chas
       Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.

OpenAFS 							    2012-03-26							 BOS_GETRESTART(8)
All times are GMT -4. The time now is 10:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy