Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Call SQL Job after insert on CDC table

Posted on 2014-02-26
6
Medium Priority
?
903 Views
Last Modified: 2016-02-10
Hello Experts!! I am trying to call a SSIS job to process some ETL after I make an insert into
a table.

This table has CDC enabled on it, and I want to basically just trigger the SSIS job after there has been an insert into the table so the job doesn't constantly run without grabbing new data.

Basically I have one server with my database with CDC enabled on it and then my package server running my SSIS jobs.

So far I have been unsuccessful by creating a trigger and then using cmdshell to call my SQL Server job having my SSIS package.

I'm running SQL Server 2012 SP1

Do you guys have any ideas?

Thanks!
0
Comment
Question by:rmm2001
[X]
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
6 Comments
 
LVL 15

Expert Comment

by:tim_cs
ID: 39889187
0
 
LVL 7

Author Comment

by:rmm2001
ID: 39889202
I'm trying to call it via an xp_cmdshell action on the package server. I get this error .. (not sure if it helps):

The EXECUTE permission was denied on the object 'xp_cmdshell', database 'mssqlsystemresource', schema 'sys'.
Failed to insert rows into Change Data Capture change tables. Refer to previous errors in the current session to identify the cause and correct any associated problems.
0
 
LVL 27

Accepted Solution

by:
Zberteoc earned 1000 total points
ID: 39890080
You should never attempt that! A trigger that will do a xp_cmdshell call. Imagine that trigger is fired 10000 times after an insert or update. Better create a job that will execute the SSIS  every minute and check if the table changed and if yes then execute it.

The trigger to call sp_cmdshell is definitely not the way to go.
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
LVL 35

Assisted Solution

by:David Todd
David Todd earned 1000 total points
ID: 39891142
Hi,

One of the great errors in writing triggers is from the point of view of the ui. That is one row gets updated/inserted, and the trigger fires once.

What happens if 100 rows get updated by the dba? The trigger fires once for the update, and if not written correctly will fail.

Now, the insert/update will not complete, that is the signal will not go back to the UI or whatever, until the trigger completes.

So one way to use the trigger, is to insert into a table the rowID of the row inserted/updated, and a timed job inspects that table for rows to process. Way better. That is, if the process will have difficulty deteriming if a row has changed = which could use timestamps, rowlastupdatedatetime, whatever.

HTH
  David
0
 
LVL 7

Author Comment

by:rmm2001
ID: 39900847
60 second delay is not acceptable in this situation. I think i've found an alternative solution that we are going to implement.
0
 
LVL 27

Expert Comment

by:Zberteoc
ID: 39901141
Thanks for the points but just out of curiosity, can you share that solution?
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

705 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