db2 CREATE DATABASE XYZ
db2 DROP DATABASE XYZ
这些 db2 命令不支持在 db2cmd/db2clp 上为机器登录用户以外的特定用户执行时指定用户名/密码.因此导致异常
These db2 commands which doesn't provide support to specify username/password while executing on db2cmd/db2clp for a specific user other than machine logged-in user. Hence result a exception
SQL1092N 请求的命令或操作失败,因为用户标识没有执行请求的命令或操作的权限."
"SQL1092N The requested command or operation failed because the user ID does not have the authority to perform the requested command or operation."
当通过选择以不同用户身份运行"来运行相同的命令时,它可以正常工作.
And when the same commands run as by choosing 'Run as different user', it works properly.
在 CLP 中,您可以首先使用所需的任何用户 ID ATTACH
到实例,然后发出 CREATE DATABASE
命令.
From the CLP you can first ATTACH
to the instance using whatever user ID you need, and then issue the CREATE DATABASE
command.
如果实例在您的本地机器上运行,您只需像这样附加:
If the instance is running on your local machine, you just attach like this:
$ db2 attach to db2inst1 user db2inst1
Enter current password for db2inst1:
Instance Attachment Information
Instance server = DB2/LINUXX8664 9.7.5
Authorization ID = DB2INST1
Local instance alias = DB2INST1
如果实例在远程服务器上运行,则附加到您在数据库目录中定义的节点名称":
If the instance is running on a remote server, you attach to the "node name" that you have defined in your database catalog:
$ db2 list db directory
System Database Directory
Number of entries in the directory = 1
Database 1 entry:
Database alias = SAMPLE
Database name = SAMPLE
Node name = SRV01
Database release level = d.00
Comment =
Directory entry type = Remote
Catalog database partition number = -1
Alternate server hostname =
Alternate server port number =
在本例中,list database directory
的输出中显示的节点名称为 SRV01
,因此您可以使用以下命令进行附加:db2 attach to srv01 user <用户名>
.
In this example, the Node Name shown in the output from list database directory
is SRV01
, so you would attach using: db2 attach to srv01 user <username>
.
这篇关于为机器登录用户以外的特定用户运行创建/删除 DB2 数据库命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!