0

Is it possible to execute a .exe file from SQLPlus?

In SQL2008 we could run a query like:

exec master..xp_cmdshell 'FILE_PATH\file.exe'

Is there an equivalent query for SQLPlus?

NeelDeveloper
  • 139
  • 1
  • 15

1 Answers1

1

The documentation has a section on running an operating system command:

You can execute an operating system command from the SQL*Plus command prompt. This is useful when you want to perform a task such as listing existing operating system files.

To run an operating system command, enter the SQL*Plus command HOST followed by the operating system command.

So you would do:

SQL> host \FILE_PATH\file.exe

or on Windows:

SQL> $\FILE_PATH\file.exe

But note the warnings; and it's possible your DBA has blocked this ability. Read more about the HOST command.

Alex Poole
  • 183,384
  • 11
  • 179
  • 318