We have moved to www.dataGenX.net, Keep Learning with us.

Thursday, June 14, 2012

How to change the database name


Hello friends,

       Now we can change the DB name, Instance name with the help of DB2RELOCATEDB tool.
       We can do below things with this tool
      

  • Changing a database name
  • Changing the path/drive that a database was created on
  • Changing one or more table space containers
  • Changing the log path associated with the database
  • Changing the instance associated with a database
  • Copying/moving a database to the same (or different) machine
      This tool can be found at these location on UNix/Windows

        UNIX:     Instance directory/sqllib/bin/db2relocatedb
   Windows:  Installed drive\sqllib\bin\db2relocatedb.exe


Command syntax:
db2relocatedb -f <config_file>

config file format is:


     DB_NAME=oldName,newName
     DB_PATH=oldPath,newPath
     INSTANCE=oldInst,newInst
     NODENUM=nodeNumber
     LOG_DIR=oldDirPath,newDirPath
     CONT_PATH=oldContPath1,newContPath1
     CONT_PATH=oldContPath2,newContPath1
     STORAGE_PATH=oldStoragePath1,newStoragePath1

     ...

Example:

Our environment:
- Database Name: prod1
- Database Path: /home/db2inst1
- Instance: db2inst1

Create a file called: changeDbName with the following format:

DB_NAME=prod1,prod2
DB_PATH=/home/db2inst1
INSTANCE=db2inst1

and execute the command:
db2relocatedb -f changeDbName

After the change our environment will be:
- Database Name: prod2
- Database Path: /home/db2inst1
- Instance: db2inst1

Notes:

*  Database name, database path, and instance name are all required fields. If one of these fields is not changing then it is not
   necessary to list the old and new value for it, just give the old/current one.
*  Blank lines or lines beginning with a comment character (#) will be ignored.


For Further details, go through this link...
The DB2RELOCATEDB tool



 njoy the simplicity.......
©Atul Singh


victimizeit.blogspot.com

No comments :

Post a Comment