Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Posts
    1,605

    Answered: "SQL1013N The database alias name or database name could not be found" when drop db

    Hi,
    My system: DB2 10.1 fixpack 1 on Linux

    I tried to list databases:
    db2 list database directory
    and my database "test" is not listed.

    Then I tried listed the databases on our filesystem:
    db2 list database directory on /path_to_db2_dir/
    and database is listed with "SQL00005" directory.

    I can see this directory exists:
    ls /path_to_db2_dir/SQL00005

    When trying to drop database:
    db2 drop database test
    I get error: SQL1013N The database alias name or database name "TEST " could not be found. SQLSTATE=42705

    When trying to uncatalog it:
    db2 uncatalog database test
    I am getting the same error as above.

    When trying to connect to it:
    db2 connect to test
    I am getting the same error as above.

    When trying to catalog it:
    db2 catalog database test
    I am getting error: SQL6028N Catalog database failed because database "test" was not found in the local database directory.


    I just don't need this database "test". I would just like to get rid of it and create a new database with the same name. How?

    P.S. I have searched the web, the closes thing I found is: https://stackoverflow.com/questions/...does-not-exist but this user had vice versa problem. DB was displayed in "db2 list db directory" (in my case it is not) and not displayed when "db2 list db directory /path_to_db2_dir" (in my case it is).

    Thanks
    Last edited by grofaty; 01-12-16 at 05:28.

  2. Best Answer
    Posted by postolar

    "Did you try something like
    db2 catalog database test as test on /path_to_db2_dir/
    then list directory and see if its there ?"


  3. #2
    Join Date
    Sep 2012
    Posts
    11
    Provided Answers: 1
    Did you try something like
    db2 catalog database test as test on /path_to_db2_dir/
    then list directory and see if its there ?

  4. #3
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Hi,

    If your database test is listed in the output with the lines like this:
    Database name = TEST
    Database directory = SQL00005

    of the command:
    db2 list database directory on /path_to_db2_dir

    then you have to have the following directory structure:
    /path_to_db2_dir/${DB2INSTANCE}/NODE0000/SQL00005

    and you can catalog your database with the following command:
    db2 catalog db test on /path_to_db2_dir

    But if you don't have /path_to_db2_dir/${DB2INSTANCE}/NODE0000/SQL00005 directory and have /path_to_db2_dir/SQL00005 only as you said, then this directory structure is incorrect, and
    db2 list database directory on /path_to_db2_dir
    shouldn't list your database.
    Regards,
    Mark.

  5. #4
    Join Date
    Jan 2003
    Posts
    1,605
    @postolar and @mark.b thanks for your, help it was very helpful. As both suggested problem was solved by:
    db2 catalog db test on /path_to_db2_dir

    @mark.b, you are correct, path to db directory is: /path_to_db2_dir/${DB2INSTANCE}/NODE0000/SQL00005
    I have just written simplified version referring /path_do_db2_dir/ as /path_to_db2_dir/${DB2INSTANCE}/NODE0000/
    But you are absolutely right. I should be more careful when explaining facts about a problem.

    P.S. I have marked @postolar answer as "Mark Best Answer", because it is simpler (and if someone else has the same problem, easier to understand). But in this case both of you deserve this title.
    Thanks a lot. Problem solved.

Posting Permissions

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