Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2012
    Posts
    70

    Unanswered: rename local db directory and remove entry fro a non existing database

    I created two databases (db01 and db02) in the same instance (db2inst1), each with its own local_db_directory

    database db01:
    /db2/db2inst1/data/db01/metalog/db2inst1/NODE0000/sqldbdir/
    sqldbbak
    sqldbdir (only 1 entry: db01)
    sqldbins

    and
    /db2/db2inst1/data/db01/metalog/db2inst1/NODE0000/SQL00001



    database db02:
    /db2/db2inst1/data/db02/metalog/db2inst1/NODE0000/sqldbdir/
    sqldbbak
    sqldbdir (only 1 entry: db2)
    sqldbins

    and
    /db2/db2inst1/data/db02/metalog/db2inst1/NODE0000/SQL00001



    Now (I don't know why...) the two databases have the same local_db_directory:
    /db2/db2inst1/db2inst1/NODE0000/sqldbdir/
    sqldbbak
    sqldbdir (2 entries: db01 and db02)
    sqldbins

    and
    and
    for db01: /db2/db2inst1/data/db01/metalog/db2inst1/NODE0000/SQL00001
    for db02: /db2/db2inst1/data/db02/metalog/db2inst1/NODE0000/SQL00002


    I copied the local db directory of the databases using db2relocatedb to the right location, but the paths for db02 is now:
    /db2/db2inst1/data/db02/metalog/db2inst1/NODE0000/SQL00002


    and the sqldbdir of db01 and db02 are identical with two entries, one for db01 and the second for db02.
    /db2/db2inst1/data/db01/metalog/db2inst1/NODE0000/sqldbdir/sqldbdir
    /db2/db2inst1/data/db02/metalog/db2inst1/NODE0000/sqldbdir/sqldbdir



    How can I:
    1. rename
    /db2/db2inst1/data/db02/metalog/db2inst1/NODE0000/SQL00002
    t0
    /db2/db2inst1/data/db02/metalog/db2inst1/NODE0000/SQL00001



    2. remove from each sqldbdir the entry for the databases I don't need in this file?


    I know that the names are not very important, and the databases are runnign fine, but I want to have a standard layout and now it is no more the case..

    Thanks in advance
    Renaud

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    system db directory is by instance - you can not rename it - otherwise the directory is empty and db has to be cataloged again
    some db go to the local directory : to be able to catalog db on /path

    never touch these files unless you know why and how todo this
    check infocenter for specific operations
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Aug 2012
    Posts
    70
    I don't want to edit the system db directory nor the local db directories. My problem is that two databases had their local db directory in the same location and hence the file sqldbdir/sqldbdir contains 2 entries, one for each of the databases. I move the local db directories of each of the databases to a dedicated location using db2relocatedb, which ran fine. But now in each of local db directories there are still 2 entries in the sqldbdir/sqldbdir. I would like to know what I could do remove each of the unnecessary entries.

    Furthermore the corresponding directories were SQL00001 and SQL00002 on the old shared local db directory. Now that the databases have dedicated local db directory, both databases can have their meta files in SQL00001 (like all other databases in the same instance).

    Is there a possibility with db2relocatedb or uncatalog/catalog, or the only way is a redirected restore. And in this case which options must be choosed?

    thanks a lot
    Best rergards
    Renaud

  4. #4
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    try to uncatalog all db
    see the list db directory
    if empty re-catalog db on /path
    if not empty : continue uncatalog
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  5. #5
    Join Date
    Aug 2012
    Posts
    70
    Thanks a lot. I ran the following steps and it was fine:

    1. uncatalog all databases
    the local db directory of each database was unchanged (for each db01 and db02 there is still 2 entries), but the system db directory was empty.

    2. overwrite the local db directory of the db01 with the system db directory (which is empty)

    3. catalog the db01 on path
    there is now only one entry (the right one) in the local db directory of this database

    4. uncatalog db01
    In order to empty the system db directory

    5. overwrite the local db directory of the db02 with the system db directory (which is empty)

    6. catalog the db02 on path
    there is now only one entry (the right one) in the local db directory of this database

    7. catalog the db01 on path
    there is now only one entry (the right one) in the local db directory of this database

    => now the system db directory contains 2 entries (one for db01 and the other one for db02)
    in the local db directory of db01 there is only one entry
    in the local db directory of db02 there is only one entry


    The last point is how to rename of the directory SQL00002 to SQL00001
    This directory is in the local db directory in the file sqldbins configured. At the moment I have no clue how I can modify the name of this directory with "legal tools" ;-)

    Thanks and best regards
    Renaud

  6. #6
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    you can not change this - this is a number assigned when creating the database
    if you need to change paths - you use redirected restore and specify
    path .... for data paths
    dbpath on ... for the path on which the config files are present and shown with list db directory
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  7. #7
    Join Date
    Aug 2012
    Posts
    70
    this was what I was afraid of...
    Thanks a lot nevertheless, it was very helpful

Posting Permissions

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