0

I'm trying to check all counts for all tables in IBM DB2 using Red Hat Linux. When I try to run this DB2 SQL Script

db2 "SELECT 'SELECT COUNT(*) AS ROW_COUNT FROM '|| tabschema || '.' || tabname || ';' FROM sysibmadm.admintabinfo WHERE tabschema not like 'SYS%' order by tabschema, tabname asc" > script

Linux will return

bash: script: Permission denied
Kusalananda
  • 320,670
  • 36
  • 633
  • 936
  • Does there exist a file named `script` already? If so, do you own it (see `ls -l`) – Andy Dalton Mar 09 '21 at 03:08
  • Do you have write permissions to the directory where you are running the command, as that is where the `script` file will be created? – AdminBee Mar 09 '21 at 08:09

1 Answers1

3

You are trying to execute the command in a directory in which you do not have write permission. This means that the file script can not be created or written to.

You can try to run the command replacing the last part, > script, with > ~/script, which will write the output to a file in your home directory, where you are more likely to have write permissions.

Kusalananda
  • 320,670
  • 36
  • 633
  • 936
unxnut
  • 5,908
  • 2
  • 19
  • 27