Results 1 to 3 of 3
  1. #1
    Join Date
    May 2002
    Posts
    20

    Unanswered: Scheduling a backup procedure on NT

    Hi there!
    I have a Windows NT box with DB2 UDB 7.2 installed.
    I want to schedule a backup procedure of a database.
    Here are my scripts:
    backupdb.bat
    db2cmd "db2 -tvf d:\backupdb.ctl >> d:\backupdb.log"

    backupdb.ctl
    force applications all;
    backup db <dbname> user <username> using <password> to d:\backupdb2;

    I use the "at" command of Windows, ie.
    at 9:00 cmd /c "d:\backupdb"

    The following error occurs:
    force applications all

    SQL0567N "SYSTEM" is not a valid authorization ID. SQLSTATE=42602



    backup db <dbname user <username> using to d:\backupdb2

    SQL1035N The database is currently in use. SQLSTATE=57019

    How can I overcome this problem?
    Thnx in advance.
    DIMA

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Scheduling a backup procedure on NT

    Check the error code using "db2 ? sql5076n" . In your case the reason seems(just assuming) to be

    'It begins with "SYS", "sys", "IBM", "ibm", "SQL", or "sql". '

    Is there a way in Windows NT scheduling to run this command as a SYSADM/SYSMAINT user id ?

    Cheers

    Sathyaram


    Originally posted by demisco
    Hi there!
    I have a Windows NT box with DB2 UDB 7.2 installed.
    I want to schedule a backup procedure of a database.
    Here are my scripts:
    backupdb.bat
    db2cmd "db2 -tvf d:\backupdb.ctl >> d:\backupdb.log"

    backupdb.ctl
    force applications all;
    backup db <dbname> user <username> using <password> to d:\backupdb2;

    I use the "at" command of Windows, ie.
    at 9:00 cmd /c "d:\backupdb"

    The following error occurs:
    force applications all

    SQL0567N "SYSTEM" is not a valid authorization ID. SQLSTATE=42602



    backup db <dbname user <username> using to d:\backupdb2

    SQL1035N The database is currently in use. SQLSTATE=57019

    How can I overcome this problem?
    Thnx in advance.
    DIMA

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Re: Scheduling a backup procedure on NT

    I wish to add one more point :

    The force application command is asynchronous ie, DB2 does not wait till all the applications are killed before retuning control to the command line.

    Based on the above fact
    and looking into your command file, at the moment the backup command is issued, there may still be applications connected to db2 , in which case your backup will fail .

    I do something like this on Unix.

    Script1 :

    script2 $dbname
    db2 backup database $dbname to /database/backup

    script2:
    while true
    do
    db2 list applications for database $1
    if [ $? -eq 2 ]
    then
    exit
    fi
    db2 list applications for database $1 | tail +5 | nawk '{print $3}' | while read a
    pplid
    do
    if [ "$applid" != "" ]
    then
    db2 "force application($applid)"
    fi
    done
    done

    You might need to do something similar on Windows ...


    HTH

    Cheers

    Sathyaram




    Originally posted by sathyaram_s
    Check the error code using "db2 ? sql5076n" . In your case the reason seems(just assuming) to be

    'It begins with "SYS", "sys", "IBM", "ibm", "SQL", or "sql". '

    Is there a way in Windows NT scheduling to run this command as a SYSADM/SYSMAINT user id ?

    Cheers

    Sathyaram



Posting Permissions

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