DB2 Create DB命令结果在SQL1005N数据库目录或系统数据库目录中已存在

时间:2016-03-08 16:04:01

标签: database windows db2

我全新安装了Windows 10和DB2 v10.5 FP 7.

我正在尝试创建一个简单的数据库并不断收到SQL1005N错误。这是一个新安装,因此没有现有的DB:

db2 => list node directory

Node Directory

Number of entries in the directory = 1

Node 1 entry:

Node name                      = DEVWIN10
Comment                        =
Directory entry type           = LOCAL
Protocol                       = TCPIP
Hostname                       = 192.168.1.14
Service name                   = 50000

db2 => list db directory
SQL1057W  The system database directory is empty.  SQLSTATE=01606

db2 => attach to devwin10 user db2admin using <PASSWORD>
Instance Attachment Information

Instance server        = DB2/NT64 10.5.7
Authorization ID       = DB2ADMIN
Local instance alias   = DEVWIN10

db2 => CREATE DATABASE DEMO
SQL1005N  The database alias "DEMO" already exists in either the local database directory or system database directory.

db2 => CREATE DATABASE DEMODB
SQL1005N  The database alias "DEMODB" already exists in either the local database directory or system database directory.

db2 => CREATE DATABASE ANTHONY
SQL1005N  The database alias "ANTHONY" already exists in either the local database directory or system database directory.

db2 => CREATE DATABASE BLAH
SQL1005N  The database alias "BLAH" already exists in either the local database directory or system database directory.

正如您所看到的,我选择的DB名称并不重要,我总是会得到同样的错误。创建数据库:

db2 => list db directory

System Database Directory

Number of entries in the directory = 4

Database 1 entry:

Database alias                       = ANTHONY
Database name                        = ANTHONY
Local database directory             = C:
Database release level               = 10.00
Comment                              =
Directory entry type                 = Indirect
Catalog database partition number    = 0
Alternate server hostname            =
Alternate server port number         =

Database 2 entry:
...
Database 3 entry:
...
Database 4 entry:
...

但我无法连接到它:

db2 => connect to BLAH user db2admin using <PASSWORD>
SQL1035N  The operation failed because the specified database cannot be connected to in the mode requested.  SQLSTATE=57019

db2 => connect to ANTHONY user db2admin using <PASSWORD>
SQL1035N  The operation failed because the specified database cannot be connected to in the mode requested.  SQLSTATE=57019

db2 => connect to DEMO user db2admin using <PASSWORD>
SQL1035N  The operation failed because the specified database cannot be connected to in the mode requested.  SQLSTATE=57019

db2 => connect to DEMODB user db2admin using <PASSWORD>
SQL1035N  The operation failed because the specified database cannot be connected to in the mode requested.  SQLSTATE=57019

有关我失踪的想法吗?

2 个答案:

答案 0 :(得分:1)

显然我需要运行命令:

CREATE DATABASE DEMODB AUTOMATIC STORAGE YES ON 'C:\' DBPATH ON 'C:\' 

这完全创建了DB并允许我连接并使用它。

db2 => CONNECT TO DEMODB USER DB2ADMIN USING <PASSWORD>

Database Connection Information

Database server        = DB2/NT64 10.5.7
SQL authorization ID   = DB2ADMIN
Local database alias   = DEMODB

当然需要开始:

ACTIVATE DATABASE DEMODB

答案 1 :(得分:0)

db2使用“ db2 catalog db SAMPLE on <path>”对数据库进行编目

db2 terminate
db2 drop database SAMPLE

再次运行restore命令。