Solved

Call SQL Job after insert on CDC table

Posted on 2014-02-26
6
869 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 250 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
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.

 
LVL 35

Assisted Solution

by:David Todd
David Todd earned 250 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

617 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