SQL 2005 Create JOB to Schedule autorun of SSIS pkg
Ref: http://www.codeproject.com/KB/aspnet/ScheduleRunSSISDTS.aspx
How to Schedule and Run a SSIS package ( DTS ) Job
- The job executor account needs the roles of sysadmin, SQLAgentUserRole, SQLAgentReaderRole, SQLAgentOperatorRole
- The job needs to be run under Proxy account
- The job executor account is better to be used to create SSIS package and so you are sure the job executor account has the right to run this SSIS package.
The following steps can be followed to get the job done.
The work environment is MS SQL Server Management Studio and you log in as sa.
I. Create job executor account
Highlight Security->New Login, say to make login as devlogin, type your password, default database can be your target database.
Server roles: check �sysadmin�
User mapping: your target database
Msdb database: you make sure to include SQLAgentUserRole, SQLAgentReaderRole, SQLAgentOperatorRole
Then click OK
II. Create SQL proxy account and associate proxy account with job executor account
Here is the code and run it the query window.
Use master CREATE CREDENTIAL [MyCredential] WITH IDENTITY = 'yourdomain\myWindowAccount', secret = 'WindowLoginPassword' Use msdb Sp_add_proxy @proxy_name='MyProxy', @credential_name='MyCredential' Sp_grant_login_to_proxy @login_name=' devlogin', @proxy_name='MyProxy' Sp_grant_proxy_to_subsystem @proxy_name='MyProxy', @subsystem_name='SSIS'
III. Create SSIS package
In MS SQL Server Business Intelligence Development Studio, you use job executor account devlogin to create the SSIS package (DTS) and make sure you can execute this package in SQL Server Business Intelligence Development Studio. Compile/build this package.
IV. Create the job, schedule the job and run the job
In SQL Server Management Studio, highlight SQL Server Agent -> Start. Highlight Job ->New Job�, name it , myJob.
Under Steps, New Step, name it, Step1,
Type: SQL Server Integration Service Package
Run as: myProxy
Package source: File System
Browse to select your package file xxx.dtsx
Click Ok
Schedule your job and enable it
Extra Steps:
Use Full Path when defining files (not use Mapped drives) (
TestSvr\Depts\Computing\FTPdata\temp.txt)
In the Control Flow tab – click on the yellow section to bring up the Package Properties
- Set the ProtectionLevel property to EncryptSensitiveWithPassword
- Assign a password to the PackagePassword property (note the password or asterisks will not be displayed in the value box after it has been entered)
- Save this password outside of SQL and SSIS - you will need to reference it later (IMPORTANT!!!!)
- Make sure the package runs – save it In the JOB’s Command Line (Job > Properties > Select Task >Edit > ‘Command Line’ tab), Change: /Decrypt To: /Decrypt “