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)
|
||||
DECLARE @allJobs BIT = 0;
|
||||
DECLARE @allJobs BIT = 01;
|
||||
DECLARE @jobs TABLE (
|
||||
[name] sysname NOT NULL
|
||||
,[job_id] UNIQUEIDENTIFIER NOT NULL
|
||||
@@ -83,5 +83,4 @@ SELECT
|
||||
JOIN [msdb].[dbo].[sysjobs_view] [j]
|
||||
ON [ja].[job_id] = [j].[job_id]
|
||||
WHERE [ja].[session_id] = (SELECT MAX([session_id])FROM [msdb].[dbo].[sysjobactivity])
|
||||
ORDER BY [job_name]
|
||||
,[job_status];
|
||||
ORDER BY [job_status] DESC,[last_run_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>
|
||||
<ApplicationName>Microsoft SQL Server Management Studio - Query</ApplicationName>
|
||||
</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>
|
||||
</LogicalFolder>
|
||||
<LogicalFolder Name="Queries" Type="0" Sorted="true">
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
USE Arizona;
|
||||
GO
|
||||
|
||||
DELETE FROM upd.IA_IndexesAlignementActions
|
||||
DELETE FROM upd.IA_IndexAlignementActions
|
||||
WHERE IA_schema_name = 'dbo.Criteria';
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
WITH ColInfo
|
||||
AS (SELECT TblName = o.name,
|
||||
SchemaTbl = s.name + '.' + o.name,
|
||||
IndexName = i.name,
|
||||
AS (SELECT TblName = [o].[name],
|
||||
SchemaTbl = s.name + '.' + [o].[name],
|
||||
IndexName = [i].[name],
|
||||
s.name AS schemaName,
|
||||
IsPrimaryKey = i.is_primary_key,
|
||||
IsUniqueConstraint = i.is_unique_constraint,
|
||||
@@ -21,29 +21,29 @@ AS (SELECT TblName = o.name,
|
||||
END AS is_clustered,
|
||||
ColName = c.name,
|
||||
IsComputedCol = c.is_computed,
|
||||
IsIncludedCol = ic.is_included_column,
|
||||
ic.key_ordinal,
|
||||
IsIncludedCol = [ic].is_included_column,
|
||||
[ic].key_ordinal,
|
||||
FilterDefinition = i.filter_definition,
|
||||
i.object_id,
|
||||
i.ignore_dup_key,
|
||||
i.fill_factor,
|
||||
i.is_padded
|
||||
FROM sys.objects o
|
||||
JOIN sys.schemas s
|
||||
FROM [sys].objects o
|
||||
JOIN [sys].schemas s
|
||||
ON o.schema_id = s.schema_id
|
||||
JOIN sys.columns c
|
||||
JOIN [sys].columns c
|
||||
ON o.object_id = c.object_id
|
||||
JOIN sys.indexes i
|
||||
JOIN [sys].indexes i
|
||||
ON c.object_id = i.object_id
|
||||
JOIN sys.index_columns ic
|
||||
ON i.index_id = ic.index_id
|
||||
AND o.object_id = ic.object_id
|
||||
AND c.column_id = ic.column_id
|
||||
WHERE o.name = 'criteria'
|
||||
JOIN [sys].index_columns ic
|
||||
ON i.index_id = [ic].index_id
|
||||
AND o.object_id = [ic].object_id
|
||||
AND c.column_id = [ic].column_id
|
||||
WHERE [o].[name] = 'criteria'
|
||||
AND s.name = 'dbo')
|
||||
SELECT DISTINCT
|
||||
'
|
||||
INSERT INTO arizona.upd.IA_IndexesAlignementActions
|
||||
INSERT INTO arizona.upd.IA_IndexAlignementActions
|
||||
(
|
||||
IA_executionDate,
|
||||
IA_schema_name,
|
||||
@@ -65,16 +65,17 @@ INSERT INTO arizona.upd.IA_IndexesAlignementActions
|
||||
IA_actualColumns,
|
||||
IA_actualIncludedColumns,
|
||||
IA_statusMsg,
|
||||
IA_index_options
|
||||
IA_index_options,
|
||||
IA_reference
|
||||
)
|
||||
SELECT
|
||||
NULL as IA_executionDate,
|
||||
''' + x.schemaName + ''' as IA_schema_name,
|
||||
''' + x.TblName + ''' as IA_table_name,
|
||||
''' + [x].schemaName + ''' as IA_schema_name,
|
||||
''' + [x].TblName + ''' as IA_table_name,
|
||||
''' + c.IndexColumns + ''' as IA_columns_name,
|
||||
0 as IA_is_clustered,
|
||||
' + CASE
|
||||
WHEN x.IsUnique = 0 THEN
|
||||
WHEN [x].IsUnique = 0 THEN
|
||||
'0'
|
||||
ELSE
|
||||
'1'
|
||||
@@ -87,7 +88,7 @@ SELECT
|
||||
END + ' as IA_included_columns,
|
||||
0 as IA_is_to_be_deleted,
|
||||
0 as IA_is_to_be_recreated,
|
||||
''' + x.IndexName
|
||||
''' + [x].IndexName
|
||||
+ ''' as IA_expected_index_name,
|
||||
NULL as IA_foundIndexName,
|
||||
0 as IA_wasIndexFound,
|
||||
@@ -100,28 +101,29 @@ SELECT
|
||||
NULL as IA_actualIncludedColumns,
|
||||
NULL as IA_statusMsg,
|
||||
''' + CASE
|
||||
WHEN INDEXPROPERTY(x.object_id, x.IndexName, 'IsStatistics') = 1 THEN
|
||||
WHEN INDEXPROPERTY([x].object_id, [x].IndexName, 'IsStatistics') = 1 THEN
|
||||
'STATISTICS_NORECOMPUTE = ON, '
|
||||
ELSE
|
||||
'STATISTICS_NORECOMPUTE = OFF, '
|
||||
END + CASE
|
||||
WHEN x.ignore_dup_key = 1 THEN
|
||||
WHEN [x].ignore_dup_key = 1 THEN
|
||||
'IGNORE_DUP_KEY = ON, '
|
||||
ELSE
|
||||
'IGNORE_DUP_KEY = OFF, '
|
||||
END + CASE
|
||||
WHEN x.is_padded = 1 THEN
|
||||
WHEN [x].is_padded = 1 THEN
|
||||
'PAD_INDEX = ON,'
|
||||
ELSE
|
||||
''
|
||||
END + 'SORT_IN_TEMPDB = OFF, FILLFACTOR =' + CAST(x.fill_factor AS VARCHAR(3))
|
||||
+ ''' as IA_index_options
|
||||
END + 'SORT_IN_TEMPDB = OFF, FILLFACTOR =' + CAST([x].fill_factor AS VARCHAR(3))
|
||||
+ ''' as IA_index_options,
|
||||
NULL as IA_reference
|
||||
WHERE NOT EXISTS(
|
||||
SELECT 1
|
||||
FROM arizona.upd.IA_IndexesAlignementActions s
|
||||
FROM arizona.upd.IA_IndexAlignementActions s
|
||||
WHERE s.IA_executionDate IS NULL
|
||||
AND s.IA_schema_name = ''' + x.schemaName + '''
|
||||
AND s.IA_table_name = ''' + x.TblName + '''
|
||||
AND s.IA_schema_name = ''' + [x].schemaName + '''
|
||||
AND s.IA_table_name = ''' + [x].TblName + '''
|
||||
AND s.IA_columns_name = ''' + c.IndexColumns + '''
|
||||
' + CASE
|
||||
WHEN ci.IncludedColumns IS NOT NULL THEN
|
||||
@@ -131,37 +133,37 @@ WHERE NOT EXISTS(
|
||||
END + '
|
||||
)
|
||||
' AS cmd,
|
||||
x.IndexName,
|
||||
[x].IndexName,
|
||||
c.IndexColumns,
|
||||
ci.IncludedColumns
|
||||
FROM ColInfo x
|
||||
CROSS APPLY
|
||||
(
|
||||
SELECT IndexColumns = STUFF(sq.strXML, 1, 2, '')
|
||||
SELECT IndexColumns = STUFF([sq].strXML, 1, 2, '')
|
||||
FROM
|
||||
(
|
||||
SELECT ', ' + ISNULL(x2.ColName, '')
|
||||
SELECT ', ' + ISNULL([x2].ColName, '')
|
||||
FROM ColInfo x2
|
||||
WHERE x.TblName = x2.TblName
|
||||
AND x.schemaName = x2.schemaName
|
||||
AND x.IndexName = x2.IndexName
|
||||
AND x2.IsIncludedCol = 0
|
||||
ORDER BY x2.key_ordinal
|
||||
WHERE [x].TblName = [x2].TblName
|
||||
AND [x].schemaName = [x2].schemaName
|
||||
AND [x].IndexName = [x2].IndexName
|
||||
AND [x2].IsIncludedCol = 0
|
||||
ORDER BY [x2].key_ordinal
|
||||
FOR XML PATH('')
|
||||
) sq(strXML)
|
||||
) c
|
||||
OUTER APPLY
|
||||
(
|
||||
SELECT IncludedColumns = STUFF(sq.strXML, 1, 2, '')
|
||||
SELECT IncludedColumns = STUFF([sq].strXML, 1, 2, '')
|
||||
FROM
|
||||
(
|
||||
SELECT ', ' + ISNULL(x2.ColName, '')
|
||||
SELECT ', ' + ISNULL([x2].ColName, '')
|
||||
FROM ColInfo x2
|
||||
WHERE x.TblName = x2.TblName
|
||||
AND x.schemaName = x2.schemaName
|
||||
AND x.IndexName = x2.IndexName
|
||||
AND x2.IsIncludedCol = 1
|
||||
ORDER BY x2.key_ordinal
|
||||
WHERE [x].TblName = [x2].TblName
|
||||
AND [x].schemaName = [x2].schemaName
|
||||
AND [x].IndexName = [x2].IndexName
|
||||
AND [x2].IsIncludedCol = 1
|
||||
ORDER BY [x2].key_ordinal
|
||||
FOR XML PATH('')
|
||||
) sq(strXML)
|
||||
) ci;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
USE Arizona;
|
||||
GO
|
||||
IF OBJECT_ID('upd.alignIndexes') IS NOT NULL
|
||||
DROP PROCEDURE [upd].alignIndexes;
|
||||
GO
|
||||
@@ -61,7 +59,7 @@ BEGIN
|
||||
DECLARE @tableName VARCHAR(100); /* used in cursor */
|
||||
DECLARE @indexFK INT; /* used in cursor */
|
||||
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 */
|
||||
[SchemaName] VARCHAR(100) NOT NULL, /* the schema the table is part of */
|
||||
@@ -104,26 +102,26 @@ BEGIN
|
||||
[IA_indexesAlignementActions],
|
||||
[SchemaName],
|
||||
[TableName],
|
||||
expectedIndexName_inp,
|
||||
columnsName_inp,
|
||||
includedColumns_inp,
|
||||
isClustered_inp,
|
||||
isUnique_inp,
|
||||
isToBeDeleted_inp,
|
||||
isToBeRecreated_inp,
|
||||
IA_index_options
|
||||
[expectedIndexName_inp],
|
||||
[columnsName_inp],
|
||||
[includedColumns_inp],
|
||||
[isClustered_inp],
|
||||
[isUnique_inp],
|
||||
[isToBeDeleted_inp],
|
||||
[isToBeRecreated_inp],
|
||||
[IA_index_options]
|
||||
)
|
||||
SELECT ia.[IA_indexesAlignementActions_id],
|
||||
ia.[IA_schema_name],
|
||||
ia.[IA_table_name],
|
||||
ia.[IA_expected_index_name],
|
||||
ia.[IA_columns_name],
|
||||
ia.[IA_included_columns],
|
||||
ia.[IA_is_clustered],
|
||||
ia.[IA_is_unique],
|
||||
ia.[IA_is_to_be_deleted],
|
||||
ia.[IA_is_to_be_recreated],
|
||||
ia.IA_index_options
|
||||
SELECT ia.[IA_indexesAlignementActionsID],
|
||||
ia.[IA_schemaName],
|
||||
ia.[IA_tableName],
|
||||
ia.[IA_expectedIndexName],
|
||||
ia.[IA_columnsName],
|
||||
ia.[IA_includedColumns],
|
||||
ia.[IA_isClustered],
|
||||
ia.[IA_isUnique],
|
||||
ia.[IA_isToBeDeleted],
|
||||
ia.[IA_isToBeRecreated],
|
||||
ia.[IA_indexOptions]
|
||||
FROM [upd].[IA_IndexesAlignementActions] ia
|
||||
WHERE ia.[IA_executionDate] IS NULL;
|
||||
|
||||
@@ -131,44 +129,44 @@ BEGIN
|
||||
/* logic checks on index definition table */
|
||||
SELECT @msg
|
||||
= @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_expected_index_name] + ']' + CHAR(13) + CHAR(10)
|
||||
+ [itm].[IA_schemaName] + '].[' + [itm].[IA_tableName] + '], expected index name ['
|
||||
+ [itm].[IA_expectedIndexName] + ']' + CHAR(13) + CHAR(10)
|
||||
FROM [upd].[IA_IndexesAlignementActions] [itm]
|
||||
JOIN
|
||||
(
|
||||
SELECT [ii].[IA_expected_index_name] AS [key]
|
||||
SELECT [ii].[IA_expectedIndexName] AS [key]
|
||||
FROM [upd].[IA_IndexesAlignementActions] [ii]
|
||||
GROUP BY [ii].[IA_expected_index_name]
|
||||
GROUP BY [ii].[IA_expectedIndexName]
|
||||
HAVING COUNT(1) > 1
|
||||
) d
|
||||
ON d.[key] = [itm].[IA_expected_index_name]
|
||||
GROUP BY [itm].[IA_schema_name],
|
||||
[itm].[IA_table_name],
|
||||
[itm].[IA_expected_index_name];
|
||||
ON d.[key] = [itm].[IA_expectedIndexName]
|
||||
GROUP BY [itm].[IA_schemaName],
|
||||
[itm].[IA_tableName],
|
||||
[itm].[IA_expectedIndexName];
|
||||
|
||||
--duplicate index key
|
||||
SELECT @msg
|
||||
= @msg + 'Duplicate index (on column definition) found in indexes definition. Table [' + [itm].[IA_schema_name]
|
||||
+ '].[' + [itm].[IA_table_name] + '], columns in index: ' + [itm].[IA_columns_name]
|
||||
= @msg + 'Duplicate index (on column definition) found in indexes definition. Table [' + [itm].[IA_schemaName]
|
||||
+ '].[' + [itm].[IA_tableName] + '], columns in index: ' + [itm].[IA_columnsName]
|
||||
+ CASE
|
||||
WHEN [itm].[IA_included_columns] IS NOT NULL THEN
|
||||
', included colum(s): ' + [itm].[IA_included_columns]
|
||||
WHEN [itm].[IA_includedColumns] IS NOT NULL THEN
|
||||
', included colum(s): ' + [itm].[IA_includedColumns]
|
||||
ELSE
|
||||
''
|
||||
END + CHAR(13) + CHAR(10)
|
||||
FROM [upd].[IA_IndexesAlignementActions] [itm]
|
||||
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]
|
||||
GROUP BY [ii].[IA_columns_name] + '_' + ISNULL([ii].[IA_included_columns], '')
|
||||
GROUP BY [ii].[IA_columnsName] + '_' + ISNULL([ii].[IA_includedColumns], '')
|
||||
HAVING COUNT(1) > 1
|
||||
) d
|
||||
ON d.[key] = [itm].[IA_columns_name] + '_' + ISNULL([itm].[IA_included_columns], '')
|
||||
GROUP BY [itm].[IA_schema_name],
|
||||
[itm].[IA_table_name],
|
||||
[itm].[IA_columns_name],
|
||||
[itm].[IA_included_columns];
|
||||
ON d.[key] = [itm].[IA_columnsName] + '_' + ISNULL([itm].[IA_includedColumns], '')
|
||||
GROUP BY [itm].[IA_schemaName],
|
||||
[itm].[IA_tableName],
|
||||
[itm].[IA_columnsName],
|
||||
[itm].[IA_includedColumns];
|
||||
|
||||
IF @msg <> ''
|
||||
BEGIN
|
||||
@@ -182,11 +180,15 @@ BEGIN
|
||||
|
||||
|
||||
/* 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
|
||||
[itm].[IA_schema_name],
|
||||
[itm].[IA_table_name],
|
||||
itm.[IA_indexesAlignementActions_id]
|
||||
[itm].[IA_schemaName],
|
||||
[itm].[IA_tableName],
|
||||
itm.[IA_indexesAlignementActionsID]
|
||||
FROM [upd].[IA_IndexesAlignementActions] [itm];
|
||||
|
||||
OPEN curIdxName;
|
||||
@@ -577,13 +579,6 @@ BEGIN
|
||||
FROM @indexesToMaintains [itm]
|
||||
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 */
|
||||
UPDATE itm
|
||||
SET [itm].[isToBeDeleted_comp] = CASE
|
||||
@@ -609,8 +604,8 @@ BEGIN
|
||||
AND [exp].[isToBeRecreated_inp] = 0
|
||||
AND
|
||||
(
|
||||
[exp].[columnsName_inp] != [act].[actualColumns_internal]
|
||||
OR [exp].[includedColumns_inp] != [act].[actualIncludedColumns_internal]
|
||||
[exp].[columnsName_inp] <> [act].[actualColumns_internal]
|
||||
OR [exp].[includedColumns_inp] <> [act].[actualIncludedColumns_internal]
|
||||
);
|
||||
|
||||
UPDATE [act]
|
||||
@@ -619,8 +614,8 @@ BEGIN
|
||||
JOIN @indexesToMaintains [act] --actual
|
||||
ON [act].[indexName] = [exp].[expectedIndexName_inp]
|
||||
WHERE (
|
||||
[exp].[columnsName_inp] != [act].[actualColumns_internal]
|
||||
OR [exp].[includedColumns_inp] != [act].[actualIncludedColumns_internal]
|
||||
[exp].[columnsName_inp] <> [act].[actualColumns_internal]
|
||||
OR [exp].[includedColumns_inp] <> [act].[actualIncludedColumns_internal]
|
||||
);
|
||||
|
||||
/* to be deleted, because different to specs. link on index columns */
|
||||
@@ -630,8 +625,8 @@ BEGIN
|
||||
JOIN @indexesToMaintains [act] --actual
|
||||
ON [act].[actualColumns_internal] = [exp].[columnsName_inp]
|
||||
WHERE (
|
||||
[exp].[columnsName_inp] != [act].[actualColumns_internal]
|
||||
OR [exp].[includedColumns_inp] != [act].[actualIncludedColumns_internal]
|
||||
[exp].[columnsName_inp] <> [act].[actualColumns_internal]
|
||||
OR [exp].[includedColumns_inp] <> [act].[actualIncludedColumns_internal]
|
||||
);
|
||||
|
||||
UPDATE [act]
|
||||
@@ -640,8 +635,8 @@ BEGIN
|
||||
JOIN @indexesToMaintains [act] --actual
|
||||
ON [act].[actualColumns_internal] = [exp].[columnsName_inp]
|
||||
WHERE (
|
||||
[exp].[columnsName_inp] != [act].[actualColumns_internal]
|
||||
OR [exp].[includedColumns_inp] != [act].[actualIncludedColumns_internal]
|
||||
[exp].[columnsName_inp] <> [act].[actualColumns_internal]
|
||||
OR [exp].[includedColumns_inp] <> [act].[actualIncludedColumns_internal]
|
||||
);
|
||||
|
||||
/* if we have both "rename" and "delete" actions, remove the "rename" action */
|
||||
@@ -794,7 +789,7 @@ BEGIN
|
||||
ia.[IA_statusMsg] = ii.statusMsg_internal
|
||||
FROM [upd].[IA_IndexesAlignementActions] ia
|
||||
JOIN @indexesToMaintains ii
|
||||
ON ii.[IA_indexesAlignementActions] = ia.[IA_indexesAlignementActions_id]
|
||||
ON ii.[IA_indexesAlignementActions] = ia.[IA_indexesAlignementActionsID]
|
||||
WHERE ia.[IA_executionDate] IS NULL;
|
||||
END;
|
||||
GO
|
||||
|
||||
@@ -1,82 +1,223 @@
|
||||
USE Arizona
|
||||
|
||||
IF OBJECT_ID('upd.IA_IndexesAlignementActions') IS NOT NULL
|
||||
DROP TABLE upd.IA_IndexesAlignementActions;
|
||||
IF OBJECT_ID('upd.IA_IndexAlignementActions') IS NOT NULL
|
||||
DROP TABLE upd.IA_IndexAlignementActions;
|
||||
GO
|
||||
|
||||
CREATE TABLE upd.IA_IndexesAlignementActions(
|
||||
IA_indexesAlignementActions_id INT NOT NULL IDENTITY(1,1)
|
||||
,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 */
|
||||
IF OBJECT_ID('upd.IA_IndexAlignementActions') IS NOT NULL
|
||||
DROP TABLE upd.IA_IndexAlignementActions;
|
||||
GO
|
||||
|
||||
/* OCTPDBA-414 */
|
||||
IF OBJECT_ID('upd.IA_IndexAlignementActions') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE upd.IA_IndexAlignementActions(
|
||||
IA_indexAlignementActionsID INT NOT NULL IDENTITY(1,1)
|
||||
,IA_executionDate DATETIME2(0) NULL /* The date and time the action was executed, null if the action is to be executed */
|
||||
,IA_schemaName VARCHAR(100) NOT NULL /* the schema the table is part of */
|
||||
,IA_tableName VARCHAR(100) NOT NULL /* On which table is the index, whithout the schema */
|
||||
,IA_columnsName VARCHAR(MAX) NOT NULL /* list all the columns of the index, in the correct orders */
|
||||
,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 NULL /* computed by the script. does this index was created on the server ? */
|
||||
,[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 NULL /* computed by the script. does this index was renamed ? */
|
||||
,[IA_wasRenamed] BIT NOT 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 ? */
|
||||
,[IA_wasDeleted] BIT NOT 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 ? */
|
||||
,[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_IndexesAlignementActions PRIMARY KEY(IA_indexesAlignementActions_id)
|
||||
,CONSTRAINT PK_IA_IndexAlignementActions PRIMARY KEY CLUSTERED(IA_indexAlignementActionsID)
|
||||
);
|
||||
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;
|
||||
END
|
||||
|
||||
CREATE UNIQUE NONCLUSTERED INDEX NCUIX_IA_IndexesAlignementActions_index_name ON upd.IA_IndexesAlignementActions(IA_expected_index_name);
|
||||
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
|
||||
|
||||
INSERT INTO upd.IA_IndexesAlignementActions (
|
||||
IA_columns_name,
|
||||
IA_is_to_be_deleted,
|
||||
IA_is_to_be_recreated,
|
||||
IA_expected_index_name,
|
||||
IA_included_columns,
|
||||
[IA_schema_name],
|
||||
[IA_table_name],
|
||||
[IA_is_clustered],
|
||||
[IA_is_unique]
|
||||
|
||||
/* 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 */
|
||||
VALUES('Entry_id',0,0,'PK_Entry_id', NULL,'dbo','entry',0,0)
|
||||
,('ET_batch_run',0,0,'NCIX_Entry_COL_ET_batch_run',NULL,'dbo','entry',0,0)
|
||||
,('ET_accounting_period',0,0,'NCIX_Entry_COL_ET_accounting_period','Entry_ID','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)
|
||||
,('ET_account, ET_document_header',0,0,'NCIX_Entry_COL_ET_account','Entry_ID','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)
|
||||
,('ET_predefined_entry',0,0,'NCIX_Entry_COL_ET_predefined_entry',NULL,'dbo','entry',0,0)
|
||||
,('ET_entry_address',0,0,'NCIX_Entry_COL_ET_entry_address',NULL,'dbo','entry',0,0)
|
||||
,('ET_currency',0,0,'NCIX_Entry_COL_ET_currency',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,'OCTPDBA-365')
|
||||
,('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,'OCTPDBA-365')
|
||||
,('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,'OCTPDBA-365')
|
||||
,('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,'OCTPDBA-365')
|
||||
,('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*/
|
||||
,('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*/
|
||||
,('ET_master_ID',1,0,'NCIX_Entry_COL_ET_master_ID',NULL,'dbo','entry',0,0)
|
||||
,('ET_bmc_user_profile',1,0,'NCIX_Entry_COL_ET_bmc_user_profile',NULL,'dbo','entry',0,0)
|
||||
,('ET_sales_tax_code',1,0,'NCIX_Entry_COL_ET_sales_tax_code',NULL,'dbo','entry',0,0)
|
||||
,('ET_APS_TS', 1, 0, 'NCIX_Entry_COL_ET_APS_TS',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,'OCTPDBA-365')
|
||||
,('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,'OCTPDBA-365')
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -4,144 +4,298 @@ BEGIN TRANSACTION;
|
||||
SET XACT_ABORT ON;
|
||||
|
||||
|
||||
INSERT INTO upd.IA_IndexesAlignementActions
|
||||
|
||||
/* OCTPDBA-414: table dbo.criteria, pharmacy only*/
|
||||
|
||||
/* CR_code, CR_criteria_type */
|
||||
INSERT INTO [Arizona].[upd].[IA_IndexAlignementActions]
|
||||
(
|
||||
IA_executionDate,
|
||||
IA_schema_name,
|
||||
IA_table_name,
|
||||
IA_columns_name,
|
||||
IA_is_clustered,
|
||||
IA_is_unique,
|
||||
IA_included_columns,
|
||||
IA_is_to_be_deleted,
|
||||
IA_is_to_be_recreated,
|
||||
IA_expected_index_name,
|
||||
IA_foundIndexName,
|
||||
IA_wasIndexFound,
|
||||
IA_wasCreated,
|
||||
IA_wasRenamed,
|
||||
IA_wasDeleted,
|
||||
IA_wasRecreated,
|
||||
IA_includedColumnsMatch,
|
||||
IA_actualColumns,
|
||||
IA_actualIncludedColumns,
|
||||
IA_statusMsg,
|
||||
IA_index_options
|
||||
[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_schema_name,
|
||||
'Criteria' AS IA_table_name,
|
||||
'CR_code, CR_criteria_type' AS IA_columns_name,
|
||||
0 AS IA_is_clustered,
|
||||
1 AS IA_is_unique,
|
||||
NULL AS IA_included_columns,
|
||||
0 AS IA_is_to_be_deleted,
|
||||
0 AS IA_is_to_be_recreated,
|
||||
'NCIX_Criteria_COL_CR_code' AS IA_expected_index_name,
|
||||
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 ,
|
||||
NULL AS IA_index_options
|
||||
UNION
|
||||
NULL as [IA_executionDate],
|
||||
'dbo' as [IA_schemaName],
|
||||
'Criteria' as [IA_tableName],
|
||||
'CR_code, CR_criteria_type' as [IA_columnsName],
|
||||
0 as [IA_isClustered],
|
||||
1 as [IA_isUnique],
|
||||
NULL as [IA_includedColumns],
|
||||
0 as [IA_isToBeRecreated],
|
||||
0 as [IA_isToBeRecreated],
|
||||
'NCIX_Criteria_COL_CR_code' 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_code, CR_criteria_type'
|
||||
AND [s].[IA_reference] = 'OCTPDBA-414'
|
||||
)
|
||||
|
||||
/* CR_criteria_type */
|
||||
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_schema_name,
|
||||
'Criteria' AS IA_table_name,
|
||||
'CR_criteria_type' AS IA_columns_name,
|
||||
0 AS IA_is_clustered,
|
||||
0 AS IA_is_unique,
|
||||
NULL AS IA_included_columns,
|
||||
0 AS IA_is_to_be_deleted,
|
||||
0 AS IA_is_to_be_recreated,
|
||||
'NCIX_Criteria_COL_CR_criteria_type' AS IA_expected_index_name,
|
||||
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 ,
|
||||
NULL AS IA_index_options
|
||||
UNION
|
||||
NULL as [IA_executionDate],
|
||||
'dbo' as [IA_schemaName],
|
||||
'Criteria' as [IA_tableName],
|
||||
'CR_criteria_type' 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_criteria_type' 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_criteria_type'
|
||||
AND [s].[IA_reference] = 'OCTPDBA-414'
|
||||
)
|
||||
|
||||
/* CR_master_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_schema_name,
|
||||
'Criteria' AS IA_table_name,
|
||||
'CR_master_ID' AS IA_columns_name,
|
||||
0 AS IA_is_clustered,
|
||||
0 AS IA_is_unique,
|
||||
NULL AS IA_included_columns,
|
||||
0 AS IA_is_to_be_deleted,
|
||||
01 AS IA_is_to_be_recreated,
|
||||
'NCIX_Criteria_COL_CR_master_ID' AS IA_expected_index_name,
|
||||
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,
|
||||
NULL AS IA_index_options
|
||||
UNION
|
||||
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_schema_name,
|
||||
'Criteria' AS IA_table_name,
|
||||
'CR_VGUID' AS IA_columns_name,
|
||||
0 AS IA_is_clustered,
|
||||
0 AS IA_is_unique,
|
||||
NULL AS IA_included_columns,
|
||||
0 AS IA_is_to_be_deleted,
|
||||
0 AS IA_is_to_be_recreated,
|
||||
'NCIX_Criteria_COL_CR_VGUID' AS IA_expected_index_name,
|
||||
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 ,
|
||||
NULL AS IA_index_options
|
||||
UNION
|
||||
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_schema_name,
|
||||
'Criteria' AS IA_table_name,
|
||||
'Criteria_ID' AS IA_columns_name,
|
||||
1 AS IA_is_clustered,
|
||||
1 AS IA_is_unique,
|
||||
NULL AS IA_included_columns,
|
||||
0 AS IA_is_to_be_deleted,
|
||||
0 AS IA_is_to_be_recreated,
|
||||
'PK_Criteria_ID' AS IA_expected_index_name,
|
||||
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 ,
|
||||
NULL AS IA_index_options
|
||||
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
|
||||
|
||||
SELECT *
|
||||
FROM upd.IA_IndexesAlignementActions;
|
||||
FROM upd.IA_IndexAlignementActions;
|
||||
|
||||
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