db2exfmt 无法打开输出文件

db2exfmt unable to open output file

我正在尝试使用 db2exfmt 创建查询解释表。 我正在使用 db2 CLP 并且我正在执行以下步骤:

  1. 连接到示例
  2. set current explain mode explain
  3. 我的查询=select * from staff where JOB = 'Sales'
  4. db2 设置当前解释模式 no
  5. db2exfmt -d sample -# 0 -w -1 -g -TIC -n % -s % -o output.txt

在最后一步之后,我得到了这个输出:

Connecting to the Database.
Connect to Database Successful.
Unable to open output file.

我不确定为什么无法打开输出文件。我该如何解决这个问题?

您似乎没有 C:\Program Files\IBM\SQLLIB\BIN 目录的写入权限,因此 db2exfmt 无法打开输出文件进行写入。

更改为您具有写入权限的目录,或为 -o 选项指定带路径的文件名。