ssj_goemon,
You might need to add an alias through sql server configuration manager.
Could be a networking problem. Open a command prompt and run this:
telnet server.ip.address sqlport
e.g. 192.168.2.235 1433
If the screen goes blank you have network connectivity to the remote server.
Does the account have permissions to connect and/or run jobs on the remote server?
osql -S "remote server" -E -Q"select getdate()"
or:
sqlcmd -S "remote server" -E -Q"select getdate()"
You should get the date.
Create this job on your remote server:
USE [msdb]
GO
/****** Object: Job [getdate] Script Date: 03/13/2013 21:29:04 ******/
BEGIN TRANSACTION
DECLARE @ReturnCode INT
SELECT @ReturnCode = 0
/****** Object: JobCategory [[Uncategorized (Local)]]] Script Date: 03/13/2013 21:29:04 ******/
IF NOT EXISTS (SELECT name FROM msdb.dbo.syscategories WHERE name=N'[Uncategorized (Local)]' AND category_class=1)
BEGIN
EXEC @ReturnCode = msdb.dbo.sp_add_category @class=N'JOB', @type=N'LOCAL', @name=N'[Uncategorized (Local)]'
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
END
DECLARE @jobId BINARY(16)
EXEC @ReturnCode = msdb.dbo.sp_add_job @job_name=N'getdate',
@enabled=1,
@notify_level_eventlog=0,
@notify_level_email=0,
@notify_level_netsend=0,
@notify_level_page=0,
@delete_level=0,
@description=N'No description available.',
@category_name=N'[Uncategorized (Local)]',
@owner_login_name=N'sa', @job_id = @jobId OUTPUT
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
/****** Object: Step [run getdate] Script Date: 03/13/2013 21:29:05 ******/
EXEC @ReturnCode = msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'run getdate',
@step_id=1,
@cmdexec_success_code=0,
@on_success_action=1,
@on_success_step_id=0,
@on_fail_action=2,
@on_fail_step_id=0,
@retry_attempts=0,
@retry_interval=0,
@os_run_priority=0, @subsystem=N'TSQL',
@command=N'select getdate()',
@database_name=N'master',
@flags=4
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_update_job @job_id = @jobId, @start_step_id = 1
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
EXEC @ReturnCode = msdb.dbo.sp_add_jobserver @job_id = @jobId, @server_name = N'(local)'
IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
COMMIT TRANSACTION
GOTO EndSave
QuitWithRollback:
IF (@@TRANCOUNT > 0) ROLLBACK TRANSACTION
EndSave:
GO
Then execute this:
osql -S(remote_server_name) -E -Q"exec msdb.dbo.sp_start_job 'getdate'"
or
osql -S(remote.ip.address) -E -Q"exec msdb.dbo.sp_start_job 'getdate'"
sqlcmd -S(remote) -E -Q"exec msdb.dbo.sp_start_job 'getdate'"
or
Then run this query from the remote server using ssms.
select [jh].[message], [jh].[run_date], [jh].[run_time] from sysjobs j join sysjobhistory jh on [j].[job_id] = [jh].[job_id]
where [j].[name] = 'getdate' and step_name = '(Job outcome)'
The message field should give you the security context. e.g. the account that tried to run the job.
smokey