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 > db2_all $N

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-02-09, 16:56
koganti koganti is offline
Registered User
 
Join Date: Jul 2002
Location: ATL
Posts: 170
db2_all $N

What am i doing wrong

According to documentation $N will be replaced by nodenumber
But i have no luck. Any ideas

db2_all "<<+0< db2 -v "backup db dqa07crd to /db2fs1p $N/backups/dqa07crd compress without prompting""
Reply With Quote
  #2 (permalink)  
Old 11-02-09, 17:06
koganti koganti is offline
Registered User
 
Join Date: Jul 2002
Location: ATL
Posts: 170
Any ideas !!!!

Last edited by koganti; 11-02-09 at 17:10.
Reply With Quote
  #3 (permalink)  
Old 11-02-09, 17:44
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Your use of quotes seems strange. And if you use $N like you do, your shell interprets that as a variable and expands it before DB2 sees the $N at all. How about this:
Code:
db2_all '<<+0< db2 -v "backup db dqa07crd to /db2fs1p $N/backups/dqa07crd compress without prompting"'
With the use of single quotes, you prevent the interpretation of the shell.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #4 (permalink)  
Old 11-02-09, 18:55
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
This is a DPF question for those who don't know.

I have used that syntax successfully in a create tablespace SQL statement, but I did not know it can be used in a DB2 command. Let us know if you get it working.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #5 (permalink)  
Old 11-02-09, 19:11
koganti koganti is offline
Registered User
 
Join Date: Jul 2002
Location: ATL
Posts: 170
Sorry guys even with the single quote it is not working. When evaluated it is evaluated as space

==> db2_all '<<+0< db2 -v "backup db dqa07crd to /db2fs1p $N/backups/dqa07crd compress without prompting"'

backup db dqa07crd to /db2fs1p /backups/dqa07crd compress without prompting
SQL0104N An unexpected token "/backups/dqa07crd" was found following
"<identifier>". Expected tokens may include: "INCLUDE". SQLSTATE=42601

ga016d08b: db2 -v "backup db ... completed rc=4
Reply With Quote
  #6 (permalink)  
Old 11-02-09, 19:47
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by koganti View Post
According to documentation $N will be replaced by nodenumber
Are you sure about that? As far as I know, ## is substituted with the partition number in the context of rah or db2_all.
Reply With Quote
  #7 (permalink)  
Old 11-02-09, 21:37
db2dummy1 db2dummy1 is offline
Registered User
 
Join Date: Feb 2009
Posts: 114
=> db2_all 'echo $DB2NODE'

1
srvr01: echo $DB2NODE completed ok

2
srvr01: echo $DB2NODE completed ok

3
srvr01: echo $DB2NODE completed ok

4
srvr01: echo $DB2NODE completed ok

5
srvr01: echo $DB2NODE completed ok

6
srvr01: echo $DB2NODE completed ok

7
srvr01: echo $DB2NODE completed ok

8
srvr01: echo $DB2NODE completed ok

9
srvr01: echo $DB2NODE completed ok

10
srvr01: echo $DB2NODE completed ok

11
srvr01: echo $DB2NODE completed ok

12
srvr01: echo $DB2NODE completed ok


As for rah, it has nothing to do with partition number, but rather server addresses in sqllib/db2nodes.cfg
Reply With Quote
  #8 (permalink)  
Old 11-02-09, 23:11
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
I think I've only seen " $N" used with create tablespace or set tablespace containers... but you may try the following:

use escape character in front of "$" and single quotes around the path. Something like this:

..... '/db2fs1p \$N/backups/dqa07crd' ....


I can't get db2_all to work at this time so can't test this myself.
Reply With Quote
  #9 (permalink)  
Old 11-03-09, 08:35
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
db2_all is not working for me so I used SSV backup method instead just to see if I can use " $N" in the path.

Here are my results:

test@p6db2serv /home/test/BACKUP > db2 "backup db test on all dbpartitionnums to '/home/test/BACKUP/N \$N'"
Part Result
---- ------------------------------------------------------------------------
0000 DB20000I The BACKUP DATABASE command completed successfully.
0001 DB20000I The BACKUP DATABASE command completed successfully.
0002 DB20000I The BACKUP DATABASE command completed successfully.

Backup successful. The timestamp for this backup image is : 20091103081248


test@p6db2serv /home/test/BACKUP > ls -l *
N0:
total 148144
-rw------- 1 test build 75849728 Nov 03 08:12 TEST.0.test.NODE0000.CATN0000.20091103081248.001

N1:
total 35384
-rw------- 1 test build 18116608 Nov 03 08:12 TEST.0.test.NODE0001.CATN0000.20091103081248.001

N2:
total 35384
-rw------- 1 test build 18116608 Nov 03 08:12 TEST.0.test.NODE0002.CATN0000.20091103081248.001
Reply With Quote
  #10 (permalink)  
Old 11-03-09, 08:52
koganti koganti is offline
Registered User
 
Join Date: Jul 2002
Location: ATL
Posts: 170
Still no luck

==> db2_all '<<+0< db2 -v "backup db sample to '/db2fs1p \$N /backups/dqa07crd' compress without prompting"'

backup db sample to /db2fs1p /backups/dqa07crd compress without prompting
SQL0104N An unexpected token "/backups/dqa07crd" was found following
"<identifier>". Expected tokens may include: "INCLUDE". SQLSTATE=42601

ga016d08b: db2 -v "backup db ... completed rc=4
Reply With Quote
  #11 (permalink)  
Old 11-03-09, 09:09
koganti koganti is offline
Registered User
 
Join Date: Jul 2002
Location: ATL
Posts: 170
I ties this this too. Hoping atleast catalog node will be backedup

db2 "backup db sample to '/db2fs1p \$N/backups/dqa07crd'"
SQL2036N The path for the file or device "/db2fs1p $N/backups/dqa07crd" is
not valid.
Reply With Quote
  #12 (permalink)  
Old 11-03-09, 09:24
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Code:
db2_all '"<<+0< db2 "backup db sample to /db2fs1p##/blah"'
Note the " prefix.
Reply With Quote
  #13 (permalink)  
Old 11-03-09, 09:34
koganti koganti is offline
Registered User
 
Join Date: Jul 2002
Location: ATL
Posts: 170
This seem to work after lots of permutations and combinations

db2_all "\"<<+0< db2 -v \"backup db sample to /db2fs1p##/backups/dqa07crd compress without prompting\""

It still does not make sense why i have to use the so many escape chars
Reply With Quote
  #14 (permalink)  
Old 11-03-09, 09:37
koganti koganti is offline
Registered User
 
Join Date: Jul 2002
Location: ATL
Posts: 170
Nick your combination worked too.
What i dont understand is you started two double quotes but ended only one
Reply With Quote
  #15 (permalink)  
Old 11-05-09, 15:14
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
Quote:
Originally Posted by koganti View Post
What am i doing wrong

According to documentation $N will be replaced by nodenumber
But i have no luck. Any ideas

db2_all "<<+0< db2 -v "backup db dqa07crd to /db2fs1p $N/backups/dqa07crd compress without prompting""
place N in brackets: ${N} , otherwise AIX thinks everything after N is a part of a variable name
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
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