Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
328 views
in Technique[技术] by (71.8m points)

Issue Removing DB2 Database

So I screwed up. I was trying to free up some disk space and accidentally deleted logs DB2 needed to connect to/start my database. I'd run into this before, so I uncataloged the database and deleted the files on disk so I could recreate it. However, when I go to recreate the database, I get:

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

db2 list database directory shows that it's gone. Everything else I saw searching around suggests recatalogging and dropping the db, but that's obviously not an option at this stage.

How can I free this alias up for reuse?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I see two possible reasons:

1) The alias already exists in the system database directory but not in the local database directory -

To solve it using DB2 CLI run

db2 uncatalog database BGTRUNK

2) The alias already exists in the local database directory but not in the system database directory.

To solve it using DB2 CLI run

db2 catalog database BGTRUNK

db2 drop database BGTRUNK


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...