I'm having a rather frustrating issue with using an SSIS Flat File source. I am developing an SSIS package on my local machine via VS 2008 and I'm using a flat file source that is stored locally. However, I need to deploy this package to a remote server that hosts our SQLServer and then run it as a scheduled job from that host. However, when I deploy the package, it obviously can't read the flat file source from my machine and fails the job. I have tried putting the file directly on the remote host in the exact same file location (ie. C:\Source.txt) but to no avail. Any ideas on how I can get my deployed SSIS package to read a flat file source?
Hopefully I'm just missing something extremely simple and will ultimately have a "DUH" moment, but if anyone can help I will greatly appreciate it.
If the account under which the SSIS package (for instance the SQL Server Agent service account) is running doesn't have rights to open the file, you will also have problems. So not only does the file need to be on a path that is valid relative to the server running the package, it must also have rights.
Nice answer by Cade.
Remember that you create a SQL Server Job, by default it runs under the credentials of the Service Account assigned to the SQL Server Agent.
If some steps on a Job need some permissions not owned by the Service account you can define a SQL Server Agent Proxy.
That way you can keep the principle of least privileges.
More info on how to create a Proxy here.
Related
I have an SSIS package that creates 2 text files using a data flow component. It connects to an SQL database and if the query returns data, the 2 files are created.
After that, a script task loops through the folder where the 2 files are written into, determines the oldest file and moves it to another folder.
Everything moves smoothly when I execute the package on the server. No errors and all functions are executed. Perfect.
However, when I schedule the SSIS package in a job, the said script task only gets executed when the SQL query (data flow component) returns no results and therefore no files are created. The script then moves the 2nd file from the last run to the other folder.
If the data flow does create 2 new files, the script task does not do anything.
Any ideas how to change this behavior?
Again, this only happens when executed through a job, not when run locally.
Thanks,
Daniel
When SSIS packages are executed from SQL Server they access file system using the SQL Server Service Account NT SERVICE\MSSQL$<Instance Name> (Where <Instance Name> should be replaced by the installed instance name). You have to Grant this account to access the selected directories or run the SQL job using a proxy account:
SQL Server Service account Permissions:
Configure File System Permissions for Database Engine Access
Setting proxy account:
Running a SSIS Package from SQL Server Agent Using a Proxy Account
Create a SQL Server Agent Proxy
The package is running using a proxy account. All the other package are running and saved in the same folder. In this one the file saved in this folder has to move to a different one which saves to differnt application which uses third party dll.
I am calling the library using reflection. But the dll is not registered in sql. Will that be a issue?
I stopped SQL Server (MSSQLSEVER) and SQL Server Agent services and deleted the backup file and data file was located at C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL. Log file is still there:
Now I can't connect to SQL Server
Can not start SQL Server (MSSQLSERVER) and SQL Server Agent services as well
Could you suggest me a solution to connect to my SQL Server instance?
Image of the error message:
I really do not have enough information to diagnose this issue.
However, I have two ideas of what you did.
1 - What you showed me in the picture is the data and log directories. They contain all the system databases by default. See image below.
If you have not done a shift delete of the files and directory, stop the sql server instance and recover them from the recycle bin and restart the sql server instance.
Be VERY careful when deleting directories.
If you do not have these files handy, you might have to re-install SQL Server.
2 - If you data files are in another directory, which I doubt. Then, look in the windows event log and/or sql error log for errors. Please post more details.
J
You're not going to be able to connect to the SQL until the agent service is running again.
I think I need more information about what happens when you try to start the service. Also, I'd probably (if possible) try to restart the machine. Though that probably shouldn't be necessary, dependent on OS you're running it might help.
If you could post what happens when you try to start the service, that might be helpful.
Is the SQL service running? The agent service is not required for connecting to an instance. To regain access to SQL server after deleting required files, read the following msdn article: https://msdn.microsoft.com/en-us/library/dd207004(v=sql.120).aspx
Here is the short version of the problem: I have a discrete DTSX file that works fine on our Production server, but doesn't on our new Dev server.
Symptom: When run from a SQL-Server job, the job starts and nothing at all happens, and it never finishes... it just hangs, using very little system resources.
Some info: For Prod, the packages were developed on SQL-Server 2012 and run on an NT 2008 server. The new Dev server is also SQL-Server 2012, but runs on an NT 2012 server (in case that matters). I have duplicated the folder/file structure exactly, including drive name. The package uses an external dtsConfig file, but as I said - the folder/file structure is identical.
The SSIS service, SQL-Server Agent, and my remote login are all the same, and is a member of the server Administrator group on the Dev box. If I copy the command line text from the SQL job and run it in a CMD window using dtexec.exe, the package executes correctly. The job owner is my login, and the "run as" is the SQL-Agent, which - as I mentioned - is the same login. Since everything in the package uses integrated security, everything should be running using the same login whether on the command line or via the SQL-Agent, which should eliminate any user permission/credentials issues.
I tried adding SSIS logging to the package, logging everything I could. When I run the package from the command line, I get a ton of messages in the log. When I run the package via the SQL job, there are no messages at all in the log - nothing.
Whatever is going on, it's not getting far enough into the SSIS package to generate a single log entry. It's just stopping but not exiting or throwing an error. FWIW - I have the same problem with every other package I've tried.
Any ideas are appreciated...
I found the cause of the problem. The MS-SQL Server service was using a different login than the SSIS server service and the NT Agent service (it was using a local service account).
Once I changed the MS-SQL Server login to match the others (and restarted the service), the job ran correctly.
I have two server. Server A is the application server, and server B is the database server. Normally I use SQL Management Studio in Server A to query. I intend to do a database backup (.bak), but whenever I do this through SQLMS, the file is created at server B. I dont have access to do a remote connection to server B.
How do I get the backup file?
You can specify a UNC path for the target of the backup. Keep in mind, however, that the account that the SQL Server service runs under will need network access to that path. This is one good reason why the SQL installer asks you which account to run the services under.
I ended up using generation script. But instead run all in a single script, I run 3 different script (create table, create stored procedure, and data) at a time. I do this because if I run in a single script, I ended up an error. By the way, the script can be compressed (zip) to give a smaller file size.
I have an SSIS package that queries a view for some records then sends off an email using Database mail. I want to deploy the package to the SQL Server that these views exist in and then schedule us using SQL Server Agent but i've run into a number of issues.
The main problem is that within the job there is a connection manager that has stored credentials for a SQL Server account that has access to the views and email profile. I've set the package to EncryptSensitiveWithPassword instead of User Key but i can't seem to find any way to actually pass that password the the SQL Server Agent when the job is run. So when it executes it fails since it can't connect.
A bunch of websites say to use the config file, but when I go that route it breaks the job entirely complaining that the OLEDB connection can't be established. In that scenario I can't even run the job on my machine locally.
A few other sites recommended copying the package to the local ssis package store on the machine, but I only have access to the machine through SQL Server Tools, I can't remote in or install anything on the file system so I have to install through the manifest file using the SSIS deployment process.
I've read something about storing settings in another DB table, but that again presents issues with permissions on the server.
Finally I tried passing /password or /decrypt in the job scheduler, but when i click ok it scheduler removes that parameter.
This is an internal server and security isnt really a big concern, Any idea how i can pass the decryption password in plaintext or just tell SSIS to not bother securing sensitive data?
The trick is:
When saving the package in SQL Server Business Intelligence Studio, ensure the Package Properties > ProtectionLevel is set to EncryptSensitiveWithUserKey.
When you import the SSIS package into the SQL Server (from SQL Mgmt Studio > object explorer > [server] Integration Services > Stored Packages > MSDB > right-click > Import Package > set Package location to File System, Select the file in Package path, and select the option "Rely on server storage and roles for access control". I would guess when importing the .dtsx file you have to be logged in as the same user that saved the .dtsx file.
This means that the password is saved with the package and therefore can be used when anyone executes the package. If it's something you don't want anyone to execute you then lock down security appropriately.
Alternatively you could change the Connection so it uses Integrated Security (windows authentication instead of a sql login) and change the Job so it executes the package as a user that has access to the database & view that's queried by the package. This is the preferred option from the view that you don't need passwords anywhere and instead manage it via user identity and permissions.
It sounds like when you're using the config file that you're not setting up the config file correctly.
What is the exact error that you're receiving when running it locally? I can try to recreate the issue.
do you have the package set up in bids to store the passwords, and then save the package to ssis and tell it to encrypt the passwords? if you're not saving them locally, it could be that you've lost your passwords and then pushed the package without them.