Hi, we run std 2008 r2. I'm hoping to use the following .bat and .txt files to ask a sql server remotely to run a sql agent job. Bear with me.
.bat:
"\\sqlservername\c$\Program Files\?\osql.exe" -E - sqlservername –i C:\ssis\query\txt.txt
.txt:
USE MSDB
GO
EXEC sp_start_job @job_name = 'sqlagentjobname', @server_name = ' sqlservername'
GO
I took this example from an article whose link i can try to find and post here. Its possible I have some typos as 2nd server name in .bat and extra space before .txt's @server_name param value look funny.
Anyway here is what i have to work with and the actual question:
I'm looking at the sql server itself. I see directories...
c:\program files\microsooft sql server\100\tools\binn...
c:\program files\microsooft sql server\mssql10_50.mssqlserver\mssql\binn...
c:\program files\microsooft sql server_dbserver1\mssql10_50.dbserver1\mssql\binn\...
The only one that contains utility OSQL is the first. But I doubt anything is running from there anymore.
When i look at the running services on this server,
...sql server the service for what i believe is 2008 r2 and definitely for instance dbserver1 seems to be running from the 3rd directory as
sqlserver.exe with a param that looks like -sDBSERVER1
...sql server agent in the unnamed instance (mssqlserver, where my job is) seems to be running from the second directory as sqlagent.exe with a parma that looks like -i mssqlserver
There is also an unnamed instance of sql sever service running from the second directory.
Can i exec OSQL by pointing my .bat at the 1st directory? ...or Do I have to install OSQL? In the 2nd directory? This is a production server and that makes me nervous. From the quick read that I did, it sounds like one would choose "client
tools only" on such an install. I dont know if i will have a choice of specifically installing this util or not.