Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Run command shell from trigger

Posted on 2004-10-25
Medium Priority
Last Modified: 2006-11-17
Hi, I need to create a trigger that would run a shell command. How can this be done, if possible? I'd need the statement or where to get some detailed documentation. Is this common for all databases? ie Sybase, Oracle, MySQL, SQL... and so on... meaning, is it SQL standard or it depends on the database / Operating system.
Question by:nickoarg
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 14

Accepted Solution

Jan Franek earned 500 total points
ID: 12404014
It surely depends on database system. In Sybase and MS SQL you can use xp_cmdshell extended stored procedure to execute any shell command from sql, so you can use it in trigger as well. I don't know, if it's possible in other database systems.

Author Comment

ID: 12404153
are there limitations on the commands you can execute? obviously depending on the platform, but anything else? do the databeses always support xp_cmdshell by default? or is it an added "library" or so...
LVL 14

Expert Comment

by:Jan Franek
ID: 12404249
Well, speaking of Sybase and MS SQL implementation:

In fact, extended stored procedures are executed by XP server not database server. But XP server is part of usual instalation and it is installed by default, so you don't need anything special to use it.

It runs on all platform that database runs on (MS SQL only on Windows, Sybase ASE on Windows, Linux, Solaris, AIX, HP-UX...).

There are some security related limitations - on Sybase (and probably on MS SQL as well) you can choose, what user context will the shell run in - it can be context of logged in user (there must exist OS user with the same login name) or context of user, that run database server.

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question