Page 1 of 2 12 LastLast
Results 1 to 15 of 23

Thread: db2_all $N

  1. #1
    Join Date
    Jul 2002
    Location
    ATL
    Posts
    170

    Unanswered: 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""

  2. #2
    Join Date
    Jul 2002
    Location
    ATL
    Posts
    170
    Any ideas !!!!
    Last edited by koganti; 11-02-09 at 18:10.

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    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

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

  5. #5
    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

  6. #6
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    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.
    ---
    "It does not work" is not a valid problem statement.

  7. #7
    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

  8. #8
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367
    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.

  9. #9
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,367
    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

  10. #10
    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

  11. #11
    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.

  12. #12
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Code:
    db2_all '"<<+0< db2 "backup db sample to /db2fs1p##/blah"'
    Note the " prefix.
    ---
    "It does not work" is not a valid problem statement.

  13. #13
    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

  14. #14
    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

  15. #15
    Join Date
    Dec 2008
    Location
    Toronto, Canada
    Posts
    399
    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 9.5/9.7 on Unix/AIX 6.1/Linux

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •