syncro
This commit is contained in:
16
EXPLOIT - backup activepos_read.sql
Normal file
16
EXPLOIT - backup activepos_read.sql
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
EXEC msdb.dbo.sp_start_job @job_name = N'D91030 - Backup ActivePos_Read' , @step_name = 'Purge old ActivePos_Read backups'
|
||||||
|
|
||||||
|
WAITFOR DELAY '00:00:05.000'
|
||||||
|
|
||||||
|
WHILE EXISTS(
|
||||||
|
SELECT sj.name
|
||||||
|
, sja.*
|
||||||
|
FROM msdb.dbo.sysjobactivity AS sja
|
||||||
|
INNER JOIN msdb.dbo.sysjobs AS sj ON sja.job_id = sj.job_id
|
||||||
|
WHERE sj.[name]='D91030 - Backup ActivePos_Read'
|
||||||
|
AND sja.start_execution_date IS NOT NULL
|
||||||
|
AND sja.stop_execution_date IS NULL
|
||||||
|
) BEGIN
|
||||||
|
PRINT 'job is still running '+CONVERT(VARCHAR(20), CURRENT_TIMESTAMP, 120);
|
||||||
|
WAITFOR DELAY '00:00:05.000'
|
||||||
|
END
|
||||||
19
EXPLOIT - broker stats.sql
Normal file
19
EXPLOIT - broker stats.sql
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
SELECT qm.database_id,
|
||||||
|
qm.queue_id,
|
||||||
|
q.[name] AS queue_name,
|
||||||
|
qm.STATE,
|
||||||
|
qm.last_empty_rowset_time,
|
||||||
|
qm.last_activated_time,
|
||||||
|
qm.tasks_waiting
|
||||||
|
FROM sys.dm_broker_queue_monitors qm
|
||||||
|
JOIN sys.[service_queues] q
|
||||||
|
ON q.[object_id] = qm.[queue_id];
|
||||||
|
|
||||||
|
|
||||||
|
SELECT *
|
||||||
|
FROM sys.dm_os_performance_counters
|
||||||
|
WHERE object_name LIKE '%Broker Statistics%'
|
||||||
|
AND [counter_name] IN ( 'Corrupted Messages Total', 'Activation Errors Total', 'Dropped Messages Total',
|
||||||
|
'Enqueued Local Messages Total','Enqueued Transport Msgs Total', 'Forwarded Messages Total'
|
||||||
|
|
||||||
|
);
|
||||||
@@ -16,7 +16,7 @@ Modifications:
|
|||||||
=============================================================================*/
|
=============================================================================*/
|
||||||
|
|
||||||
--If @allJobs is set to 0, then only a subset of jobs are checked (see insert into @jobs)
|
--If @allJobs is set to 0, then only a subset of jobs are checked (see insert into @jobs)
|
||||||
DECLARE @allJobs BIT = 0;
|
DECLARE @allJobs BIT = 01;
|
||||||
DECLARE @jobs TABLE (
|
DECLARE @jobs TABLE (
|
||||||
[name] sysname NOT NULL
|
[name] sysname NOT NULL
|
||||||
,[job_id] UNIQUEIDENTIFIER NOT NULL
|
,[job_id] UNIQUEIDENTIFIER NOT NULL
|
||||||
@@ -83,5 +83,4 @@ SELECT
|
|||||||
JOIN [msdb].[dbo].[sysjobs_view] [j]
|
JOIN [msdb].[dbo].[sysjobs_view] [j]
|
||||||
ON [ja].[job_id] = [j].[job_id]
|
ON [ja].[job_id] = [j].[job_id]
|
||||||
WHERE [ja].[session_id] = (SELECT MAX([session_id])FROM [msdb].[dbo].[sysjobactivity])
|
WHERE [ja].[session_id] = (SELECT MAX([session_id])FROM [msdb].[dbo].[sysjobactivity])
|
||||||
ORDER BY [job_name]
|
ORDER BY [job_status] DESC,[last_run_status];
|
||||||
,[job_status];
|
|
||||||
|
|||||||
39
EXPLOIT - search a proc in all databases.sql
Normal file
39
EXPLOIT - search a proc in all databases.sql
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
USE master
|
||||||
|
|
||||||
|
|
||||||
|
/* declare variables */
|
||||||
|
DECLARE @variable VARCHAR(100)
|
||||||
|
|
||||||
|
DECLARE lookupCrs CURSOR FAST_FORWARD READ_ONLY FOR SELECT name FROM sys.databases d
|
||||||
|
|
||||||
|
OPEN lookupCrs
|
||||||
|
|
||||||
|
FETCH NEXT FROM lookupCrs INTO @variable
|
||||||
|
|
||||||
|
WHILE @@FETCH_STATUS = 0
|
||||||
|
BEGIN
|
||||||
|
DECLARE @q NVARCHAR(MAX) = '
|
||||||
|
use '+@variable+'
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
DB_NAME() AS [db_name],
|
||||||
|
name, object_id, principal_id, schema_id, parent_object_id, type, type_desc, create_date, modify_date, is_ms_shipped, is_published, is_schema_published
|
||||||
|
FROM sys.[objects]
|
||||||
|
WHERE [name] LIKE ''%sp_ReplCustom_Address_ins_C%''
|
||||||
|
AND [type]=''P''
|
||||||
|
;
|
||||||
|
';
|
||||||
|
PRINT @q
|
||||||
|
EXEC [sys].[sp_executesql]
|
||||||
|
@q
|
||||||
|
,N'@db varchar(100)'
|
||||||
|
,@variable
|
||||||
|
;
|
||||||
|
|
||||||
|
FETCH NEXT FROM lookupCrs INTO @variable
|
||||||
|
END
|
||||||
|
|
||||||
|
CLOSE lookupCrs
|
||||||
|
DEALLOCATE lookupCrs
|
||||||
|
|
||||||
|
|
||||||
Binary file not shown.
@@ -15,6 +15,18 @@
|
|||||||
<ConnectionProtocol>NotSpecified</ConnectionProtocol>
|
<ConnectionProtocol>NotSpecified</ConnectionProtocol>
|
||||||
<ApplicationName>Microsoft SQL Server Management Studio - Query</ApplicationName>
|
<ApplicationName>Microsoft SQL Server Management Studio - Query</ApplicationName>
|
||||||
</ConnectionNode>
|
</ConnectionNode>
|
||||||
|
<ConnectionNode Name="swdba01.centralinfra.net\PGALDBA:CENTRALINFRA\ua208700">
|
||||||
|
<Created>2023-02-14T14:36:15.2187218+01:00</Created>
|
||||||
|
<Type>SQL</Type>
|
||||||
|
<Server>swdba01.centralinfra.net\PGALDBA</Server>
|
||||||
|
<UserName />
|
||||||
|
<Authentication>Windows Authentication</Authentication>
|
||||||
|
<InitialDB />
|
||||||
|
<LoginTimeout>30</LoginTimeout>
|
||||||
|
<ExecutionTimeout>0</ExecutionTimeout>
|
||||||
|
<ConnectionProtocol>NotSpecified</ConnectionProtocol>
|
||||||
|
<ApplicationName>Microsoft SQL Server Management Studio - Query</ApplicationName>
|
||||||
|
</ConnectionNode>
|
||||||
</Items>
|
</Items>
|
||||||
</LogicalFolder>
|
</LogicalFolder>
|
||||||
<LogicalFolder Name="Queries" Type="0" Sorted="true">
|
<LogicalFolder Name="Queries" Type="0" Sorted="true">
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
USE Arizona;
|
USE Arizona;
|
||||||
GO
|
GO
|
||||||
|
|
||||||
DELETE FROM upd.IA_IndexesAlignementActions
|
DELETE FROM upd.IA_IndexAlignementActions
|
||||||
WHERE IA_schema_name = 'dbo.Criteria';
|
WHERE IA_schema_name = 'dbo.Criteria';
|
||||||
|
|
||||||
BEGIN TRANSACTION;
|
BEGIN TRANSACTION;
|
||||||
WITH ColInfo
|
WITH ColInfo
|
||||||
AS (SELECT TblName = o.name,
|
AS (SELECT TblName = [o].[name],
|
||||||
SchemaTbl = s.name + '.' + o.name,
|
SchemaTbl = s.name + '.' + [o].[name],
|
||||||
IndexName = i.name,
|
IndexName = [i].[name],
|
||||||
s.name AS schemaName,
|
s.name AS schemaName,
|
||||||
IsPrimaryKey = i.is_primary_key,
|
IsPrimaryKey = i.is_primary_key,
|
||||||
IsUniqueConstraint = i.is_unique_constraint,
|
IsUniqueConstraint = i.is_unique_constraint,
|
||||||
@@ -21,29 +21,29 @@ AS (SELECT TblName = o.name,
|
|||||||
END AS is_clustered,
|
END AS is_clustered,
|
||||||
ColName = c.name,
|
ColName = c.name,
|
||||||
IsComputedCol = c.is_computed,
|
IsComputedCol = c.is_computed,
|
||||||
IsIncludedCol = ic.is_included_column,
|
IsIncludedCol = [ic].is_included_column,
|
||||||
ic.key_ordinal,
|
[ic].key_ordinal,
|
||||||
FilterDefinition = i.filter_definition,
|
FilterDefinition = i.filter_definition,
|
||||||
i.object_id,
|
i.object_id,
|
||||||
i.ignore_dup_key,
|
i.ignore_dup_key,
|
||||||
i.fill_factor,
|
i.fill_factor,
|
||||||
i.is_padded
|
i.is_padded
|
||||||
FROM sys.objects o
|
FROM [sys].objects o
|
||||||
JOIN sys.schemas s
|
JOIN [sys].schemas s
|
||||||
ON o.schema_id = s.schema_id
|
ON o.schema_id = s.schema_id
|
||||||
JOIN sys.columns c
|
JOIN [sys].columns c
|
||||||
ON o.object_id = c.object_id
|
ON o.object_id = c.object_id
|
||||||
JOIN sys.indexes i
|
JOIN [sys].indexes i
|
||||||
ON c.object_id = i.object_id
|
ON c.object_id = i.object_id
|
||||||
JOIN sys.index_columns ic
|
JOIN [sys].index_columns ic
|
||||||
ON i.index_id = ic.index_id
|
ON i.index_id = [ic].index_id
|
||||||
AND o.object_id = ic.object_id
|
AND o.object_id = [ic].object_id
|
||||||
AND c.column_id = ic.column_id
|
AND c.column_id = [ic].column_id
|
||||||
WHERE o.name = 'criteria'
|
WHERE [o].[name] = 'criteria'
|
||||||
AND s.name = 'dbo')
|
AND s.name = 'dbo')
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
'
|
'
|
||||||
INSERT INTO arizona.upd.IA_IndexesAlignementActions
|
INSERT INTO arizona.upd.IA_IndexAlignementActions
|
||||||
(
|
(
|
||||||
IA_executionDate,
|
IA_executionDate,
|
||||||
IA_schema_name,
|
IA_schema_name,
|
||||||
@@ -65,16 +65,17 @@ INSERT INTO arizona.upd.IA_IndexesAlignementActions
|
|||||||
IA_actualColumns,
|
IA_actualColumns,
|
||||||
IA_actualIncludedColumns,
|
IA_actualIncludedColumns,
|
||||||
IA_statusMsg,
|
IA_statusMsg,
|
||||||
IA_index_options
|
IA_index_options,
|
||||||
|
IA_reference
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
NULL as IA_executionDate,
|
NULL as IA_executionDate,
|
||||||
''' + x.schemaName + ''' as IA_schema_name,
|
''' + [x].schemaName + ''' as IA_schema_name,
|
||||||
''' + x.TblName + ''' as IA_table_name,
|
''' + [x].TblName + ''' as IA_table_name,
|
||||||
''' + c.IndexColumns + ''' as IA_columns_name,
|
''' + c.IndexColumns + ''' as IA_columns_name,
|
||||||
0 as IA_is_clustered,
|
0 as IA_is_clustered,
|
||||||
' + CASE
|
' + CASE
|
||||||
WHEN x.IsUnique = 0 THEN
|
WHEN [x].IsUnique = 0 THEN
|
||||||
'0'
|
'0'
|
||||||
ELSE
|
ELSE
|
||||||
'1'
|
'1'
|
||||||
@@ -87,7 +88,7 @@ SELECT
|
|||||||
END + ' as IA_included_columns,
|
END + ' as IA_included_columns,
|
||||||
0 as IA_is_to_be_deleted,
|
0 as IA_is_to_be_deleted,
|
||||||
0 as IA_is_to_be_recreated,
|
0 as IA_is_to_be_recreated,
|
||||||
''' + x.IndexName
|
''' + [x].IndexName
|
||||||
+ ''' as IA_expected_index_name,
|
+ ''' as IA_expected_index_name,
|
||||||
NULL as IA_foundIndexName,
|
NULL as IA_foundIndexName,
|
||||||
0 as IA_wasIndexFound,
|
0 as IA_wasIndexFound,
|
||||||
@@ -100,28 +101,29 @@ SELECT
|
|||||||
NULL as IA_actualIncludedColumns,
|
NULL as IA_actualIncludedColumns,
|
||||||
NULL as IA_statusMsg,
|
NULL as IA_statusMsg,
|
||||||
''' + CASE
|
''' + CASE
|
||||||
WHEN INDEXPROPERTY(x.object_id, x.IndexName, 'IsStatistics') = 1 THEN
|
WHEN INDEXPROPERTY([x].object_id, [x].IndexName, 'IsStatistics') = 1 THEN
|
||||||
'STATISTICS_NORECOMPUTE = ON, '
|
'STATISTICS_NORECOMPUTE = ON, '
|
||||||
ELSE
|
ELSE
|
||||||
'STATISTICS_NORECOMPUTE = OFF, '
|
'STATISTICS_NORECOMPUTE = OFF, '
|
||||||
END + CASE
|
END + CASE
|
||||||
WHEN x.ignore_dup_key = 1 THEN
|
WHEN [x].ignore_dup_key = 1 THEN
|
||||||
'IGNORE_DUP_KEY = ON, '
|
'IGNORE_DUP_KEY = ON, '
|
||||||
ELSE
|
ELSE
|
||||||
'IGNORE_DUP_KEY = OFF, '
|
'IGNORE_DUP_KEY = OFF, '
|
||||||
END + CASE
|
END + CASE
|
||||||
WHEN x.is_padded = 1 THEN
|
WHEN [x].is_padded = 1 THEN
|
||||||
'PAD_INDEX = ON,'
|
'PAD_INDEX = ON,'
|
||||||
ELSE
|
ELSE
|
||||||
''
|
''
|
||||||
END + 'SORT_IN_TEMPDB = OFF, FILLFACTOR =' + CAST(x.fill_factor AS VARCHAR(3))
|
END + 'SORT_IN_TEMPDB = OFF, FILLFACTOR =' + CAST([x].fill_factor AS VARCHAR(3))
|
||||||
+ ''' as IA_index_options
|
+ ''' as IA_index_options,
|
||||||
|
NULL as IA_reference
|
||||||
WHERE NOT EXISTS(
|
WHERE NOT EXISTS(
|
||||||
SELECT 1
|
SELECT 1
|
||||||
FROM arizona.upd.IA_IndexesAlignementActions s
|
FROM arizona.upd.IA_IndexAlignementActions s
|
||||||
WHERE s.IA_executionDate IS NULL
|
WHERE s.IA_executionDate IS NULL
|
||||||
AND s.IA_schema_name = ''' + x.schemaName + '''
|
AND s.IA_schema_name = ''' + [x].schemaName + '''
|
||||||
AND s.IA_table_name = ''' + x.TblName + '''
|
AND s.IA_table_name = ''' + [x].TblName + '''
|
||||||
AND s.IA_columns_name = ''' + c.IndexColumns + '''
|
AND s.IA_columns_name = ''' + c.IndexColumns + '''
|
||||||
' + CASE
|
' + CASE
|
||||||
WHEN ci.IncludedColumns IS NOT NULL THEN
|
WHEN ci.IncludedColumns IS NOT NULL THEN
|
||||||
@@ -131,37 +133,37 @@ WHERE NOT EXISTS(
|
|||||||
END + '
|
END + '
|
||||||
)
|
)
|
||||||
' AS cmd,
|
' AS cmd,
|
||||||
x.IndexName,
|
[x].IndexName,
|
||||||
c.IndexColumns,
|
c.IndexColumns,
|
||||||
ci.IncludedColumns
|
ci.IncludedColumns
|
||||||
FROM ColInfo x
|
FROM ColInfo x
|
||||||
CROSS APPLY
|
CROSS APPLY
|
||||||
(
|
(
|
||||||
SELECT IndexColumns = STUFF(sq.strXML, 1, 2, '')
|
SELECT IndexColumns = STUFF([sq].strXML, 1, 2, '')
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT ', ' + ISNULL(x2.ColName, '')
|
SELECT ', ' + ISNULL([x2].ColName, '')
|
||||||
FROM ColInfo x2
|
FROM ColInfo x2
|
||||||
WHERE x.TblName = x2.TblName
|
WHERE [x].TblName = [x2].TblName
|
||||||
AND x.schemaName = x2.schemaName
|
AND [x].schemaName = [x2].schemaName
|
||||||
AND x.IndexName = x2.IndexName
|
AND [x].IndexName = [x2].IndexName
|
||||||
AND x2.IsIncludedCol = 0
|
AND [x2].IsIncludedCol = 0
|
||||||
ORDER BY x2.key_ordinal
|
ORDER BY [x2].key_ordinal
|
||||||
FOR XML PATH('')
|
FOR XML PATH('')
|
||||||
) sq(strXML)
|
) sq(strXML)
|
||||||
) c
|
) c
|
||||||
OUTER APPLY
|
OUTER APPLY
|
||||||
(
|
(
|
||||||
SELECT IncludedColumns = STUFF(sq.strXML, 1, 2, '')
|
SELECT IncludedColumns = STUFF([sq].strXML, 1, 2, '')
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT ', ' + ISNULL(x2.ColName, '')
|
SELECT ', ' + ISNULL([x2].ColName, '')
|
||||||
FROM ColInfo x2
|
FROM ColInfo x2
|
||||||
WHERE x.TblName = x2.TblName
|
WHERE [x].TblName = [x2].TblName
|
||||||
AND x.schemaName = x2.schemaName
|
AND [x].schemaName = [x2].schemaName
|
||||||
AND x.IndexName = x2.IndexName
|
AND [x].IndexName = [x2].IndexName
|
||||||
AND x2.IsIncludedCol = 1
|
AND [x2].IsIncludedCol = 1
|
||||||
ORDER BY x2.key_ordinal
|
ORDER BY [x2].key_ordinal
|
||||||
FOR XML PATH('')
|
FOR XML PATH('')
|
||||||
) sq(strXML)
|
) sq(strXML)
|
||||||
) ci;
|
) ci;
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
USE Arizona;
|
|
||||||
GO
|
|
||||||
IF OBJECT_ID('upd.alignIndexes') IS NOT NULL
|
IF OBJECT_ID('upd.alignIndexes') IS NOT NULL
|
||||||
DROP PROCEDURE [upd].alignIndexes;
|
DROP PROCEDURE [upd].alignIndexes;
|
||||||
GO
|
GO
|
||||||
@@ -61,7 +59,7 @@ BEGIN
|
|||||||
DECLARE @tableName VARCHAR(100); /* used in cursor */
|
DECLARE @tableName VARCHAR(100); /* used in cursor */
|
||||||
DECLARE @indexFK INT; /* used in cursor */
|
DECLARE @indexFK INT; /* used in cursor */
|
||||||
DECLARE @msg VARCHAR(MAX) = '';
|
DECLARE @msg VARCHAR(MAX) = '';
|
||||||
DECLARE @indexesToMaintains TABLE
|
DECLARE @indexesToMaintains TABLE /* working representation of upd.IA_IndexesAlignementActions */
|
||||||
(
|
(
|
||||||
[IA_indexesAlignementActions] INT NULL, /* FK to table upd.IA_IndexesAlignementActions */
|
[IA_indexesAlignementActions] INT NULL, /* FK to table upd.IA_IndexesAlignementActions */
|
||||||
[SchemaName] VARCHAR(100) NOT NULL, /* the schema the table is part of */
|
[SchemaName] VARCHAR(100) NOT NULL, /* the schema the table is part of */
|
||||||
@@ -104,26 +102,26 @@ BEGIN
|
|||||||
[IA_indexesAlignementActions],
|
[IA_indexesAlignementActions],
|
||||||
[SchemaName],
|
[SchemaName],
|
||||||
[TableName],
|
[TableName],
|
||||||
expectedIndexName_inp,
|
[expectedIndexName_inp],
|
||||||
columnsName_inp,
|
[columnsName_inp],
|
||||||
includedColumns_inp,
|
[includedColumns_inp],
|
||||||
isClustered_inp,
|
[isClustered_inp],
|
||||||
isUnique_inp,
|
[isUnique_inp],
|
||||||
isToBeDeleted_inp,
|
[isToBeDeleted_inp],
|
||||||
isToBeRecreated_inp,
|
[isToBeRecreated_inp],
|
||||||
IA_index_options
|
[IA_index_options]
|
||||||
)
|
)
|
||||||
SELECT ia.[IA_indexesAlignementActions_id],
|
SELECT ia.[IA_indexesAlignementActionsID],
|
||||||
ia.[IA_schema_name],
|
ia.[IA_schemaName],
|
||||||
ia.[IA_table_name],
|
ia.[IA_tableName],
|
||||||
ia.[IA_expected_index_name],
|
ia.[IA_expectedIndexName],
|
||||||
ia.[IA_columns_name],
|
ia.[IA_columnsName],
|
||||||
ia.[IA_included_columns],
|
ia.[IA_includedColumns],
|
||||||
ia.[IA_is_clustered],
|
ia.[IA_isClustered],
|
||||||
ia.[IA_is_unique],
|
ia.[IA_isUnique],
|
||||||
ia.[IA_is_to_be_deleted],
|
ia.[IA_isToBeDeleted],
|
||||||
ia.[IA_is_to_be_recreated],
|
ia.[IA_isToBeRecreated],
|
||||||
ia.IA_index_options
|
ia.[IA_indexOptions]
|
||||||
FROM [upd].[IA_IndexesAlignementActions] ia
|
FROM [upd].[IA_IndexesAlignementActions] ia
|
||||||
WHERE ia.[IA_executionDate] IS NULL;
|
WHERE ia.[IA_executionDate] IS NULL;
|
||||||
|
|
||||||
@@ -131,44 +129,44 @@ BEGIN
|
|||||||
/* logic checks on index definition table */
|
/* logic checks on index definition table */
|
||||||
SELECT @msg
|
SELECT @msg
|
||||||
= @msg + 'Duplicate index (on expected index name) found in indexes definition. Table ['
|
= @msg + 'Duplicate index (on expected index name) found in indexes definition. Table ['
|
||||||
+ [itm].[IA_schema_name] + '].[' + [itm].[IA_table_name] + '], expected index name ['
|
+ [itm].[IA_schemaName] + '].[' + [itm].[IA_tableName] + '], expected index name ['
|
||||||
+ [itm].[IA_expected_index_name] + ']' + CHAR(13) + CHAR(10)
|
+ [itm].[IA_expectedIndexName] + ']' + CHAR(13) + CHAR(10)
|
||||||
FROM [upd].[IA_IndexesAlignementActions] [itm]
|
FROM [upd].[IA_IndexesAlignementActions] [itm]
|
||||||
JOIN
|
JOIN
|
||||||
(
|
(
|
||||||
SELECT [ii].[IA_expected_index_name] AS [key]
|
SELECT [ii].[IA_expectedIndexName] AS [key]
|
||||||
FROM [upd].[IA_IndexesAlignementActions] [ii]
|
FROM [upd].[IA_IndexesAlignementActions] [ii]
|
||||||
GROUP BY [ii].[IA_expected_index_name]
|
GROUP BY [ii].[IA_expectedIndexName]
|
||||||
HAVING COUNT(1) > 1
|
HAVING COUNT(1) > 1
|
||||||
) d
|
) d
|
||||||
ON d.[key] = [itm].[IA_expected_index_name]
|
ON d.[key] = [itm].[IA_expectedIndexName]
|
||||||
GROUP BY [itm].[IA_schema_name],
|
GROUP BY [itm].[IA_schemaName],
|
||||||
[itm].[IA_table_name],
|
[itm].[IA_tableName],
|
||||||
[itm].[IA_expected_index_name];
|
[itm].[IA_expectedIndexName];
|
||||||
|
|
||||||
--duplicate index key
|
--duplicate index key
|
||||||
SELECT @msg
|
SELECT @msg
|
||||||
= @msg + 'Duplicate index (on column definition) found in indexes definition. Table [' + [itm].[IA_schema_name]
|
= @msg + 'Duplicate index (on column definition) found in indexes definition. Table [' + [itm].[IA_schemaName]
|
||||||
+ '].[' + [itm].[IA_table_name] + '], columns in index: ' + [itm].[IA_columns_name]
|
+ '].[' + [itm].[IA_tableName] + '], columns in index: ' + [itm].[IA_columnsName]
|
||||||
+ CASE
|
+ CASE
|
||||||
WHEN [itm].[IA_included_columns] IS NOT NULL THEN
|
WHEN [itm].[IA_includedColumns] IS NOT NULL THEN
|
||||||
', included colum(s): ' + [itm].[IA_included_columns]
|
', included colum(s): ' + [itm].[IA_includedColumns]
|
||||||
ELSE
|
ELSE
|
||||||
''
|
''
|
||||||
END + CHAR(13) + CHAR(10)
|
END + CHAR(13) + CHAR(10)
|
||||||
FROM [upd].[IA_IndexesAlignementActions] [itm]
|
FROM [upd].[IA_IndexesAlignementActions] [itm]
|
||||||
JOIN
|
JOIN
|
||||||
(
|
(
|
||||||
SELECT [ii].[IA_columns_name] + '_' + ISNULL([ii].[IA_included_columns], '') AS [key]
|
SELECT [ii].[IA_columnsName] + '_' + ISNULL([ii].[IA_includedColumns], '') AS [key]
|
||||||
FROM [upd].[IA_IndexesAlignementActions] [ii]
|
FROM [upd].[IA_IndexesAlignementActions] [ii]
|
||||||
GROUP BY [ii].[IA_columns_name] + '_' + ISNULL([ii].[IA_included_columns], '')
|
GROUP BY [ii].[IA_columnsName] + '_' + ISNULL([ii].[IA_includedColumns], '')
|
||||||
HAVING COUNT(1) > 1
|
HAVING COUNT(1) > 1
|
||||||
) d
|
) d
|
||||||
ON d.[key] = [itm].[IA_columns_name] + '_' + ISNULL([itm].[IA_included_columns], '')
|
ON d.[key] = [itm].[IA_columnsName] + '_' + ISNULL([itm].[IA_includedColumns], '')
|
||||||
GROUP BY [itm].[IA_schema_name],
|
GROUP BY [itm].[IA_schemaName],
|
||||||
[itm].[IA_table_name],
|
[itm].[IA_tableName],
|
||||||
[itm].[IA_columns_name],
|
[itm].[IA_columnsName],
|
||||||
[itm].[IA_included_columns];
|
[itm].[IA_includedColumns];
|
||||||
|
|
||||||
IF @msg <> ''
|
IF @msg <> ''
|
||||||
BEGIN
|
BEGIN
|
||||||
@@ -182,11 +180,15 @@ BEGIN
|
|||||||
|
|
||||||
|
|
||||||
/* fetch the indexes name and non listed indexes on the current instance */
|
/* fetch the indexes name and non listed indexes on the current instance */
|
||||||
DECLARE curIdxName CURSOR FAST_FORWARD READ_ONLY FOR
|
IF CURSOR_STATUS('global','curIdxName')>=-1
|
||||||
|
BEGIN
|
||||||
|
DEALLOCATE curIdxName
|
||||||
|
END
|
||||||
|
DECLARE curIdxName CURSOR LOCAL FAST_FORWARD READ_ONLY FOR
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
[itm].[IA_schema_name],
|
[itm].[IA_schemaName],
|
||||||
[itm].[IA_table_name],
|
[itm].[IA_tableName],
|
||||||
itm.[IA_indexesAlignementActions_id]
|
itm.[IA_indexesAlignementActionsID]
|
||||||
FROM [upd].[IA_IndexesAlignementActions] [itm];
|
FROM [upd].[IA_IndexesAlignementActions] [itm];
|
||||||
|
|
||||||
OPEN curIdxName;
|
OPEN curIdxName;
|
||||||
@@ -577,13 +579,6 @@ BEGIN
|
|||||||
FROM @indexesToMaintains [itm]
|
FROM @indexesToMaintains [itm]
|
||||||
WHERE [isToBeRecreated_inp] = 1;
|
WHERE [isToBeRecreated_inp] = 1;
|
||||||
|
|
||||||
--/* to be re-created because wrong index type*/
|
|
||||||
--UPDATE [itm]
|
|
||||||
--SET [itm].[isToBeRecreated_comp] = 1
|
|
||||||
--FROM @indexesToMaintains [itm]
|
|
||||||
--WHERE [itm].isClustered_inp = 1
|
|
||||||
--AND itm.;
|
|
||||||
|
|
||||||
/* to be deleted, because specified in table */
|
/* to be deleted, because specified in table */
|
||||||
UPDATE itm
|
UPDATE itm
|
||||||
SET [itm].[isToBeDeleted_comp] = CASE
|
SET [itm].[isToBeDeleted_comp] = CASE
|
||||||
@@ -609,8 +604,8 @@ BEGIN
|
|||||||
AND [exp].[isToBeRecreated_inp] = 0
|
AND [exp].[isToBeRecreated_inp] = 0
|
||||||
AND
|
AND
|
||||||
(
|
(
|
||||||
[exp].[columnsName_inp] != [act].[actualColumns_internal]
|
[exp].[columnsName_inp] <> [act].[actualColumns_internal]
|
||||||
OR [exp].[includedColumns_inp] != [act].[actualIncludedColumns_internal]
|
OR [exp].[includedColumns_inp] <> [act].[actualIncludedColumns_internal]
|
||||||
);
|
);
|
||||||
|
|
||||||
UPDATE [act]
|
UPDATE [act]
|
||||||
@@ -619,8 +614,8 @@ BEGIN
|
|||||||
JOIN @indexesToMaintains [act] --actual
|
JOIN @indexesToMaintains [act] --actual
|
||||||
ON [act].[indexName] = [exp].[expectedIndexName_inp]
|
ON [act].[indexName] = [exp].[expectedIndexName_inp]
|
||||||
WHERE (
|
WHERE (
|
||||||
[exp].[columnsName_inp] != [act].[actualColumns_internal]
|
[exp].[columnsName_inp] <> [act].[actualColumns_internal]
|
||||||
OR [exp].[includedColumns_inp] != [act].[actualIncludedColumns_internal]
|
OR [exp].[includedColumns_inp] <> [act].[actualIncludedColumns_internal]
|
||||||
);
|
);
|
||||||
|
|
||||||
/* to be deleted, because different to specs. link on index columns */
|
/* to be deleted, because different to specs. link on index columns */
|
||||||
@@ -630,8 +625,8 @@ BEGIN
|
|||||||
JOIN @indexesToMaintains [act] --actual
|
JOIN @indexesToMaintains [act] --actual
|
||||||
ON [act].[actualColumns_internal] = [exp].[columnsName_inp]
|
ON [act].[actualColumns_internal] = [exp].[columnsName_inp]
|
||||||
WHERE (
|
WHERE (
|
||||||
[exp].[columnsName_inp] != [act].[actualColumns_internal]
|
[exp].[columnsName_inp] <> [act].[actualColumns_internal]
|
||||||
OR [exp].[includedColumns_inp] != [act].[actualIncludedColumns_internal]
|
OR [exp].[includedColumns_inp] <> [act].[actualIncludedColumns_internal]
|
||||||
);
|
);
|
||||||
|
|
||||||
UPDATE [act]
|
UPDATE [act]
|
||||||
@@ -640,8 +635,8 @@ BEGIN
|
|||||||
JOIN @indexesToMaintains [act] --actual
|
JOIN @indexesToMaintains [act] --actual
|
||||||
ON [act].[actualColumns_internal] = [exp].[columnsName_inp]
|
ON [act].[actualColumns_internal] = [exp].[columnsName_inp]
|
||||||
WHERE (
|
WHERE (
|
||||||
[exp].[columnsName_inp] != [act].[actualColumns_internal]
|
[exp].[columnsName_inp] <> [act].[actualColumns_internal]
|
||||||
OR [exp].[includedColumns_inp] != [act].[actualIncludedColumns_internal]
|
OR [exp].[includedColumns_inp] <> [act].[actualIncludedColumns_internal]
|
||||||
);
|
);
|
||||||
|
|
||||||
/* if we have both "rename" and "delete" actions, remove the "rename" action */
|
/* if we have both "rename" and "delete" actions, remove the "rename" action */
|
||||||
@@ -794,7 +789,7 @@ BEGIN
|
|||||||
ia.[IA_statusMsg] = ii.statusMsg_internal
|
ia.[IA_statusMsg] = ii.statusMsg_internal
|
||||||
FROM [upd].[IA_IndexesAlignementActions] ia
|
FROM [upd].[IA_IndexesAlignementActions] ia
|
||||||
JOIN @indexesToMaintains ii
|
JOIN @indexesToMaintains ii
|
||||||
ON ii.[IA_indexesAlignementActions] = ia.[IA_indexesAlignementActions_id]
|
ON ii.[IA_indexesAlignementActions] = ia.[IA_indexesAlignementActionsID]
|
||||||
WHERE ia.[IA_executionDate] IS NULL;
|
WHERE ia.[IA_executionDate] IS NULL;
|
||||||
END;
|
END;
|
||||||
GO
|
GO
|
||||||
|
|||||||
@@ -1,82 +1,223 @@
|
|||||||
USE Arizona
|
USE Arizona
|
||||||
|
|
||||||
IF OBJECT_ID('upd.IA_IndexesAlignementActions') IS NOT NULL
|
IF OBJECT_ID('upd.IA_IndexAlignementActions') IS NOT NULL
|
||||||
DROP TABLE upd.IA_IndexesAlignementActions;
|
DROP TABLE upd.IA_IndexAlignementActions;
|
||||||
GO
|
GO
|
||||||
|
|
||||||
CREATE TABLE upd.IA_IndexesAlignementActions(
|
IF OBJECT_ID('upd.IA_IndexAlignementActions') IS NOT NULL
|
||||||
IA_indexesAlignementActions_id INT NOT NULL IDENTITY(1,1)
|
DROP TABLE upd.IA_IndexAlignementActions;
|
||||||
,IA_executionDate DATETIME2(0) NULL /* The date and time the action was executed, null if the action is to be executed */
|
|
||||||
,IA_schema_name VARCHAR(100) NOT NULL /* the schema the table is part of */
|
|
||||||
,IA_table_name VARCHAR(100) NOT NULL /* On which table is the index, whithout the schema */
|
|
||||||
,IA_columns_name VARCHAR(MAX) NOT NULL /* list all the columns of the index, in the correct orders */
|
|
||||||
,IA_is_clustered BIT NOT NULL /* Is the indexe a clustered index ? */
|
|
||||||
,IA_is_unique BIT NOT NULL /* Is the index unique ? */
|
|
||||||
,IA_included_columns VARCHAR(MAX)NULL /* list all the included columns the index should have. */
|
|
||||||
,IA_index_options VARCHAR(MAX) NULL /* Give here the index options if any. they will be applied on index creation but they are not part of the delta checks */
|
|
||||||
,IA_is_to_be_deleted BIT NOT NULL /* must the script drop this index ? */
|
|
||||||
,IA_is_to_be_recreated BIT NOT NULL /* must the script recreate this index ?
|
|
||||||
If an existing index differs from the definition, it will be dropped and the correct one created.
|
|
||||||
Use this only to force the re-creation even if the structure is identical */
|
|
||||||
,IA_expected_index_name VARCHAR(500) NOT NULL /* the name the index should have, used to determine if a rename of the existing index should be done */
|
|
||||||
|
|
||||||
|
|
||||||
/* everything below is a log of past changes */
|
|
||||||
,[IA_foundIndexName] VARCHAR(MAX) NULL /* computed by the script. The index name on this system, as indexes name can be different accross systems*/
|
|
||||||
,[IA_wasIndexFound] BIT NOT NULL /* computed by the script. set to 1 if the index is present on the server */
|
|
||||||
CONSTRAINT DF_IA_wasIndexFound DEFAULT 0
|
|
||||||
,[IA_wasCreated] BIT NULL /* computed by the script. does this index was created on the server ? */
|
|
||||||
CONSTRAINT DF_IA_wasCreated DEFAULT 0
|
|
||||||
,[IA_wasRenamed] BIT NULL /* computed by the script. does this index was renamed ? */
|
|
||||||
CONSTRAINT DF_IA_wasRenamed DEFAULT 0
|
|
||||||
,[IA_wasDeleted] BIT NULL /* computed by the script. does this index will be deleted ? */
|
|
||||||
CONSTRAINT DF_IA_wasDeleted DEFAULT 0
|
|
||||||
,[IA_wasRecreated] BIT NULL /* computed by the script. does this index will be re-created ? */
|
|
||||||
CONSTRAINT DF_IA_wasRecreated DEFAULT 0
|
|
||||||
,[IA_includedColumnsMatch] BIT NULL /* computed by the script. Are the expected and actual included columns identical ? */
|
|
||||||
,[IA_actualColumns] VARCHAR(MAX) NULL /* the actual columns in the existing index */
|
|
||||||
,[IA_actualIncludedColumns] VARCHAR(MAX) NULL /* the actual columns in the INCLUDE part of the index */
|
|
||||||
,[IA_statusMsg] VARCHAR(MAX) NULL /* Message, used for debug */
|
|
||||||
,CONSTRAINT PK_IA_IndexesAlignementActions PRIMARY KEY(IA_indexesAlignementActions_id)
|
|
||||||
);
|
|
||||||
ALTER TABLE upd.IA_IndexesAlignementActions ADD CONSTRAINT DF_IA_is_clustered DEFAULT 0 FOR IA_is_clustered;
|
|
||||||
ALTER TABLE upd.IA_IndexesAlignementActions ADD CONSTRAINT DF_IA_is_unique DEFAULT 0 FOR IA_is_unique;
|
|
||||||
ALTER TABLE upd.IA_IndexesAlignementActions ADD CONSTRAINT DF_IA_is_to_be_deleted DEFAULT 0 FOR IA_is_to_be_deleted;
|
|
||||||
ALTER TABLE upd.IA_IndexesAlignementActions ADD CONSTRAINT DF_IA_is_to_be_recreated DEFAULT 0 FOR IA_is_to_be_recreated;
|
|
||||||
|
|
||||||
CREATE UNIQUE NONCLUSTERED INDEX NCUIX_IA_IndexesAlignementActions_index_name ON upd.IA_IndexesAlignementActions(IA_expected_index_name);
|
|
||||||
GO
|
GO
|
||||||
|
|
||||||
INSERT INTO upd.IA_IndexesAlignementActions (
|
/* OCTPDBA-414 */
|
||||||
IA_columns_name,
|
IF OBJECT_ID('upd.IA_IndexAlignementActions') IS NULL
|
||||||
IA_is_to_be_deleted,
|
BEGIN
|
||||||
IA_is_to_be_recreated,
|
CREATE TABLE upd.IA_IndexAlignementActions(
|
||||||
IA_expected_index_name,
|
IA_indexAlignementActionsID INT NOT NULL IDENTITY(1,1)
|
||||||
IA_included_columns,
|
,IA_executionDate DATETIME2(0) NULL /* The date and time the action was executed, null if the action is to be executed */
|
||||||
[IA_schema_name],
|
,IA_schemaName VARCHAR(100) NOT NULL /* the schema the table is part of */
|
||||||
[IA_table_name],
|
,IA_tableName VARCHAR(100) NOT NULL /* On which table is the index, whithout the schema */
|
||||||
[IA_is_clustered],
|
,IA_columnsName VARCHAR(MAX) NOT NULL /* list all the columns of the index, in the correct orders */
|
||||||
[IA_is_unique]
|
,IA_isClustered BIT NOT NULL /* Is the indexe a clustered index ? */
|
||||||
|
CONSTRAINT DF_IA_isClustered DEFAULT 0
|
||||||
|
,IA_isUnique BIT NOT NULL /* Is the index unique ? */
|
||||||
|
CONSTRAINT DF_IA_isUnique DEFAULT 0
|
||||||
|
,IA_includedColumns VARCHAR(MAX)NULL /* list all the included columns the index should have. */
|
||||||
|
,IA_indexOptions VARCHAR(MAX) NULL /* Give here the index options if any. they will be applied on index creation but they are not part of the delta checks */
|
||||||
|
,IA_isToBeDeleted BIT NOT NULL /* must the script drop this index ? */
|
||||||
|
CONSTRAINT DF_IA_isToBeDeleted DEFAULT 0
|
||||||
|
,IA_isToBeRecreated BIT NOT NULL /* must the script recreate this index ? */
|
||||||
|
CONSTRAINT DF_IA_isToBeRecreated DEFAULT 0 /* If an existing index differs from the definition, it will be dropped and the correct one created. */
|
||||||
|
/* Use this only to force the re-creation even if the structure is identical */
|
||||||
|
,IA_expectedIndexName VARCHAR(500) NOT NULL /* the name the index should have, used to determine if a rename of the existing index should be done */
|
||||||
|
,IA_reference VARCHAR(500) NULL /* A free text that can contain a reference. Seen to simplify update scripts */
|
||||||
|
|
||||||
|
/* everything below is a log of past changes */
|
||||||
|
,[IA_foundIndexName] VARCHAR(MAX) NULL /* computed by the script. The index name on this system, as indexes name can be different accross systems*/
|
||||||
|
,[IA_wasIndexFound] BIT NOT NULL /* computed by the script. set to 1 if the index is present on the server */
|
||||||
|
CONSTRAINT DF_IA_wasIndexFound DEFAULT 0
|
||||||
|
,[IA_wasCreated] BIT NOT NULL /* computed by the script. does this index was created on the server ? */
|
||||||
|
CONSTRAINT DF_IA_wasCreated DEFAULT 0
|
||||||
|
,[IA_wasRenamed] BIT NOT NULL /* computed by the script. does this index was renamed ? */
|
||||||
|
CONSTRAINT DF_IA_wasRenamed DEFAULT 0
|
||||||
|
,[IA_wasDeleted] BIT NOT NULL /* computed by the script. does this index will be deleted ? */
|
||||||
|
CONSTRAINT DF_IA_wasDeleted DEFAULT 0
|
||||||
|
,[IA_wasRecreated] BIT NOT NULL /* computed by the script. does this index will be re-created ? */
|
||||||
|
CONSTRAINT DF_IA_wasRecreated DEFAULT 0
|
||||||
|
,[IA_includedColumnsMatch] BIT NULL /* computed by the script. Are the expected and actual included columns identical ? */
|
||||||
|
,[IA_actualColumns] VARCHAR(MAX) NULL /* the actual columns in the existing index */
|
||||||
|
,[IA_actualIncludedColumns] VARCHAR(MAX) NULL /* the actual columns in the INCLUDE part of the index */
|
||||||
|
,[IA_statusMsg] VARCHAR(MAX) NULL /* Message, used for debug */
|
||||||
|
,CONSTRAINT PK_IA_IndexAlignementActions PRIMARY KEY CLUSTERED(IA_indexAlignementActionsID)
|
||||||
|
);
|
||||||
|
END
|
||||||
|
|
||||||
|
IF NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM [sys].all_columns c
|
||||||
|
JOIN [sys].tables t ON c.object_id = t.object_id
|
||||||
|
JOIN [sys].schemas s ON t.schema_id = s.schema_id
|
||||||
|
JOIN [sys].default_constraints dc ON c.default_object_id = dc.object_id
|
||||||
|
WHERE s.name = 'upd'
|
||||||
|
AND t.name = 'IA_IndexAlignementActions'
|
||||||
|
AND c.name = 'IA_isClustered'
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
ALTER TABLE upd.IA_IndexAlignementActions ADD CONSTRAINT DF_IA_isClustered DEFAULT 0 FOR [IA_isClustered];
|
||||||
|
END;
|
||||||
|
|
||||||
|
IF NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM [sys].all_columns c
|
||||||
|
JOIN [sys].tables t ON c.object_id = t.object_id
|
||||||
|
JOIN [sys].schemas s ON t.schema_id = s.schema_id
|
||||||
|
JOIN [sys].default_constraints dc ON c.default_object_id = dc.object_id
|
||||||
|
WHERE s.name = 'upd'
|
||||||
|
AND t.name = 'IA_IndexAlignementActions'
|
||||||
|
AND c.name = 'IA_isUnique'
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
ALTER TABLE [upd].[IA_IndexAlignementActions] ADD CONSTRAINT DF_IA_isUnique DEFAULT 0 FOR [IA_isUnique];
|
||||||
|
END
|
||||||
|
IF NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM [sys].all_columns c
|
||||||
|
JOIN [sys].tables t ON c.object_id = t.object_id
|
||||||
|
JOIN [sys].schemas s ON t.schema_id = s.schema_id
|
||||||
|
JOIN [sys].default_constraints dc ON c.default_object_id = dc.object_id
|
||||||
|
WHERE s.name = 'upd'
|
||||||
|
AND t.name = 'IA_IndexAlignementActions'
|
||||||
|
AND c.name = 'IA_isToBeDeleted'
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
ALTER TABLE [upd].[IA_IndexAlignementActions] ADD CONSTRAINT DF_IA_isToBeDeleted DEFAULT 0 FOR [IA_isToBeDeleted];
|
||||||
|
END
|
||||||
|
|
||||||
|
IF NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM [sys].all_columns c
|
||||||
|
JOIN [sys].tables t ON c.object_id = t.object_id
|
||||||
|
JOIN [sys].schemas s ON t.schema_id = s.schema_id
|
||||||
|
JOIN [sys].default_constraints dc ON c.default_object_id = dc.object_id
|
||||||
|
WHERE s.name = 'upd'
|
||||||
|
AND t.name = 'IA_IndexAlignementActions'
|
||||||
|
AND c.name = 'IA_isToBeRecreated'
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
ALTER TABLE [upd].[IA_IndexAlignementActions] ADD CONSTRAINT DF_IA_isToBeRecreated DEFAULT 0 FOR [IA_isToBeRecreated];
|
||||||
|
END
|
||||||
|
|
||||||
|
IF NOT EXISTS ( SELECT 1
|
||||||
|
FROM [sys].indexes i
|
||||||
|
WHERE i.object_id = OBJECT_ID(N'upd.IA_IndexAlignementActions')
|
||||||
|
AND [i].[name] = N'NCUIX_IA_IndexAlignementActions_COL_IA_expectedIndexName')
|
||||||
|
BEGIN
|
||||||
|
CREATE UNIQUE NONCLUSTERED INDEX NCUIX_IA_IndexAlignementActions_COL_IA_expectedIndexName ON [upd].[IA_IndexAlignementActions](IA_expectedIndexName);
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
/* Create Table Comments */
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'The date and time the action was executed, null if the action is to be executed', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_executionDate]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'the schema the table is part of', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_schemaName]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'On which table is the index, whithout the schema', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_tableName]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'list all the columns of the index, in the correct orders', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_columnsName]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'Is the index a clustered index ?', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_isClustered]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'Is the index unique ?', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_isUnique]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'list all the included columns the index should have.', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_includedColumns]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'Give here the index options if any. they will be applied on index creation but they are not part of the delta checks', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_indexOptions]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'must the script drop this index ?', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_isToBeDeleted]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'must the script recreate this index ?
|
||||||
|
If an existing index differs from the definition, it will be dropped and the correct one created.
|
||||||
|
Use this only to force the re-creation even if the structure is identical', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_isToBeRecreated]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'the name the index should have, used to determine if a rename of the existing index should be done', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_expectedIndexName]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'A free text that can contain a reference. Seen to simplify update scripts', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_reference]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'computed by the proc. The index name on this system, as indexes name can be different accross systems', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_foundIndexName]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'computed by the proc. set to 1 if the index is present on the server ', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_wasIndexFound]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'computed by the proc. does this index was created on the server ?', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_wasCreated]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'computed by the proc. does this index was renamed ?', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_wasRenamed]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'computed by the proc. does this index was deleted ?', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_wasDeleted]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'computed by the proc. does this index was re-created ?', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_wasRecreated]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'computed by the proc. Are the expected and actual included columns identical ?', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_includedColumnsMatch]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'the actual columns in the existing index', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_actualColumns]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'the actual columns in the INCLUDE part of the index', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_actualIncludedColumns]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sp_addextendedproperty 'MS_Description', 'Message, used for debug', 'Schema', [upd], 'table', [IA_IndexAlignementActions], 'column', [IA_statusMsg]
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO upd.IA_IndexAlignementActions (
|
||||||
|
IA_columnsName,
|
||||||
|
IA_isToBeDeleted,
|
||||||
|
IA_isToBeRecreated,
|
||||||
|
IA_expectedIndexName,
|
||||||
|
IA_includedColumns,
|
||||||
|
IA_schemaName,
|
||||||
|
IA_tableName,
|
||||||
|
IA_isClustered,
|
||||||
|
IA_isUnique
|
||||||
|
,IA_reference
|
||||||
)
|
)
|
||||||
/* indexe(s) we do want */
|
/* indexe(s) we do want */
|
||||||
VALUES('Entry_id',0,0,'PK_Entry_id', NULL,'dbo','entry',0,0)
|
VALUES('Entry_id',0,0,'PK_Entry_id', NULL,'dbo','entry',0,0,'OCTPDBA-365')
|
||||||
,('ET_batch_run',0,0,'NCIX_Entry_COL_ET_batch_run',NULL,'dbo','entry',0,0)
|
,('ET_batch_run',0,0,'NCIX_Entry_COL_ET_batch_run',NULL,'dbo','entry',0,0,'OCTPDBA-365')
|
||||||
,('ET_accounting_period',0,0,'NCIX_Entry_COL_ET_accounting_period','Entry_ID','dbo','entry',0,0)
|
,('ET_accounting_period',0,0,'NCIX_Entry_COL_ET_accounting_period','Entry_ID','dbo','entry',0,0,'OCTPDBA-365')
|
||||||
,('ET_document_header',0,0,'NCIX_Entry_COL_ET_document_header','ET_debit_currency_amount, ET_credit_currency_amount','dbo','entry',0,0)
|
,('ET_document_header',0,0,'NCIX_Entry_COL_ET_document_header','ET_debit_currency_amount, ET_credit_currency_amount','dbo','entry',0,0,'OCTPDBA-365')
|
||||||
,('ET_account, ET_document_header',0,0,'NCIX_Entry_COL_ET_account','Entry_ID','dbo','entry',0,0)
|
,('ET_account, ET_document_header',0,0,'NCIX_Entry_COL_ET_account','Entry_ID','dbo','entry',0,0,'OCTPDBA-365')
|
||||||
,('ET_reconciliation_status, ET_account, ET_document_header',0,0,'NCIX_Entry_COL_ET_reconciliation_status','ET_debit_base_amount, ET_credit_base_amount, ET_reconciliation_base_amount','dbo','entry',0,0)
|
,('ET_reconciliation_status, ET_account, ET_document_header',0,0,'NCIX_Entry_COL_ET_reconciliation_status','ET_debit_base_amount, ET_credit_base_amount, ET_reconciliation_base_amount','dbo','entry',0,0,'OCTPDBA-365')
|
||||||
,('ET_predefined_entry',0,0,'NCIX_Entry_COL_ET_predefined_entry',NULL,'dbo','entry',0,0)
|
,('ET_predefined_entry',0,0,'NCIX_Entry_COL_ET_predefined_entry',NULL,'dbo','entry',0,0,'OCTPDBA-365')
|
||||||
,('ET_entry_address',0,0,'NCIX_Entry_COL_ET_entry_address',NULL,'dbo','entry',0,0)
|
,('ET_entry_address',0,0,'NCIX_Entry_COL_ET_entry_address',NULL,'dbo','entry',0,0,'OCTPDBA-365')
|
||||||
,('ET_currency',0,0,'NCIX_Entry_COL_ET_currency',NULL,'dbo','entry',0,0)
|
,('ET_currency',0,0,'NCIX_Entry_COL_ET_currency',NULL,'dbo','entry',0,0,'OCTPDBA-365')
|
||||||
|
|
||||||
/* indexe(s) used in central, even if not in pharmacies*/
|
/* indexe(s) used in central, even if not in pharmacies*/
|
||||||
,('ET_entry_type',0,0,'NCIX_Entry_COL_ET_entry_type',NULL,'dbo','entry',0,0)
|
,('ET_entry_type',0,0,'NCIX_Entry_COL_ET_entry_type',NULL,'dbo','entry',0,0,'OCTPDBA-365')
|
||||||
|
|
||||||
/* indexe(s) we really want to drop*/
|
/* indexe(s) we really want to drop*/
|
||||||
,('ET_master_ID',1,0,'NCIX_Entry_COL_ET_master_ID',NULL,'dbo','entry',0,0)
|
,('ET_master_ID',1,0,'NCIX_Entry_COL_ET_master_ID',NULL,'dbo','entry',0,0,'OCTPDBA-365')
|
||||||
,('ET_bmc_user_profile',1,0,'NCIX_Entry_COL_ET_bmc_user_profile',NULL,'dbo','entry',0,0)
|
,('ET_bmc_user_profile',1,0,'NCIX_Entry_COL_ET_bmc_user_profile',NULL,'dbo','entry',0,0,'OCTPDBA-365')
|
||||||
,('ET_sales_tax_code',1,0,'NCIX_Entry_COL_ET_sales_tax_code',NULL,'dbo','entry',0,0)
|
,('ET_sales_tax_code',1,0,'NCIX_Entry_COL_ET_sales_tax_code',NULL,'dbo','entry',0,0,'OCTPDBA-365')
|
||||||
,('ET_APS_TS', 1, 0, 'NCIX_Entry_COL_ET_APS_TS',NULL,'dbo','entry',0,0)
|
,('ET_APS_TS', 1, 0, 'NCIX_Entry_COL_ET_APS_TS',NULL,'dbo','entry',0,0,'OCTPDBA-365')
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -4,144 +4,298 @@ BEGIN TRANSACTION;
|
|||||||
SET XACT_ABORT ON;
|
SET XACT_ABORT ON;
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO upd.IA_IndexesAlignementActions
|
|
||||||
(
|
/* OCTPDBA-414: table dbo.criteria, pharmacy only*/
|
||||||
IA_executionDate,
|
|
||||||
IA_schema_name,
|
/* CR_code, CR_criteria_type */
|
||||||
IA_table_name,
|
INSERT INTO [Arizona].[upd].[IA_IndexAlignementActions]
|
||||||
IA_columns_name,
|
(
|
||||||
IA_is_clustered,
|
[IA_executionDate],
|
||||||
IA_is_unique,
|
[IA_schemaName],
|
||||||
IA_included_columns,
|
[IA_tableName],
|
||||||
IA_is_to_be_deleted,
|
[IA_columnsName],
|
||||||
IA_is_to_be_recreated,
|
[IA_isClustered],
|
||||||
IA_expected_index_name,
|
[IA_isUnique],
|
||||||
IA_foundIndexName,
|
[IA_includedColumns],
|
||||||
IA_wasIndexFound,
|
[IA_isToBeDeleted],
|
||||||
IA_wasCreated,
|
[IA_isToBeRecreated],
|
||||||
IA_wasRenamed,
|
[IA_expectedIndexName],
|
||||||
IA_wasDeleted,
|
[IA_foundIndexName],
|
||||||
IA_wasRecreated,
|
[IA_wasIndexFound],
|
||||||
IA_includedColumnsMatch,
|
[IA_wasCreated],
|
||||||
IA_actualColumns,
|
[IA_wasRenamed],
|
||||||
IA_actualIncludedColumns,
|
[IA_wasDeleted],
|
||||||
IA_statusMsg,
|
[IA_wasRecreated],
|
||||||
IA_index_options
|
[IA_includedColumnsMatch],
|
||||||
)
|
[IA_actualColumns],
|
||||||
SELECT
|
[IA_actualIncludedColumns],
|
||||||
NULL AS IA_executionDate,
|
[IA_statusMsg],
|
||||||
'dbo' AS IA_schema_name,
|
[IA_indexOptions],
|
||||||
'Criteria' AS IA_table_name,
|
[IA_reference]
|
||||||
'CR_code, CR_criteria_type' AS IA_columns_name,
|
)
|
||||||
0 AS IA_is_clustered,
|
SELECT
|
||||||
1 AS IA_is_unique,
|
NULL as [IA_executionDate],
|
||||||
NULL AS IA_included_columns,
|
'dbo' as [IA_schemaName],
|
||||||
0 AS IA_is_to_be_deleted,
|
'Criteria' as [IA_tableName],
|
||||||
0 AS IA_is_to_be_recreated,
|
'CR_code, CR_criteria_type' as [IA_columnsName],
|
||||||
'NCIX_Criteria_COL_CR_code' AS IA_expected_index_name,
|
0 as [IA_isClustered],
|
||||||
NULL AS IA_foundIndexName,
|
1 as [IA_isUnique],
|
||||||
0 AS IA_wasIndexFound,
|
NULL as [IA_includedColumns],
|
||||||
0 AS IA_wasCreated,
|
0 as [IA_isToBeRecreated],
|
||||||
0 AS IA_wasRenamed,
|
0 as [IA_isToBeRecreated],
|
||||||
0 AS IA_wasDeleted,
|
'NCIX_Criteria_COL_CR_code' as [IA_expectedIndexName],
|
||||||
0 AS IA_wasRecreated,
|
NULL as [IA_foundIndexName],
|
||||||
NULL AS IA_includedColumnsMatch,
|
0 as [IA_wasIndexFound],
|
||||||
NULL AS IA_actualColumns,
|
0 as [IA_wasCreated],
|
||||||
NULL AS IA_actualIncludedColumns,
|
0 as [IA_wasRenamed],
|
||||||
NULL AS IA_statusMsg ,
|
0 as [IA_wasDeleted],
|
||||||
NULL AS IA_index_options
|
0 as [IA_wasRecreated],
|
||||||
UNION
|
NULL as [IA_includedColumnsMatch],
|
||||||
SELECT
|
NULL as [IA_actualColumns],
|
||||||
NULL AS IA_executionDate,
|
NULL as [IA_actualIncludedColumns],
|
||||||
'dbo' AS IA_schema_name,
|
NULL as [IA_statusMsg],
|
||||||
'Criteria' AS IA_table_name,
|
'STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, FILLFACTOR =90' as IA_index_options,
|
||||||
'CR_criteria_type' AS IA_columns_name,
|
'OCTPDBA-414' AS [IA_reference]
|
||||||
0 AS IA_is_clustered,
|
WHERE NOT EXISTS(
|
||||||
0 AS IA_is_unique,
|
SELECT 1
|
||||||
NULL AS IA_included_columns,
|
FROM [Arizona].[upd].[IA_IndexAlignementActions] s
|
||||||
0 AS IA_is_to_be_deleted,
|
WHERE [s].[IA_schemaName] = 'dbo'
|
||||||
0 AS IA_is_to_be_recreated,
|
AND [s].[IA_tableName] = 'Criteria'
|
||||||
'NCIX_Criteria_COL_CR_criteria_type' AS IA_expected_index_name,
|
AND [s].[IA_columnsName] = 'CR_code, CR_criteria_type'
|
||||||
NULL AS IA_foundIndexName,
|
AND [s].[IA_reference] = 'OCTPDBA-414'
|
||||||
0 AS IA_wasIndexFound,
|
)
|
||||||
0 AS IA_wasCreated,
|
|
||||||
0 AS IA_wasRenamed,
|
/* CR_criteria_type */
|
||||||
0 AS IA_wasDeleted,
|
INSERT INTO [Arizona].[upd].[IA_IndexAlignementActions]
|
||||||
0 AS IA_wasRecreated,
|
(
|
||||||
NULL AS IA_includedColumnsMatch,
|
[IA_executionDate],
|
||||||
NULL AS IA_actualColumns,
|
[IA_schemaName],
|
||||||
NULL AS IA_actualIncludedColumns,
|
[IA_tableName],
|
||||||
NULL AS IA_statusMsg ,
|
[IA_columnsName],
|
||||||
NULL AS IA_index_options
|
[IA_isClustered],
|
||||||
UNION
|
[IA_isUnique],
|
||||||
SELECT
|
[IA_includedColumns],
|
||||||
NULL AS IA_executionDate,
|
[IA_isToBeDeleted],
|
||||||
'dbo' AS IA_schema_name,
|
[IA_isToBeRecreated],
|
||||||
'Criteria' AS IA_table_name,
|
[IA_expectedIndexName],
|
||||||
'CR_master_ID' AS IA_columns_name,
|
[IA_foundIndexName],
|
||||||
0 AS IA_is_clustered,
|
[IA_wasIndexFound],
|
||||||
0 AS IA_is_unique,
|
[IA_wasCreated],
|
||||||
NULL AS IA_included_columns,
|
[IA_wasRenamed],
|
||||||
0 AS IA_is_to_be_deleted,
|
[IA_wasDeleted],
|
||||||
01 AS IA_is_to_be_recreated,
|
[IA_wasRecreated],
|
||||||
'NCIX_Criteria_COL_CR_master_ID' AS IA_expected_index_name,
|
[IA_includedColumnsMatch],
|
||||||
NULL AS IA_foundIndexName,
|
[IA_actualColumns],
|
||||||
0 AS IA_wasIndexFound,
|
[IA_actualIncludedColumns],
|
||||||
0 AS IA_wasCreated,
|
[IA_statusMsg],
|
||||||
0 AS IA_wasRenamed,
|
[IA_indexOptions],
|
||||||
0 AS IA_wasDeleted,
|
[IA_reference]
|
||||||
0 AS IA_wasRecreated,
|
)
|
||||||
NULL AS IA_includedColumnsMatch,
|
SELECT
|
||||||
NULL AS IA_actualColumns,
|
NULL as [IA_executionDate],
|
||||||
NULL AS IA_actualIncludedColumns,
|
'dbo' as [IA_schemaName],
|
||||||
NULL AS IA_statusMsg,
|
'Criteria' as [IA_tableName],
|
||||||
NULL AS IA_index_options
|
'CR_criteria_type' as [IA_columnsName],
|
||||||
UNION
|
0 as [IA_isClustered],
|
||||||
SELECT
|
0 as [IA_isUnique],
|
||||||
NULL AS IA_executionDate,
|
NULL as [IA_includedColumns],
|
||||||
'dbo' AS IA_schema_name,
|
0 as [IA_isToBeRecreated],
|
||||||
'Criteria' AS IA_table_name,
|
0 as [IA_isToBeRecreated],
|
||||||
'CR_VGUID' AS IA_columns_name,
|
'NCIX_Criteria_COL_CR_criteria_type' as [IA_expectedIndexName],
|
||||||
0 AS IA_is_clustered,
|
NULL as [IA_foundIndexName],
|
||||||
0 AS IA_is_unique,
|
0 as [IA_wasIndexFound],
|
||||||
NULL AS IA_included_columns,
|
0 as [IA_wasCreated],
|
||||||
0 AS IA_is_to_be_deleted,
|
0 as [IA_wasRenamed],
|
||||||
0 AS IA_is_to_be_recreated,
|
0 as [IA_wasDeleted],
|
||||||
'NCIX_Criteria_COL_CR_VGUID' AS IA_expected_index_name,
|
0 as [IA_wasRecreated],
|
||||||
NULL AS IA_foundIndexName,
|
NULL as [IA_includedColumnsMatch],
|
||||||
0 AS IA_wasIndexFound,
|
NULL as [IA_actualColumns],
|
||||||
0 AS IA_wasCreated,
|
NULL as [IA_actualIncludedColumns],
|
||||||
0 AS IA_wasRenamed,
|
NULL as [IA_statusMsg],
|
||||||
0 AS IA_wasDeleted,
|
'STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, FILLFACTOR =90' as IA_index_options,
|
||||||
0 AS IA_wasRecreated,
|
'OCTPDBA-414' AS [IA_reference]
|
||||||
NULL AS IA_includedColumnsMatch,
|
WHERE NOT EXISTS(
|
||||||
NULL AS IA_actualColumns,
|
SELECT 1
|
||||||
NULL AS IA_actualIncludedColumns,
|
FROM [Arizona].[upd].[IA_IndexAlignementActions] s
|
||||||
NULL AS IA_statusMsg ,
|
WHERE [s].[IA_schemaName] = 'dbo'
|
||||||
NULL AS IA_index_options
|
AND [s].[IA_tableName] = 'Criteria'
|
||||||
UNION
|
AND [s].[IA_columnsName] = 'CR_criteria_type'
|
||||||
SELECT
|
AND [s].[IA_reference] = 'OCTPDBA-414'
|
||||||
NULL AS IA_executionDate,
|
)
|
||||||
'dbo' AS IA_schema_name,
|
|
||||||
'Criteria' AS IA_table_name,
|
/* CR_master_ID */
|
||||||
'Criteria_ID' AS IA_columns_name,
|
INSERT INTO [Arizona].[upd].[IA_IndexAlignementActions]
|
||||||
1 AS IA_is_clustered,
|
(
|
||||||
1 AS IA_is_unique,
|
[IA_executionDate],
|
||||||
NULL AS IA_included_columns,
|
[IA_schemaName],
|
||||||
0 AS IA_is_to_be_deleted,
|
[IA_tableName],
|
||||||
0 AS IA_is_to_be_recreated,
|
[IA_columnsName],
|
||||||
'PK_Criteria_ID' AS IA_expected_index_name,
|
[IA_isClustered],
|
||||||
NULL AS IA_foundIndexName,
|
[IA_isUnique],
|
||||||
0 AS IA_wasIndexFound,
|
[IA_includedColumns],
|
||||||
0 AS IA_wasCreated,
|
[IA_isToBeDeleted],
|
||||||
0 AS IA_wasRenamed,
|
[IA_isToBeRecreated],
|
||||||
0 AS IA_wasDeleted,
|
[IA_expectedIndexName],
|
||||||
0 AS IA_wasRecreated,
|
[IA_foundIndexName],
|
||||||
NULL AS IA_includedColumnsMatch,
|
[IA_wasIndexFound],
|
||||||
NULL AS IA_actualColumns,
|
[IA_wasCreated],
|
||||||
NULL AS IA_actualIncludedColumns,
|
[IA_wasRenamed],
|
||||||
NULL AS IA_statusMsg ,
|
[IA_wasDeleted],
|
||||||
NULL AS IA_index_options
|
[IA_wasRecreated],
|
||||||
|
[IA_includedColumnsMatch],
|
||||||
|
[IA_actualColumns],
|
||||||
|
[IA_actualIncludedColumns],
|
||||||
|
[IA_statusMsg],
|
||||||
|
[IA_indexOptions],
|
||||||
|
[IA_reference]
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
NULL as [IA_executionDate],
|
||||||
|
'dbo' as [IA_schemaName],
|
||||||
|
'Criteria' as [IA_tableName],
|
||||||
|
'CR_master_ID' as [IA_columnsName],
|
||||||
|
0 as [IA_isClustered],
|
||||||
|
0 as [IA_isUnique],
|
||||||
|
NULL as [IA_includedColumns],
|
||||||
|
0 as [IA_isToBeRecreated],
|
||||||
|
0 as [IA_isToBeRecreated],
|
||||||
|
'NCIX_Criteria_COL_CR_master_ID' as [IA_expectedIndexName],
|
||||||
|
NULL as [IA_foundIndexName],
|
||||||
|
0 as [IA_wasIndexFound],
|
||||||
|
0 as [IA_wasCreated],
|
||||||
|
0 as [IA_wasRenamed],
|
||||||
|
0 as [IA_wasDeleted],
|
||||||
|
0 as [IA_wasRecreated],
|
||||||
|
NULL as [IA_includedColumnsMatch],
|
||||||
|
NULL as [IA_actualColumns],
|
||||||
|
NULL as [IA_actualIncludedColumns],
|
||||||
|
NULL as [IA_statusMsg],
|
||||||
|
'STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, FILLFACTOR =90' as IA_index_options,
|
||||||
|
'OCTPDBA-414' AS [IA_reference]
|
||||||
|
WHERE NOT EXISTS(
|
||||||
|
SELECT 1
|
||||||
|
FROM [Arizona].[upd].[IA_IndexAlignementActions] s
|
||||||
|
WHERE [s].[IA_schemaName] = 'dbo'
|
||||||
|
AND [s].[IA_tableName] = 'Criteria'
|
||||||
|
AND [s].[IA_columnsName] = 'CR_master_ID'
|
||||||
|
AND [s].[IA_reference] = 'OCTPDBA-414'
|
||||||
|
)
|
||||||
|
|
||||||
|
/* CR_VGUID */
|
||||||
|
INSERT INTO [Arizona].[upd].[IA_IndexAlignementActions]
|
||||||
|
(
|
||||||
|
[IA_executionDate],
|
||||||
|
[IA_schemaName],
|
||||||
|
[IA_tableName],
|
||||||
|
[IA_columnsName],
|
||||||
|
[IA_isClustered],
|
||||||
|
[IA_isUnique],
|
||||||
|
[IA_includedColumns],
|
||||||
|
[IA_isToBeDeleted],
|
||||||
|
[IA_isToBeRecreated],
|
||||||
|
[IA_expectedIndexName],
|
||||||
|
[IA_foundIndexName],
|
||||||
|
[IA_wasIndexFound],
|
||||||
|
[IA_wasCreated],
|
||||||
|
[IA_wasRenamed],
|
||||||
|
[IA_wasDeleted],
|
||||||
|
[IA_wasRecreated],
|
||||||
|
[IA_includedColumnsMatch],
|
||||||
|
[IA_actualColumns],
|
||||||
|
[IA_actualIncludedColumns],
|
||||||
|
[IA_statusMsg],
|
||||||
|
[IA_indexOptions],
|
||||||
|
[IA_reference]
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
NULL as [IA_executionDate],
|
||||||
|
'dbo' as [IA_schemaName],
|
||||||
|
'Criteria' as [IA_tableName],
|
||||||
|
'CR_VGUID' as [IA_columnsName],
|
||||||
|
0 as [IA_isClustered],
|
||||||
|
0 as [IA_isUnique],
|
||||||
|
NULL as [IA_includedColumns],
|
||||||
|
0 as [IA_isToBeRecreated],
|
||||||
|
0 as [IA_isToBeRecreated],
|
||||||
|
'NCIX_Criteria_COL_CR_VGUID' as [IA_expectedIndexName],
|
||||||
|
NULL as [IA_foundIndexName],
|
||||||
|
0 as [IA_wasIndexFound],
|
||||||
|
0 as [IA_wasCreated],
|
||||||
|
0 as [IA_wasRenamed],
|
||||||
|
0 as [IA_wasDeleted],
|
||||||
|
0 as [IA_wasRecreated],
|
||||||
|
NULL as [IA_includedColumnsMatch],
|
||||||
|
NULL as [IA_actualColumns],
|
||||||
|
NULL as [IA_actualIncludedColumns],
|
||||||
|
NULL as [IA_statusMsg],
|
||||||
|
'STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, FILLFACTOR =90' as IA_index_options,
|
||||||
|
'OCTPDBA-414' AS [IA_reference]
|
||||||
|
WHERE NOT EXISTS(
|
||||||
|
SELECT 1
|
||||||
|
FROM [Arizona].[upd].[IA_IndexAlignementActions] s
|
||||||
|
WHERE [s].[IA_schemaName] = 'dbo'
|
||||||
|
AND [s].[IA_tableName] = 'Criteria'
|
||||||
|
AND [s].[IA_columnsName] = 'CR_VGUID'
|
||||||
|
AND [s].[IA_reference] = 'OCTPDBA-414'
|
||||||
|
)
|
||||||
|
|
||||||
|
/* Criteria_ID */
|
||||||
|
INSERT INTO [Arizona].[upd].[IA_IndexAlignementActions]
|
||||||
|
(
|
||||||
|
[IA_executionDate],
|
||||||
|
[IA_schemaName],
|
||||||
|
[IA_tableName],
|
||||||
|
[IA_columnsName],
|
||||||
|
[IA_isClustered],
|
||||||
|
[IA_isUnique],
|
||||||
|
[IA_includedColumns],
|
||||||
|
[IA_isToBeDeleted],
|
||||||
|
[IA_isToBeRecreated],
|
||||||
|
[IA_expectedIndexName],
|
||||||
|
[IA_foundIndexName],
|
||||||
|
[IA_wasIndexFound],
|
||||||
|
[IA_wasCreated],
|
||||||
|
[IA_wasRenamed],
|
||||||
|
[IA_wasDeleted],
|
||||||
|
[IA_wasRecreated],
|
||||||
|
[IA_includedColumnsMatch],
|
||||||
|
[IA_actualColumns],
|
||||||
|
[IA_actualIncludedColumns],
|
||||||
|
[IA_statusMsg],
|
||||||
|
[IA_indexOptions],
|
||||||
|
[IA_reference]
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
NULL as [IA_executionDate],
|
||||||
|
'dbo' as [IA_schemaName],
|
||||||
|
'Criteria' as [IA_tableName],
|
||||||
|
'Criteria_ID' as [IA_columnsName],
|
||||||
|
0 as [IA_isClustered],
|
||||||
|
1 as [IA_isUnique],
|
||||||
|
NULL as [IA_includedColumns],
|
||||||
|
0 as [IA_isToBeRecreated],
|
||||||
|
0 as [IA_isToBeRecreated],
|
||||||
|
'PK_Criteria_ID' as [IA_expectedIndexName],
|
||||||
|
NULL as [IA_foundIndexName],
|
||||||
|
0 as [IA_wasIndexFound],
|
||||||
|
0 as [IA_wasCreated],
|
||||||
|
0 as [IA_wasRenamed],
|
||||||
|
0 as [IA_wasDeleted],
|
||||||
|
0 as [IA_wasRecreated],
|
||||||
|
NULL as [IA_includedColumnsMatch],
|
||||||
|
NULL as [IA_actualColumns],
|
||||||
|
NULL as [IA_actualIncludedColumns],
|
||||||
|
NULL as [IA_statusMsg],
|
||||||
|
'STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, SORT_IN_TEMPDB = OFF, FILLFACTOR =90' as IA_index_options,
|
||||||
|
'OCTPDBA-414' AS [IA_reference]
|
||||||
|
WHERE NOT EXISTS(
|
||||||
|
SELECT 1
|
||||||
|
FROM [Arizona].[upd].[IA_IndexAlignementActions] s
|
||||||
|
WHERE [s].[IA_schemaName] = 'dbo'
|
||||||
|
AND [s].[IA_tableName] = 'Criteria'
|
||||||
|
AND [s].[IA_reference] = 'OCTPDBA-414'
|
||||||
|
AND [s].[IA_columnsName] = 'Criteria_ID'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -151,6 +305,6 @@ EXEC [upd].[alignIndexes] @in_debug = 01, -- int
|
|||||||
@in_dropUnreferencedIndexes = NULL; -- bit
|
@in_dropUnreferencedIndexes = NULL; -- bit
|
||||||
|
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM upd.IA_IndexesAlignementActions;
|
FROM upd.IA_IndexAlignementActions;
|
||||||
|
|
||||||
ROLLBACK TRANSACTION;
|
ROLLBACK TRANSACTION;
|
||||||
1
OCTPDBA-496 - Validate ssl deactivation/.gitignore
vendored
Normal file
1
OCTPDBA-496 - Validate ssl deactivation/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/*.xlsx
|
||||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
|||||||
|
SELECT qm.database_id,
|
||||||
|
qm.queue_id,
|
||||||
|
q.[name] AS queue_name,
|
||||||
|
qm.STATE,
|
||||||
|
qm.last_empty_rowset_time,
|
||||||
|
qm.last_activated_time,
|
||||||
|
qm.tasks_waiting
|
||||||
|
FROM sys.dm_broker_queue_monitors qm
|
||||||
|
JOIN sys.[service_queues] q
|
||||||
|
ON q.[object_id] = qm.[queue_id];
|
||||||
|
|
||||||
|
|
||||||
|
SELECT *
|
||||||
|
FROM sys.dm_os_performance_counters
|
||||||
|
WHERE object_name LIKE '%Broker Statistics%'
|
||||||
|
AND [counter_name] IN ( 'Corrupted Messages Total', 'Activation Errors Total', 'Dropped Messages Total',
|
||||||
|
'Enqueued Local Messages Total','Enqueued Transport Msgs Total', 'Forwarded Messages Total'
|
||||||
|
|
||||||
|
);
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# SQL Server Management Studio Solution File, Format Version 18.00
|
||||||
|
VisualStudioVersion = 15.0.28307.421
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{4F2E2C19-372F-40D8-9FA7-9D2138C6997A}") = "OCTPDBA-496 - Validate ssl deactivation", "OCTPDBA-496 - Validate ssl deactivation.ssmssqlproj", "{3AB8C2C0-6783-43CD-9F30-78F0966B486C}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Default|Default = Default|Default
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{3AB8C2C0-6783-43CD-9F30-78F0966B486C}.Default|Default.ActiveCfg = Default
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {F7E7AE51-7FDB-4972-A3D6-580431955D1B}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<SqlWorkbenchSqlProject xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="OCTPDBA-496 - Validate ssl deactivation">
|
||||||
|
<Items>
|
||||||
|
<LogicalFolder Name="Connections" Type="2" Sorted="true">
|
||||||
|
<Items>
|
||||||
|
<ConnectionNode Name="hcimon:CENTRALINFRA\ua208700">
|
||||||
|
<Created>2023-02-17T10:07:59.2402706+01:00</Created>
|
||||||
|
<Type>SQL</Type>
|
||||||
|
<Server>hcimon</Server>
|
||||||
|
<UserName />
|
||||||
|
<Authentication>Windows Authentication</Authentication>
|
||||||
|
<InitialDB>master</InitialDB>
|
||||||
|
<LoginTimeout>30</LoginTimeout>
|
||||||
|
<ExecutionTimeout>0</ExecutionTimeout>
|
||||||
|
<ConnectionProtocol>NotSpecified</ConnectionProtocol>
|
||||||
|
<ApplicationName>Microsoft SQL Server Management Studio - Query</ApplicationName>
|
||||||
|
</ConnectionNode>
|
||||||
|
</Items>
|
||||||
|
</LogicalFolder>
|
||||||
|
<LogicalFolder Name="Queries" Type="0" Sorted="true">
|
||||||
|
<Items>
|
||||||
|
<FileNode Name="check sql server logs.sql">
|
||||||
|
<AssociatedConnectionMoniker />
|
||||||
|
<AssociatedConnSrvName />
|
||||||
|
<AssociatedConnUserName />
|
||||||
|
<FullPath>check sql server logs.sql</FullPath>
|
||||||
|
</FileNode>
|
||||||
|
<FileNode Name="last backups.sql">
|
||||||
|
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:hcimon:True</AssociatedConnectionMoniker>
|
||||||
|
<AssociatedConnSrvName>hcimon</AssociatedConnSrvName>
|
||||||
|
<AssociatedConnUserName />
|
||||||
|
<FullPath>last backups.sql</FullPath>
|
||||||
|
</FileNode>
|
||||||
|
</Items>
|
||||||
|
</LogicalFolder>
|
||||||
|
<LogicalFolder Name="Miscellaneous" Type="3" Sorted="true">
|
||||||
|
<Items />
|
||||||
|
</LogicalFolder>
|
||||||
|
</Items>
|
||||||
|
</SqlWorkbenchSqlProject>
|
||||||
42
OCTPDBA-496 - Validate ssl deactivation/SQLQuery6.sql
Normal file
42
OCTPDBA-496 - Validate ssl deactivation/SQLQuery6.sql
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
WITH LastBackUp AS
|
||||||
|
(
|
||||||
|
SELECT bs.database_name,
|
||||||
|
bs.backup_size,
|
||||||
|
bs.backup_start_date,
|
||||||
|
bmf.physical_device_name,
|
||||||
|
bs.[name],
|
||||||
|
Position = ROW_NUMBER() OVER( PARTITION BY bs.database_name ORDER BY bs.backup_start_date DESC )
|
||||||
|
FROM msdb.dbo.backupmediafamily bmf
|
||||||
|
JOIN msdb.dbo.backupmediaset bms ON bmf.media_set_id = bms.media_set_id
|
||||||
|
JOIN msdb.dbo.backupset bs ON bms.media_set_id = bs.media_set_id
|
||||||
|
WHERE bs.[type] = 'D'
|
||||||
|
AND bs.is_copy_only = 0
|
||||||
|
)
|
||||||
|
,lastBkpYesterday AS (
|
||||||
|
SELECT bs.database_name,
|
||||||
|
bs.backup_size,
|
||||||
|
bs.backup_start_date,
|
||||||
|
bmf.physical_device_name,
|
||||||
|
bs.[name],
|
||||||
|
Position = ROW_NUMBER() OVER( PARTITION BY bs.database_name ORDER BY bs.backup_start_date DESC )
|
||||||
|
FROM msdb.dbo.backupmediafamily bmf
|
||||||
|
JOIN msdb.dbo.backupmediaset bms ON bmf.media_set_id = bms.media_set_id
|
||||||
|
JOIN msdb.dbo.backupset bs ON bms.media_set_id = bs.media_set_id
|
||||||
|
WHERE bs.[type] = 'D'
|
||||||
|
AND bs.is_copy_only = 0
|
||||||
|
AND bs.backup_start_date < DATEADD(DAY, -1, CAST(CURRENT_TIMESTAMP AS DATE))
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
sd.name AS [Database],
|
||||||
|
REPLACE(REPLACE(CONVERT(VARCHAR(100), CONVERT(MONEY, lb.backup_size / 1048576), 1),',',''''),'.00','') AS [backup size MB],
|
||||||
|
lb.backup_start_date AS [Last Full DB Backup Date],
|
||||||
|
lb.physical_device_name AS [Last Backup File Location],
|
||||||
|
lby.backup_start_date AS [Previous Full DB Backup Date],
|
||||||
|
lb.physical_device_name AS [Previous Backup File Location],
|
||||||
|
lb.[name] AS [last backup name],
|
||||||
|
lby.[name] AS [Previous last backup name]
|
||||||
|
FROM sys.databases AS sd
|
||||||
|
LEFT JOIN LastBackUp AS lb ON sd.name = lb.database_name AND lb.Position = 1
|
||||||
|
LEFT JOIN lastBkpYesterday lby ON sd.name=lby.database_name and lby.Position=1
|
||||||
|
ORDER BY [Database];
|
||||||
|
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
IF OBJECT_ID('tempdb..#errorLog')IS NOT NULL BEGIN;
|
||||||
|
DROP TABLE #errorLog;
|
||||||
|
END;
|
||||||
|
|
||||||
|
DECLARE @loop INT = 0;
|
||||||
|
CREATE TABLE #errorLog (
|
||||||
|
LogDate DATETIME NOT NULL
|
||||||
|
, src VARCHAR(20)
|
||||||
|
, ProcessInfo VARCHAR(64)
|
||||||
|
, [Text] VARCHAR(MAX)
|
||||||
|
);
|
||||||
|
|
||||||
|
WHILE @loop < 7
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO [#errorLog] ([LogDate],
|
||||||
|
[ProcessInfo],
|
||||||
|
[Text])
|
||||||
|
EXEC [sys].[sp_readerrorlog]
|
||||||
|
@p1 = @loop -- specify the log number or use nothing for active error log
|
||||||
|
,@p2 = 1 --error log
|
||||||
|
;
|
||||||
|
UPDATE [#errorLog] SET [src] = 'db'
|
||||||
|
WHERE [src] IS NULL;
|
||||||
|
|
||||||
|
INSERT INTO [#errorLog] ([LogDate],
|
||||||
|
[ProcessInfo],
|
||||||
|
[Text])
|
||||||
|
EXEC [sys].[sp_readerrorlog]
|
||||||
|
@p1 = @loop -- specify the log number or use nothing for active error log
|
||||||
|
,@p2 = 2 --agent log
|
||||||
|
;
|
||||||
|
UPDATE [#errorLog] SET [src] = 'agent'
|
||||||
|
WHERE [src] IS NULL;
|
||||||
|
|
||||||
|
SET @loop = @loop + 1;
|
||||||
|
END
|
||||||
|
|
||||||
|
SELECT *
|
||||||
|
FROM #errorLog a
|
||||||
|
WHERE a.[LogDate] > '20230213 20:00:00'
|
||||||
|
--AND EXISTS (SELECT *
|
||||||
|
-- FROM #errorLog b
|
||||||
|
-- WHERE [Text] like 'Error:%'
|
||||||
|
-- AND a.LogDate = b.LogDate
|
||||||
|
-- AND a.ProcessInfo = b.ProcessInfo)
|
||||||
|
--AND a.[LogDate] > '20230213 20:00:00' --report that the ssl / tls was deactivated
|
||||||
|
--AND (a.[Text] like '%Error:%' OR [a].[Text] LIKE '%warning%')
|
||||||
|
ORDER BY [a].[LogDate], [a].[src] ASC
|
||||||
|
;
|
||||||
52
OCTPDBA-496 - Validate ssl deactivation/last backups.sql
Normal file
52
OCTPDBA-496 - Validate ssl deactivation/last backups.sql
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
WITH LastBackUp AS
|
||||||
|
(
|
||||||
|
SELECT bs.database_name,
|
||||||
|
bs.backup_size,
|
||||||
|
bs.backup_start_date,
|
||||||
|
bmf.physical_device_name,
|
||||||
|
bs.[name],
|
||||||
|
Position = ROW_NUMBER() OVER( PARTITION BY bs.database_name ORDER BY bs.backup_start_date DESC )
|
||||||
|
FROM msdb.dbo.backupmediafamily bmf
|
||||||
|
JOIN msdb.dbo.backupmediaset bms ON bmf.media_set_id = bms.media_set_id
|
||||||
|
JOIN msdb.dbo.backupset bs ON bms.media_set_id = bs.media_set_id
|
||||||
|
WHERE bs.[type] = 'D'
|
||||||
|
AND bs.is_copy_only = 0
|
||||||
|
)
|
||||||
|
,lastBkpYesterday AS (
|
||||||
|
SELECT bs.database_name,
|
||||||
|
bs.backup_size,
|
||||||
|
bs.backup_start_date,
|
||||||
|
bmf.physical_device_name,
|
||||||
|
bs.[name],
|
||||||
|
Position = ROW_NUMBER() OVER( PARTITION BY bs.database_name ORDER BY bs.backup_start_date DESC )
|
||||||
|
FROM msdb.dbo.backupmediafamily bmf
|
||||||
|
JOIN msdb.dbo.backupmediaset bms ON bmf.media_set_id = bms.media_set_id
|
||||||
|
JOIN msdb.dbo.backupset bs ON bms.media_set_id = bs.media_set_id
|
||||||
|
OUTER APPLY(
|
||||||
|
SELECT bs.backup_start_date,
|
||||||
|
Position = ROW_NUMBER() OVER( PARTITION BY bs.database_name ORDER BY bs.backup_start_date DESC )
|
||||||
|
FROM msdb.dbo.backupmediafamily bmf
|
||||||
|
JOIN msdb.dbo.backupmediaset bms ON bmf.media_set_id = bms.media_set_id
|
||||||
|
JOIN msdb.dbo.backupset bs ON bms.media_set_id = bs.media_set_id
|
||||||
|
WHERE bs.[type] = 'D'
|
||||||
|
AND bs.is_copy_only = 0
|
||||||
|
)la
|
||||||
|
WHERE bs.[type] = 'D'
|
||||||
|
AND la.[Position] = 1
|
||||||
|
AND bs.is_copy_only = 0
|
||||||
|
AND bs.backup_start_date < DATEADD(HOUR, -5, la.[backup_start_date])
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
sd.name AS [Database],
|
||||||
|
REPLACE(REPLACE(CONVERT(VARCHAR(100), CONVERT(MONEY, lb.backup_size / 1048576), 1),',',''''),'.00','') AS [backup size MB],
|
||||||
|
lb.backup_start_date AS [Last Full DB Backup Date],
|
||||||
|
lb.physical_device_name AS [Last Backup File Location],
|
||||||
|
lby.backup_start_date AS [Previous Full DB Backup Date],
|
||||||
|
lb.physical_device_name AS [Previous Backup File Location],
|
||||||
|
lb.[name] AS [last backup name],
|
||||||
|
lby.[name] AS [Previous last backup name]
|
||||||
|
FROM sys.databases AS sd
|
||||||
|
LEFT JOIN LastBackUp AS lb ON sd.name = lb.database_name AND lb.Position = 1
|
||||||
|
LEFT JOIN lastBkpYesterday lby ON sd.name=lby.database_name and lby.Position=1
|
||||||
|
ORDER BY [Database];
|
||||||
|
|
||||||
119
OCTPDBA-496 - Validate ssl deactivation/todo.txt
Normal file
119
OCTPDBA-496 - Validate ssl deactivation/todo.txt
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
US: https://galenica.atlassian.net/browse/OCTPDBA-496
|
||||||
|
|
||||||
|
Scope
|
||||||
|
Central GCM N+1
|
||||||
|
ssunbqmsdb02.sunstore.ch\apssql
|
||||||
|
=> pas mal de choses dans log appl, mais pas relevantes
|
||||||
|
InsufficientMemoryException dans service '/MonitoringDataCentralWebService/MonitoringDataCentralWebService.svc'
|
||||||
|
arizona broker => Dongle Key not found (internal error : 3).
|
||||||
|
broker sql server => Event notification 'SQLWEP_8E2F34CC_4597_433C_8375_9F2E7BCA744E' in database 'master' dropped due to send time service broker errors. Check to ensure the conversation handle, service broker contract, and service specified in the event notification are active.
|
||||||
|
|
||||||
|
Pharmacy N+1
|
||||||
|
in 22.1 version
|
||||||
|
ama707aps.amavita.ch\apssql
|
||||||
|
=> ras log app
|
||||||
|
|
||||||
|
in 23.1 version
|
||||||
|
ama705aps.amavita.ch\apssql
|
||||||
|
|
||||||
|
POS N+1
|
||||||
|
|
||||||
|
in 22.1 version
|
||||||
|
wam707a02
|
||||||
|
=> win app log:
|
||||||
|
svc DNSyncService: Synchronization faild due to connection errors. Service will retry synchronization at 17.02.2023 15:42:51. Exception: Une connexion a été établie avec le serveur, mais une erreur s'est ensuite produite pendant le processus d'ouverture de session. (provider: SSL Provider, error: 0 - Le client et le serveur ne peuvent pas communiquer car ils ne possèdent aucun algorithme commun.)
|
||||||
|
Service COC.DOCUNIZE, emplacement C:\Program Files\COC AG\DOCUNIZE.2020
|
||||||
|
|
||||||
|
in 23.1 version
|
||||||
|
CAMA70533287T02
|
||||||
|
=> win app log comme sur wam707a02
|
||||||
|
|
||||||
|
Address Repository N+1
|
||||||
|
SSUNBQMSREF02\TAM000REF
|
||||||
|
==> permission denied rdp, pas pu vérifier les logs windows
|
||||||
|
|
||||||
|
Datamart N+1
|
||||||
|
SWDITST01\TGALKON
|
||||||
|
=> ras
|
||||||
|
|
||||||
|
TriaFACT N+1
|
||||||
|
SWTFQMS01\TGALTFAC
|
||||||
|
=> erreurs de repli, schémas je pense mais message tronqué
|
||||||
|
Replication-Replication Merge Subsystem: agent SWTFQMS01\TGALTFAC-olpDirectory-OlpDirectory_MergePub-SWTFQMS01\TGALTFAC-14 failed. The schema script ' if object_id(N'[dbo].[FK_UserProfileUser]') is null if object_id(N'[dbo].[User]') is not null exec('ALTER TABLE [dbo].[User] WITH CHECK ADD CONSTRAINT [FK_UserProfileUser] FOREIGN KEY([UserProfileId])
|
||||||
|
REFERENCES [dbo].[UserProfile] (
|
||||||
|
|
||||||
|
Gaia / triafin
|
||||||
|
SWGCMQMS01\TGALCTP
|
||||||
|
=> ras
|
||||||
|
|
||||||
|
J2I N+1
|
||||||
|
SWINDA01\APSTEST
|
||||||
|
=> pas mal d'erreurs dans le app log, mais pas forcément reliées:
|
||||||
|
Error in GetXML4InvoiceError : This barcode does not exists !
|
||||||
|
Error in GetXML4InvoiceError : This barcode is not for this user !
|
||||||
|
Error in GetXML4InvoiceError : Multiple scan is not authorized for the same barcode extraction !
|
||||||
|
Error calling the Web serviceTimeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
|
||||||
|
|
||||||
|
|
||||||
|
Pricing N+1
|
||||||
|
SWOPXQMS01\TGALOLPP01
|
||||||
|
=> ras
|
||||||
|
|
||||||
|
triascan
|
||||||
|
SWSCANTST01\TAMASCAN
|
||||||
|
=> ras
|
||||||
|
|
||||||
|
Les serveurs suivant n'ont pas été switchés, ils sont intouchés
|
||||||
|
|
||||||
|
|
||||||
|
PharmINDEX N+1 (pas de N+? selon la liste des instances. uniquement prod.)
|
||||||
|
|
||||||
|
|
||||||
|
DBA N+1 (seulement N+2 selon la liste des instances)
|
||||||
|
swdbasqltst01.centralinfra.net\apssql
|
||||||
|
|
||||||
|
Atlas N+1
|
||||||
|
swatldev01.centralinfra.net\TGALATLAS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TODO:
|
||||||
|
Check des logs windows:
|
||||||
|
central 888:
|
||||||
|
* SYNCHRO EXCEPTION
|
||||||
|
Program name : C:\Program Files (x86)\Triamun\APSSynchroExtract\bin\apsSynchroExtract.exe
|
||||||
|
Message : Error during database connection - Tried to connect to the database unsuccessfully 3 time(s) [DBNETLIB][ConnectionOpen (SECCreateCredentials()).]SSL Security error
|
||||||
|
|
||||||
|
* 2023-02-15 10:14:19,954 [6] FATAL Hci.ServiceManagerCore.PluginManager [(null)] - Plug-in 'LoyaltyCheckService' with schedule '0 0 19' failed to start.
|
||||||
|
System.InvalidOperationException: Cannot find the X.509 certificate using the following search criteria: StoreName 'My', StoreLocation 'LocalMachine', FindType 'FindByTemplateName', FindValue 'TriaPharmSslGalenica'.
|
||||||
|
|
||||||
|
* broker arizona pas à jour
|
||||||
|
test depuis le pc de Roland Berger ok, probablement un soucis native client ou oledb. voir avec RTC.
|
||||||
|
2 versions de "ole db" installées. "OLE DB provider" ko, "OLE DB driver" ok. J'ai demandé à Roland si il peut me dire quel provider est utilisé dans le broker, mais il n'a pas les sources
|
||||||
|
Il cherche a les trouver.
|
||||||
|
J'ai essayé de feinter en spécifiant le provider dans la config du broker après le host auxquel on se connecte, mais l'application fait une erreur comme quoi il y a
|
||||||
|
un autre provider enregistré.
|
||||||
|
Une solution si on n'a pas les sources serait de supprimer le check au broker dans apsSynchroExtract peut-être ?
|
||||||
|
|
||||||
|
SSUNBREFDE02
|
||||||
|
eventvwr:
|
||||||
|
* Event notification 'SQLWEP_4C0433FF_A1BF_4C23_9E97_09DAD1D3D1AE' in database 'master' dropped due to send time service broker errors. Check to ensure the conversation handle, service broker contract, and service specified in the event notification are active.
|
||||||
|
* Failure to send an event notification instance of type 'AUDIT_BACKUP_RESTORE_EVENT' on conversation handle '{C3061AAC-78A4-ED11-A2E2-0050568686ED}'. Error Code = '8429'.
|
||||||
|
log sql:
|
||||||
|
* Closed event notification conversation endpoint with handle '{C6061AAC-78A4-ED11-A2E2-0050568686ED}', due to the following error: '<?xml version="1.0"?><Error xmlns="http://schemas.microsoft.com/SQL/ServiceBroker/Error"><Code>-8470</Code><Description>Remote service has been dropped.</Description></Error>'.
|
||||||
|
|
||||||
|
|
||||||
|
Check des logs sql server avec erreurs depuis le 13.02.2023 20:00
|
||||||
|
Ne montre rien de probant. Des erreurs de logins (pwd incorrect) sur les pos, des erreurs de replication
|
||||||
|
|
||||||
|
Check des jobs en erreur depuis le 13.02.2023 20:00
|
||||||
|
Des deadlock, des labels en erreur (traité ce matin) mais rien de probant
|
||||||
|
|
||||||
|
linked servers
|
||||||
|
tout semble ok.
|
||||||
|
|
||||||
|
Backups commvault
|
||||||
|
Logs des backups ok en pharmacies.
|
||||||
|
|
||||||
|
Brocker
|
||||||
|
|
||||||
47
TMP - check ama azCust rows missing in SUN.sql
Normal file
47
TMP - check ama azCust rows missing in SUN.sql
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/* Run this script in amacent to check if there are rows coming from the "accounting turnover" job that are still missing on the sun central */
|
||||||
|
USE ArizonaCUST
|
||||||
|
|
||||||
|
SELECT COUNT(1) AS missingRows, 'CRSO_Cent' AS [table]
|
||||||
|
FROM dbo.CRSO_Cent c
|
||||||
|
WHERE NOT EXISTS(
|
||||||
|
SELECT 1
|
||||||
|
FROM sunaps.ArizonaCUST.dbo.CRSO_Cent t
|
||||||
|
WHERE t.CRSO_SUB_code = c.CRSO_SUB_code
|
||||||
|
AND t.CRSO_OU_code = c.CRSO_OU_code
|
||||||
|
AND t.CRSO_Value_date = c.CRSO_Value_date
|
||||||
|
)
|
||||||
|
|
||||||
|
UNION
|
||||||
|
|
||||||
|
SELECT COUNT(1) AS missingRows, 'CRMCRD_Cent' AS [table]
|
||||||
|
FROM [dbo].[CRMCRD_Cent] c
|
||||||
|
WHERE NOT EXISTS(
|
||||||
|
SELECT 1
|
||||||
|
FROM SUNAPS.ArizonaCUST.dbo.[CRMCRD_Cent] t
|
||||||
|
WHERE c.[CRMCRD_SUB_code] = t.[CRMCRD_SUB_code]
|
||||||
|
AND c.[CRMCRD_OU_code] = t.[CRMCRD_OU_code]
|
||||||
|
AND c.[CRMCRD_CRMCR_GUID] = t.[CRMCRD_CRMCR_GUID]
|
||||||
|
)
|
||||||
|
|
||||||
|
UNION
|
||||||
|
|
||||||
|
SELECT COUNT(1) AS missingRows, 'DHICI_Cent' AS [table]
|
||||||
|
FROM [dbo].DHICI_Cent c
|
||||||
|
WHERE NOT EXISTS(
|
||||||
|
SELECT 1
|
||||||
|
FROM SUNAPS.ArizonaCUST.dbo.DHICI_Cent t
|
||||||
|
WHERE c.DHICI_SUB_code = t.DHICI_SUB_code
|
||||||
|
AND c.DHICI_OU_code = t.DHICI_OU_code
|
||||||
|
AND c.DHICI_DH_value_date = t.DHICI_DH_value_date
|
||||||
|
)
|
||||||
|
|
||||||
|
UNION
|
||||||
|
|
||||||
|
SELECT COUNT(1) AS missingRows, 'FM_Cent' as [table]
|
||||||
|
FROM [dbo].FM_Cent c
|
||||||
|
WHERE NOT EXISTS(
|
||||||
|
SELECT 1
|
||||||
|
FROM SUNAPS.ArizonaCUST.dbo.FM_Cent t
|
||||||
|
WHERE c.FM_SUB_code = t.FM_SUB_code
|
||||||
|
AND c.FM_OU_code = t.FM_OU_code
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user