Question

I tried creating databases called "mydb1" on two instances: "DB2" and "myinst". It successfully creates on "DB2" but says this error when trying to create on "myinst":

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

Here are the commands I did in order:

db2 get instance --> returns "DB2"

db2 create db mydb1

db2 list database directory --> returns "mydb1"

db2icrt myinst

set db2instance=myinst

db2 get instance --> returns "myinst"

db2start

db2 create db mydb1 --> returns error message shown above

db2 list database directory --> returns "The database directory is empty"

I'm guessing this means that I can't have the same database name in one directory. However, I am following a tutorial from bigdatauniversity.com and they were able to successfully create two databases of the same name on two different instances without any other steps. Why does database creation on "myinst" fail in my case but succeeds in the tutorial demo?

No correct solution

OTHER TIPS

I don't see a db2 terminate command in between changing from 1 instance to the other, so it would appear that the DB2 backend process may be confused about which instance it's supposed to be attached to.

Try executing db2 terminate just before executing set DB2INSTANCE=myinst.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top