Rename the db2 database in windows - using db2relocatedb command

partminer
partminer used Ask the Experts™
on
Hi,

Can you please let me know from which (location) we need to keep configuration file while executiing db2relocate command in windows.
Because I am getting  'db2relocatedb must be run under instance db2inst1." .

Can you please let me know how to execute db2relocatedb in windows.
Anyone of you could please advice.Look forward for your response.Thank you.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
can you post here what you are trying to do and what is the error you get?

Author

Commented:
Hi,

I need to rename the databse TESTDB to NEWDB.Db2 is installed on windows.When I try to rename using relocatedb utility, I am gettting the below error.

I am executing  the following command  from H:\programfiles\sqllib\bin directory

db2relocatedb -f db2config.cfg I am getting the below error.

'db2relocatedb must be run under instance db2inst1." .

Can you please help me how to rename my database?thank you
can you post here the content of db2config.cfg ?

Author

Commented:
DB_NAME=TESTDB,NEWDB
DB_PATH=H:
INSTANCE=db2inst1

Author

Commented:
Hi,

Got It, I have INSTANCE as db2inst1.When i execute db2ilist , I got DB2.hence I changed instance name to DB2 from db2inst1.it worked fine.

Thank you for all your help.

Author

Commented:
Dear Momi,

By mistake I have uncatalogued the database and I cannot see the database ,when I try to catalog it is saying 'database not found in the local database directory".I need to recover the uncataloged database.

Can you please help me how to recover the uncatalogued database.Please...

Author

Commented:
Hi anyone,

Can you please let me know how can i restore the database where it was before I ran db2relocatedb command.Please help me.

Author

Commented:
Dear DB2 Gurus,

I have a scenario where I have to rename the databases TESTDB to NEWDB and NEWDB to TESTDB.Could any one of you please advice me how can I do this in db2 installed on windows.

Any help is greatly appreciated.Thank you !
if you only changed the name of the database, make sure you are trying to recatalog the new name, and not the old one.

if you need to swap the names of two databases you can either:
uncatalog both of them and then catalog them again , but switch the aliases, for example

uncatalog db1
uncatalog db2

catalog db1 as db2
catalog db2 as db1

or you can use db2relocatedb2 three times with a temporary name, for example
relocate db1->dbtemp
relocate db2->db1
relocate dbtemp->db2

Author

Commented:
Thank you for your response.It worked great.
so please close the question

Author

Commented:
Hi Admin,

i am not able to close the question, please close the question.
just grant the points to the best answer you recieved

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial