sql Monitoria Diaria备用SaaS

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql Monitoria Diaria备用SaaS相关的知识,希望对你有一定的参考价值。


/** 
	SUPERPÃO
	- Integração dos arquivos as 20h45
	- Geração dos alertas as 21h
	- Operação remarcação em loja inicia as 22h, se não avisar no grupo

	CANÇÃO
	- Integração dos arquivos as 21h10
	- Carga de preços para o PDV as 22h
	- Geração dos alertas de remarcação as 21h30
	- Geração dos alertas de auditoria as 22h50
	- Operação remarcação em loja inicia as 21h40 e auditoria as 23h, se não avisar no grupo
*/

/********************************************************************************** 
	1) Ajustar horário remarcação SUPER PÃO - fazer até as 20h
	*********************************************************************************/

	-- Observar value
	select Value, * from MRS_InStore_SuperPao.tm.AlertConfigTypeParameter as A
	inner join MRS_InStore_SuperPao.tm.AlertConfig as c on a.AlertConfigId = c.AlertConfigId and name like '%remarc%' and status = 'a'

	--BEGIN TRAN - Update Agendamento Remarcação - SuperPao - Volta Value para dia atual
	/*
	UPDATE MRS_InStore_SuperPao.tm.AlertConfigTypeParameter
	SET Value = '2017-05-31 21:00:00' --correto as 21h
	wHERE AlertConfigId IN (
		SELECT a.AlertConfigId FROM MRS_InStore_SuperPao.tm.AlertConfigTypeParameter AS a
		INNER JOIN MRS_InStore_SuperPao.tm.AlertConfig AS c ON a.AlertConfigId = c.AlertConfigId AND Name LIKE '%Remarc%' AND Status = 'A'
	)
	*/
	--COMMIT OR ROLLBACK
	
/**********************************************************************************
	2) Ajustar horário remarcação e auditoria CANÇÃO
	*********************************************************************************/

	select value, * from MRS_InStore_Cancao.tm.AlertConfigTypeParameter as a
	inner join MRS_InStore_Cancao.tm.AlertConfig as c on a.AlertConfigId = c.AlertConfigId and name like '%Remarc%' and status = 'A'

	select * from MRS_InStore_Cancao.tm.AlertConfigTypeParameter as a
	inner join MRS_InStore_Cancao.tm.AlertConfig as c on a.AlertConfigId = c.AlertConfigId and c.Name like '%Audit%' and c.status = 'A'

	--BEGIN TRAN -- Update Agendamento remarcacao Cancao e Agendamento Auditoria
	/*
	UPDATE MRS_InStore_Cancao.tm.AlertConfigTypeParameter
	SET Value = '2017-05-31 21:30:00' --correto as 21h30
	wHERE AlertConfigId IN (
		SELECT a.AlertConfigId FROM MRS_InStore_Cancao.tm.AlertConfigTypeParameter AS a
		INNER JOIN MRS_InStore_Cancao.tm.AlertConfig AS c ON a.AlertConfigId = c.AlertConfigId AND Name LIKE '%Remarc%' AND Status = 'A'
	)

	UPDATE MRS_InStore_Cancao.tm.AlertConfigTypeParameter
	SET Value = '2017-05-31 22:50:00' --correto as 22h50
	wHERE AlertConfigId IN (
		SELECT a.AlertConfigId FROM MRS_InStore_Cancao.tm.AlertConfigTypeParameter AS a
		INNER JOIN MRS_InStore_Cancao.tm.AlertConfig AS c ON a.AlertConfigId = c.AlertConfigId AND Name LIKE '%Audit%' AND Status = 'A'
	)
	*/
	--COMMIT OR ROLLBACK

/**********************************************************************************
	3) Verificar ra.ItemRetailStore, coluna LastPriceChange
	=====> NÃO PODE TER LastPriceChange COM DATA DO DIA VIGENTE, SE TIVER VOLTAR 1 DIA
	*********************************************************************************/

	select * from MRS_InStore_Cancao.ra.ItemRetailStore with(nolock)
	where LastPriceChange >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) order by LastPriceChange desc
	/*
	-- BEGIN TRAN
		   UPDATE MRS_InStore_Cancao.ra.ItemRetailStore SET LastPriceChange = DATEADD(day, DATEDIFF(day, 0, GETDATE()), -1) WHERE LastPriceChange >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)
	-- ROLLBACK / COMMIT
	*/

	select top 100 * from MRS_InStore_SuperPao.ra.ItemRetailStore with(nolock) 
	where LastPriceChange >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) order by LastPriceChange desc
	/*
	-- BEGIN TRAN
		-- UPDATE MRS_InStore_SuperPao.ra.ItemRetailStore SET LastPriceChange = DATEADD(day, DATEDIFF(day, 0, GETDATE()), -1) WHERE LastPriceChange >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)
	-- ROLLBACK / COMMIT
	*/


/********************************************************************************
	4) Verificar tm.Alert, coluna CreateDate
	=====> NÃO PODE TER CreateDate COM DATA DO DIA VIGENTE, SE TIVER VOLTAR 1 DIA
	********************************************************************************/

	select top 100 * from MRS_InStore_Cancao.tm.Alert with(nolock)
	where CreateDate >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) order by CreateDate desc
	/*
	-- BEGIN TRAN
		-- UPDATE MRS_InStore_Cancao.tm.Alert SET createdate= DATEADD(day, DATEDIFF(day, 0, GETDATE()), -1) WHERE CreateDate >=DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)
	-- ROLLBACK / COMMIT
	*/

	select top 100 * from MRS_InStore_SuperPao.tm.Alert with(nolock)
	where CreateDate >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) order by CreateDate desc
	/*
	-- BEGIN TRAN
		-- UPDATE MRS_InStore_SuperPao.tm.Alert SET createdate= DATEADD(day, DATEDIFF(day, 0, GETDATE()), -1) WHERE CreateDate >=DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)
	-- ROLLBACK / COMMIT
	*/


/** 
	5) Verificar tarefas criadas

	select top 100 * from MRS_InStore_SuperPao.tm.Task with(nolock) where CreateDate > '2017-05-12 00:00:00' and name like '%remar%' order by CreateDate desc

	select top 100 * from MRS_InStore_Cancao.tm.Task with(nolock) where name like '%fechamento%' order by CreateDate desc
	select top 100 * from MRS_InStore_Cancao.tm.Task with(nolock) where CreateDate > '2017-05-11 00:00:00' and name like '%remar%' and retailstoreid='S0057' order by CreateDate desc
*/

/** 
	6) Verificar integração stagings EMPORIUM

	select * from MRS_InStore_Emporium.[intf].[st_in_ean] with(nolock) where CTRL_DATA > DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)
	select * from MRS_InStore_Emporium.[intf].[st_in_gama] with(nolock) where CTRL_DATA > DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)
	select * from MRS_InStore_Emporium.[intf].[st_in_produto] with(nolock) where CTRL_DATA > DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)

	select * from MRS_InStore_Cancao.[intf].[st_in_ean] with(nolock) where CTRL_DATA > DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)
	select retailstoreid, count(1) from MRS_InStore_Cancao.[intf].[st_in_gama] with(nolock) where CTRL_DATA > DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) group by retailstoreid
	select * from MRS_InStore_Cancao.[intf].[st_in_produto] with(nolock) where CTRL_DATA > DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)
	select * from MRS_InStore_Cancao.ra.retailstore where retailstoreid in ('S0057','S0059')
*/

/**
	Se arquivos chegarem atrasados
	1) Esperar os arquivos chegarem (ex: o horário é 20h45 mas chegou apenas as 21h00)
	2) Volta o AlertTypeParameter para a frente do horário que chegaram os arquivos (ex: o alerta roda as 20h55 e preciso voltar para depois das 21h00)
	3) Corro o PriceChange, aguardo o true, e após rodo CreateScheduledTasks
		- Pegar os links na ba.JobSchedule
*/

select top 100 * from MRS_InStore_Cancao.ba.Log with(nolock) order by timestamp desc
select top 100 * from MRS_InStore_Cancao.tm.Alert with(nolock) order by CreateDate desc
select top 100 * from MRS_InStore_Cancao.ba.JobSchedule with(nolock) order by CreateDate desc

select top 20 * from tm.task with(nolock) where actionid=20

以上是关于sql Monitoria Diaria备用SaaS的主要内容,如果未能解决你的问题,请参考以下文章

AWS SAA Review

[ AWS - SAA ] 解决方案架构师之设计弹性架构 - 选择可靠的弹性存储(如何选择 SSD vs. HDD)

[ AWS - SAA ] 解决方案架构师之设计弹性架构 - 选择可靠的弹性存储(如何选择 SSD vs. HDD)

sql 错误码 备用

sql Dataguard应用日志进度(在备用数据库上运行)

如果在 Hive SQL 中找不到匹配项,则提供要加入的备用列