Results 1 to 11 of 11
  1. #1
    Join Date
    Apr 2004
    Posts
    190

    Unanswered: SQL1391N The database is already in use

    I can't login to a database locally and remotely at the same time. Apparently db2 thinks there is 2 instances on the server, but there is only one. If I login locally and try to login remotely I get the error below and vice versa. I include the db2 log contents also. It looks like the is file sharing issue with the SQLINSLK file, but I don't know how to solve the issue.

    SQL1391N The database is already in use by another instance of the database manager. SQLSTATE=51023

    2004-05-08-14.08.47.966204 Instance:db2fudd Node:000
    PID:69690(db2agent (RECORDS)) Appid:*LOCAL.db2fudd.040508190847
    base_sys_utilities sqle_GetRelDBLockForInstance Probe:25 Database:RECORDS

    /db2fudd/db2fudd/NODE0000/SQL00001/SQLINSLK

    2004-05-08-14.08.47.999171 Instance:db2fudd Node:000
    PID:69690(db2agent (RECORDS)) Appid:*LOCAL.db2fudd.040508190847
    base_sys_utilities sqleFirstConnect Probe:5 Database:RECORDS
    DIA3819C A file sharing violation has occurred, filename was "".

    ZRC=FFFFF616

    2004-05-08-14.08.48.032089 Instance:db2fudd Node:000
    PID:69690(db2agent (RECORDS)) Appid:*LOCAL.db2fudd.040508190847
    base_sys_utilities sqleFirstConnect Probe:6 Database:RECORDS

    DiagData
    2f64 6232 6675 6464 2f64 6232 6675 6464 /db2fudd/db2fudd
    2f4e 4f44 4530 3030 302f 5351 4c30 3030 /NODE0000/SQL000
    3031 2f00 01/.

  2. #2
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    Quote Originally Posted by redwolf
    I can't login to a database locally and remotely at the same time. Apparently db2 thinks there is 2 instances on the server, but there is only one. If I login locally and try to login remotely I get the error below and vice versa. I include the db2 log contents also. It looks like the is file sharing issue with the SQLINSLK file, but I don't know how to solve the issue.

    SQL1391N The database is already in use by another instance of the database manager. SQLSTATE=51023

    2004-05-08-14.08.47.966204 Instance:db2fudd Node:000
    PID:69690(db2agent (RECORDS)) Appid:*LOCAL.db2fudd.040508190847
    base_sys_utilities sqle_GetRelDBLockForInstance Probe:25 Database:RECORDS

    /db2fudd/db2fudd/NODE0000/SQL00001/SQLINSLK

    2004-05-08-14.08.47.999171 Instance:db2fudd Node:000
    PID:69690(db2agent (RECORDS)) Appid:*LOCAL.db2fudd.040508190847
    base_sys_utilities sqleFirstConnect Probe:5 Database:RECORDS
    DIA3819C A file sharing violation has occurred, filename was "".

    ZRC=FFFFF616

    2004-05-08-14.08.48.032089 Instance:db2fudd Node:000
    PID:69690(db2agent (RECORDS)) Appid:*LOCAL.db2fudd.040508190847
    base_sys_utilities sqleFirstConnect Probe:6 Database:RECORDS

    DiagData
    2f64 6232 6675 6464 2f64 6232 6675 6464 /db2fudd/db2fudd
    2f4e 4f44 4530 3030 302f 5351 4c30 3030 /NODE0000/SQL000
    3031 2f00 01/.
    What platform/version? Looks like UNIX.

    Do you have more than one instance on this machine? (Output of db2ilist)

    Also, output of "db2 list database directory" probably will shed some light, is it possible you've cataloged the same database twice using different pathnames (ie. symbolically linked)? It's possible the remote reference and local reference are pointing to two different database paths that are actually the same.
    --
    Jonathan Petruk
    DB2 Database Consultant

  3. #3
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    FYI - I found this one intriguing so I did a test:

    db2 create database test on /home/db2inst1/test
    cd /home/db2inst1
    mv test test-old
    ln -s test-old test
    db2 "catalog database test as test2 on /home/db2inst1/test-old"

    db2 list database directory

    >>>>>>>>>>>>>>>>>>
    System Database Directory

    Number of entries in the directory = 2

    Database 1 entry:

    Database alias = TEST
    Database name = TEST
    Local database directory = /home/db2inst1/test
    Database release level = a.00
    Comment =
    Directory entry type = Indirect
    Catalog database partition number = 0

    Database 2 entry:

    Database alias = TEST2
    Database name = TEST
    Local database directory = /home/db2inst1/test-old
    Database release level = a.00
    Comment =
    Directory entry type = Indirect
    Catalog database partition number = 0
    >>>>>>>>>>>>>>>>>

    From window 1:
    db2 CONNECT TO TEST2

    Database Connection Information

    Database server = DB2/LINUX 8.1.5
    SQL authorization ID = DB2INST1
    Local database alias = TEST2

    From window 2:
    db2 CONNECT TO TEST
    SQL1391N The database is already in use by another instance of the database
    manager. SQLSTATE=51023

    I'm pretty sure this is your issue.
    --
    Jonathan Petruk
    DB2 Database Consultant

  4. #4
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    We just received this error. Noone was able to login to the database.
    There has been nothing done out of the ordinary. I tried to stop the instance using db2stop. It said that there were active databases. I issued a LIST ACTIVE DATABASES command and it said there was none. I shut down and restarted the server. This fixed the problem. I think DB2 just got is some wierd state. We are also on V 8.1.5 Linux - Intel.

    Andy

  5. #5
    Join Date
    Jan 2004
    Location
    Tallahassee, FL, USA
    Posts
    96

    clean hanging threads

    clean hanging threads

    after db2stop , check

    ps -ef | grep instance

    if any kill it

    run ipclean

    also

    check

    ipcs | grep instance


    clean all hangings shared process , or ques

    by
    using

    ipcrm -q queid
    ipcrm -m mprocessid

    then check if , any clean all shared ques, process

    then restart it, db2start

    try this way this may help


    Lekharaju Ennam

  6. #6
    Join Date
    Apr 2004
    Location
    Inside Intel
    Posts
    165

    Unhappy Help!

    We have DB2 8.1.5 on Windows 2000 server

    I tried to restore a database, it gave me this error:

    [IBM][CLI Driver] SQL1391N The database is already in use by
    another instance of the database manager. SQLSTATE=51023

    i tried "list active databases", the particular database was not listed! I tried a db2stop at the instance level, it said

    "SQL1025N The database manager was not stopped because databases are still active."

    Any pointers how to resolve this?

    Thanks in advance,

    Newbie.

  7. #7
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    Quote Originally Posted by dsusendran
    We have DB2 8.1.5 on Windows 2000 server

    I tried to restore a database, it gave me this error:

    [IBM][CLI Driver] SQL1391N The database is already in use by
    another instance of the database manager. SQLSTATE=51023

    i tried "list active databases", the particular database was not listed! I tried a db2stop at the instance level, it said

    "SQL1025N The database manager was not stopped because databases are still active."

    Any pointers how to resolve this?

    Thanks in advance,

    Newbie.
    You said "this particular database was not listed", were any listed? db2stop is at the instance level, so none of the database can be active when you're trying to stop it.
    --
    Jonathan Petruk
    DB2 Database Consultant

  8. #8
    Join Date
    Apr 2004
    Location
    Inside Intel
    Posts
    165

    Question

    I just typed db2stop in the command line and it said there are some databases active.

    I realised that it was not at the instance level. Sorry. I did do a db2stop at the instance level now and it says:
    " [IBM][CLI Driver] SQL30061N The database alias or database name
    "ONGROUP" was not found at the remote node. SQLSTATE=08004 "

    I tried " catalog database ongroup ", it says the database exists!

    SQL1005N The database alias "ongroup" already exists in either the local
    database directory or system database directory.

    Thanks for the prompt reply.

    Newbie

  9. #9
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    Quote Originally Posted by dsusendran
    I just typed db2stop in the command line and it said there are some databases active.

    I realised that it was not at the instance level. Sorry. I did do a db2stop at the instance level now and it says:
    " [IBM][CLI Driver] SQL30061N The database alias or database name
    "ONGROUP" was not found at the remote node. SQLSTATE=08004 "

    I tried " catalog database ongroup ", it says the database exists!

    SQL1005N The database alias "ongroup" already exists in either the local
    database directory or system database directory.

    Thanks for the prompt reply.

    Newbie
    I'm pretty confused now.

    I think you may want to do the following:
    LIST DATABASE DIRECTORY
    LIST DATABASE DIRECTORY ON C:
    (repeat for each drive)

    There are two concepts here, a system-wide database directory (which the first command shows) and a database directory for each path, or in the case of Windows, each drive.

    If the database already exists on the drive where you are trying to restore to, you will need to catalog it and drop it first.

    I'm completely confused as to how you managed to get the SQL1391N error, do you have more than one instance on this box? (db2ilist will tell you that)
    --
    Jonathan Petruk
    DB2 Database Consultant

  10. #10
    Join Date
    Apr 2004
    Location
    Inside Intel
    Posts
    165

    Talking Thanks!

    This is what i got.

    #### LIST DATABASE DIRECTORY ON E:

    Database alias = ONGROUP
    Database name = ONGROUP
    Database directory = SQL00001
    Database release level = a.00
    Comment =
    Directory entry type = Home
    Catalog database partition number = 0
    Database partition number = 0

    #### >db2ilist

    DB2

    and i did

    #### CATALOG DATABASE ONGROUP AS ONGROUP ON E;

    It was successful

    I dropped it and then trying to restore now.

    Any pointers as to how to restore from a backup image. The image is from a different machine though.

    Win 2000 server DB2 8.1.5 connect edition -- image system
    Win 2000 server DB2 8.1.0 connect edition -- Target system

    Also after i am done with this, i got to wipe out the backup image. Does this get erased automatically(in the control center) when i delete those files?

    Thank you very much.

  11. #11
    Join Date
    Mar 2004
    Location
    Toronto, ON, Canada
    Posts
    513
    Command reference has the full RESTORE command syntax... if everything is right and easy in the world, this should do it:
    RESTORE DATABASE <mydb> FROM <path> INTO <newdbname>

    On Windows the path is a bit tricky, you have to point to the directory above the one with \DBNAME.0 if I recall correctly, haven't done a Windows db2 restore in some time.
    --
    Jonathan Petruk
    DB2 Database Consultant

Posting Permissions

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