系统无法创建数据库,报sql1005n的错误如何解决

创建数据库test时系统报错[db2inst1@sdbf ~]$ db2 create db test using codeset utf-8 territory cnSQL1005N  The database alias "TEST" already exists in either the local database directory or system database directory.使用list database directory...显示全部

创建数据库test时系统报错

[db2inst1@sdbf ~]$ db2 create db test using codeset utf-8 territory cn

SQL1005N  The database alias "TEST" already exists in either the local

database directory or system database directory.

使用list database directory test


[db2inst1@sdbf ~]$ db2 list database directory


System Database Directory


Number of entries in the directory = 2

Database 1 entry:


Database alias
= MACRODB


Database name
= MACRODB


Local database directory
= /home/db2inst1


Database release level
= d.00


Comment
=


Directory entry type
= Indirect


Catalog database partition number
= 0


Alternate server hostname
=


Alternate server port number
=

Database 2 entry:


Database alias
= TEST1


Database name
= TEST1


Local database directory
= /home/db2inst1


Database release level
= d.00


Comment

=


Directory entry type
= Indirect


Catalog database partition number
= 0


Alternate server hostname
=

Alternate server port number
=

使用listdatabase directory on /home/db2inst1命令发现数据库test

目录为本地数据库实例db2inst1所在目录

[db2inst1@sdbf ~]$ db2 "list database directory on /home/db2inst1/"

Local Database Directory on /home/db2inst1/

Number of entries in the directory = 4

Database 1 entry:

Database alias                       = TEST

Database name                        = TEST

Database directory                   = SQL00002

Database release level               = c.00

Comment                              =

Directory entry type                 = Home

Catalog database partition number    = 0

Database partition number            = 0

Database 2 entry:

Database alias                       = MACRODB

Database name                        = MACRODB

Database directory                   = SQL00003

Database release level               = d.00

Comment                              =

Directory entry type                 = Home

Catalog database partition number    = 0

Database partition number            = 0

Database 3 entry:

Database alias                       = TEST1

Database name                        = TEST1

Database directory                   = SQL00004

Database release level               = d.00

Comment                              =

Directory entry type                 = Home

Catalog database partition number    = 0

Database partition number            = 0

解决方法:

使用catalog命令

[db2inst1@sdbf ~]$ db2 catalog db test

DB20000I  The CATALOG DATABASE command completed successfully.

DB21056W  Directory changes may not be effective until the directory cache isrefreshed.

使用listdatabase directory命令查看数据库状态

[db2inst1@sdbf ~]$ db2 list database directory

System Database Directory

Number of entries in the directory = 3

Database 1 entry:

Database alias                       = TEST

Database name                        = TEST

Local database directory             = /home/db2inst1

Database release level               = d.00

Comment                              =

Directory entry type                 = Indirect

Catalog database partition number    = 0

Alternate server hostname            =

Alternate server port number         =

Database 2 entry:

Database alias                       = MACRODB

Database name                        = MACRODB

Local database directory             = /home/db2inst1

Database release level               = d.00

Comment                              =

Directory entry type                 = Indirect

Catalog database partition number    = 0

Alternate server hostname            =

Alternate server port number         =

Database 3 entry:

Database alias                       = TEST1


Database name                        = TEST1

Local database directory             = /home/db2inst1

Database release level               = d.00

Comment                              =

Directory entry type                 = Indirect

Catalog database partition number    = 0

Alternate server hostname            =

Alternate server port number         =

        使用drop命令删除数据库test成功

[db2inst1@sdbf ~]$ db2 drop db test

DB20000I  The DROP DATABASE command completed successfully.

现在可以重建数据库test了

收起
参与3

回答者

stoneberg.d 最近回答过的问题

回答状态

  • 发布时间:2010-07-05
  • 关注会员:1 人
  • 回答浏览:548
  • X社区推广