NeelDeveloper
NeelDeveloper

Reputation: 137

Executing a .exe file in SQLplus

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?

Upvotes: 0

Views: 470

Answers (1)

Alex Poole
Alex Poole

Reputation: 191285

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.

Upvotes: 1

Related Questions