We have different SSIS package that we use in daily tasks (updates, ETL...) and we have a kind of complicated structure, where a package calls different other packages. And there are primarily about 10 principal jobs that call secondary ones. So these 10 jobs are always on success even if a step fails so it wouldn't block other executions. Although we would like to retrieve the steps (and their status) that are related to these jobs via a SQL Query but we couldn't join between the steps and their calling jobs and at the same time retrieve the status (The step status in this case and not the jobs).
I searched a lot on the net and i always find a script that joins the steps and calling jobs without the status or steps and status without knowing which job is calling...
(for example this link and this one )
so to sum it all up, we are trying to do a Query where we can join the jobs, their Status and their parent job.
Any help in this matter would be really appreciated and thanks in advance.
EDIT
Thanks to the link in #BaconBits comment i was able to create a query joining three tables (msdb.dbo.sysjobsteps, msdb.dbo.sysjobs, msdb.dbo.sysjobhistory) that retrieves something like the following:
Job_name1 Step_name1 Job1_status
Job_name1 Step_name2 Job1_status
Job_name1 Step_name3 Job1_status
Job_name2 Step_name1 Job2_status
Job_name2 Step_name2 Job2_status
But I still couldn't retrieve the step status (which is what i need in this case since the job outcome is always on success even if a step fails)
Query:
select j.name, s.step_name,
CASE WHEN s.last_run_outcome=0 THEN 'Failed'
WHEN s.last_run_outcome=1 THEN 'Success'
WHEN s.last_run_outcome=2 THEN 'Retry'
WHEN s.last_run_outcome=3 THEN 'Canceled'
END
,h.run_date, s.output_file_name
from msdb.dbo.sysjobsteps s
inner join msdb.dbo.sysjobs j on s.job_id=j.job_id
inner join msdb.dbo.sysjobhistory h
on h.job_id=j.job_id or s.step_id=h.step_id
--where j.name like '%Dem%'
order by h.run_date, j.name
Thank you #BaconBits and anyone for any further help.
Related
for example sql-client.sh embedded
insert into wap_fileused_daily(orgId, pdate, platform, platform_count) select u.orgId, u.pdate, coalesce(p.platform,'other'), sum(u.isMessage) as platform_count from users as u left join ua_map_platform as p on u.uaType = p.uatype where u.isMessage = 1 group by u.orgId, u.pdate, p.platform
it will show up as:enter image description here
there will never be any checkpoint.
Question: 1) how to trigger checkpoint ( alert job)
2) how to recover in case of failure
You can specify execution configuration parameters in the SQL Client YAML file. For example, the following should work:
configuration:
execution.checkpointing.interval: 42
There is a feature request on flink:https://cwiki.apache.org/confluence/display/FLINK/FLIP-147%3A+Support+Checkpoints+After+Tasks+Finished
I have a query that has been running for over a week with no issues.
CREATE or REPLACE VIEW VW_AF AS
select f.*
from VW_AFC f
inner join
(
SELECT Forecast, ROUTE_TO_MARKET, FORECASTCURRENCY,LEVEL,IMPORT , MAX(Version) AS maxVersion
FROM VW_AFC
GROUP BY Forecast, ROUTE_TO_MARKET, FORECASTCURRENCY,LEVEL,IMPORT
order by Forecast, ROUTE_TO_MARKET, FORECASTCURRENCY,LEVEL,IMPORT
)x
on x.Forecast = f.Forecast
and x.ROUTE_TO_MARKET = f.ROUTE_TO_MARKET
and x.FORECASTCURRENCY = f.FORECASTCURRENCY
and x.Level = f.level
and x.Import = f.Import
and x.maxversion = f.version;
Today i went to query this view and keep getting errors
--SQL execution internal error: Processing aborted due to error zz:yy; incident xx.--
I have no ideas, I know that for some reason the nested inner query is now failing but cant suss it.
Any experts have advice??
Thxs
According to your comments, I think you already found the correct approach to this error.
Whenever you see "SQL execution internal error" message, you should submit a support ticket to Snowflake. The numbers you see on the error message, can only be interpreted by Snowflake (they point an incident record). Snowflake Support will access to the incident record, see the underlying error message, and provide a workaround or a fix.
I have a list of jobs to run multiple ssis packages. I have a big list, I want to know if it is possible to run a tsql to msdb and get the information of the packages in the steps with the connection strings.
Super old thread but the below code is slightly adapted and much more useful as it shows package level details.
select
prj.name as 'ProjectName'
,pa.name as 'SSISPackageName'
,op.parameter_name as 'ParmaterName'
,op.design_default_value as 'ConnectionString'
from
catalog.object_parameters op
join catalog.projects prj
on op.project_id = prj.project_id
join [catalog].[packages] pa
on pa.project_id = prj.project_id
where op.parameter_name like '%ConnectionString%'
If your packages are stored in the SSISDB Catalog, then you would need to query on SSIDB database to get the actual connection strings. Here is what I would suggest, use the query that Rodrigo A has provided and tweak the column 'Command' further to get the packages name from it by using string functions and have the Step ID and Package Name as output. use the list of packages that you have obtained and put it in the IN clause of the following query and run it against SSISDB -
select prj.name as 'ProjectName'
,op.object_name as 'SSISPackageName'
,op.parameter_name as 'ParmaterName'
,op.design_default_value as 'ConnectionString'
from catalog.object_parameters op
join catalog.projects prj
on op.project_id = prj.project_id
where op.parameter_name like '%ConnectionString%'
and op.object_name in (
--put the package name list here
);
You can then join on the result sets, to get the step Id, PackageName and the connection strings in that package.
Run this query over the server you want to check:
SELECT [sJSTP].[step_id], Name, sJSTP.Command FROM [msdb].[dbo].[sysjobs] [sJOB]
LEFT JOIN [msdb].[dbo].[sysjobsteps] AS [sJSTP]
ON [sJOB].[job_id] = [sJSTP].[job_id]
AND [sJOB].[start_step_id] = [sJSTP].[step_id]
ORDER BY Name, step_id
Cheers!
Does anyone out there know where the information for "Status Update History" in the Approval Center is located in the database? In particular I am looking for the Status Flag (unpublished or published) for a given update. I am trying to build a report off of this information and I am hoping someone has found this flag in the database. I am using Project Server 2013.
Answered Post from Technet by Raushan_kumar
I am still interested in linking the actual hours approved to the query, but so far have been unsuccessful.
Status History related information are available in MSP_ASSIGNMENT_TRANSACTIONS table however Status Flag can be check by comparing WPROJ_LAST_PUB and ASSN_TRANS_SUBMIT_DATE fields.
SQL Query:
SELECT T.ASSN_TRANS_SUBMIT_DATE, P.PROJ_NAME, A.TASK_NAME,
IS_PUBLISHED = CASE WHEN P.WPROJ_LAST_PUB > T.ASSN_TRANS_SUBMIT_DATE THEN 1 ELSE 0 END
FROM PUB.MSP_ASSIGNMENT_TRANSACTIONS T
LEFT OUTER JOIN PUB.MSP_ASSIGNMENTS_SAVED A ON T.ASSN_UID = A.ASSN_UID
LEFT OUTER JOIN PUB.MSP_PROJECTS P ON A.PROJ_UID = P.PROJ_UID
In MYSQL server by looking into the value for "second behind master" it can be known by how much a slave server is lagging behind to its master. So, is there something similar to it in MSSQL so that it can be known how a slave server is lagging behind by its master?
There is some controversy on this subject, but I like to use regularly posted tracer tokens. That is, you call the sp_posttracertoken procedure on the publisher and it will send a, well, token all the way through to the subscriber. You can see the history of all tokens in the distributor database. I wrote the following view to make the data a little easier to grok:
create view [dbo].[tokens] as
select
ps.name as [publisher],
p.publisher_db,
p.publication,
ss.name as [subscriber],
da.subscriber_db,
t.publisher_commit,
t.distributor_commit,
h.subscriber_commit,
datediff(second, t.publisher_commit, t.distributor_commit) as [pub to dist (s)],
datediff(second, t.distributor_commit ,h.subscriber_commit) as [dist to sub (s)],
datediff(second, t.publisher_commit, h.subscriber_commit) as [total latency (s)]
from mstracer_tokens t
inner join MStracer_history h
on t.tracer_id = h.parent_tracer_id
inner join mspublications p
on p.publication_id = t.publication_id
inner join sys.servers ps
on p.publisher_id = ps.server_id
inner join msdistribution_agents da
on h.agent_id = da.id
inner join sys.servers ss
on da.subscriber_id = ss.server_id
Another approach is to use what's commonly called a canary table. The idea is that you have a table specifically to monitor replication that typically only has one row with a datetime field. You update the column at the publisher and then you monitor how far behind the subscriber is by seeing what the value of that column is at the subscriber.
Lastly, there are some perfmon counters that you can look at. In my experience, they're not that great; the number of outstanding commands is an accurate number, but the measurement of latency as a duration is typically very inaccurate.