Windows Connect to DB2

Windows Connect to DB2

 

  

Is there anything special I need to think of for Windows scripting? I
have a WCS instance and a DB2 instance. I'm not a UDB (iSeries is my
flavor) person, but I wrench on it. I do a runstats/reorg/db2rbind
thing every week, where I use db2cmd and db2 -tvf. Do I need to do
anything special to put it into a .cmd file?

Thanks!

> -------- Original Message --------
> Subject: Re: connect to db2 for shell unix.
> From: "hsteiner"
> <db2udbdba-ezmlmshield-x6028813.[Email address protected]
> Date: Tue, November 28, 2006 11:09 am
> To: "LazyDBA Discussion" <[Email address protected]
>
> Here is a simple .sh example:
>
> CODE:
> #! /usr/bin/ksh
> . $HOME/sqllib/db2profile
> db2 "connect to DBNAME";
> date;
> db2 "reorg table SCHEMA.TABLE";
> date;
> echo "reorg complete";
> db2 "terminate";
>
> NOTE: The second line "sources" the db2profile. This might be needed for example if a job is CRON'ed
>
> Here is something a little more sophisticated - it assumes a connection exists:
>
>
> #! /usr/bin/ksh
> . $HOME/sqllib/db2profile
> LOG=/bb/db2/home/mydir/hal/takeover.log
> echo "Hal's Takeover Script starting" >> $LOG;
> date >> $LOG
> status=`db2 activate database DBNAME`;
> echo "Activate database - status $status" >> $LOG;
> date >> $LOG
> status=`db2 takeover hadr on database DBNAME`;
> rc=$?
> echo "takeover status is $status return code is $rc" >> $LOG;
> if [ $rc -ne 0 ]; then
> echo "takeover by force" >> $LOG;
> status=`db2 takeover hadr on database DBNAME by force`;
> echo "Takeover by force issued - status $status" >> $LOG;
> fi
> date >> $LOG
> echo "Hal's Takeover Script complete";
>
> Hope this helps.
>
> Hal Steiner
>
>
>
>
> -----Original Message-----
> From: db2udbdba-ezmlmshield-x8907443.[Email address protected]
> To: [Email address protected]
> Sent: Tue, 28 Nov 2006 9:55 AM
> Subject: RE: connect to db2 for shell unix.
>
>
> Hi gurĂº...
>
> i need example Execution of script (in terminal unix)...please, please, please
>
> Thank's
>
>
> pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.
>
> k=(
>
> Atte.
> Daniel Manque.
> Analista de sistemas.
>
>
>
>
> ---------------------------------------------------------------------
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> To post a dba job: http://jobs.lazydba.com
> To Subscribe : http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
> ________________________________________________________________________
> Check out the new AOL. Most comprehensive set of free safety and security tools, free access to millions of high-quality videos from across the web, free AOL Mail and more.
>
>
> ---------------------------------------------------------------------
> TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
> To post a dba job: http://jobs.lazydba.com
> To Subscribe : http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html


DB2 & UDB email list listserv db2-l LazyDBA home page