Skip to content

Commit 3e1c647

Browse files
author
Ajay Dwivedi
committed
Removed any word related to my organization name
Removed any word related to my organization name
1 parent 8a1518b commit 3e1c647

18 files changed

+52
-52
lines changed

Backup-Restore/__RefreshLogShipping__.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Get-TivoLogWalkBackupRestore
1+
# Get-contsoLogWalkBackupRestore
22
$SourceServer = 'source01';
33
$SourceDbName = 'db01';
44
$DestinationServer = 'destination01';

Baselining/Export-Excel.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SELECT @p_CheckDate as [@p_CheckDate], * FROM DBA.dbo.BlitzFirst
1010
"@;
1111

1212
$rs = Invoke-DbaQuery -SqlInstance $server -Query $tsqlQuery;
13-
$rs | Export-Excel -Path 'C:\MS-OneDrive\OneDrive - TiVo Inc\Attachments\Daily Tasks\2019 March\Cosmo-Slowness-Mar07-1630-IST.xlsx' -WorkSheetname 'BlitzFirst';
13+
$rs | Export-Excel -Path 'C:\MS-OneDrive\OneDrive - contso Inc\Attachments\Daily Tasks\2019 March\Cosmo-Slowness-Mar07-1630-IST.xlsx' -WorkSheetname 'BlitzFirst';
1414

1515
$tsqlQuery = @"
1616
DECLARE @p_CheckDate datetimeoffset
@@ -23,4 +23,4 @@ SELECT collection_Time as [@p_CheckDate], * FROM [DBA].[dbo].[WhoIsActive_Result
2323
"@;
2424

2525
$rs = Invoke-DbaQuery -SqlInstance $server -Query $tsqlQuery;
26-
$rs | Export-Excel -Path 'C:\MS-OneDrive\OneDrive - TiVo Inc\Attachments\Daily Tasks\2019 March\Cosmo-Slowness-Mar07-1630-IST.xlsx' -WorkSheetname 'WhoIsActive_ResultSets';
26+
$rs | Export-Excel -Path 'C:\MS-OneDrive\OneDrive - contso Inc\Attachments\Daily Tasks\2019 March\Cosmo-Slowness-Mar07-1630-IST.xlsx' -WorkSheetname 'WhoIsActive_ResultSets';

LogShipping/New.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ALTER PROCEDURE [dbo].[usp_GetLogWalkJobHistoryAlert_Suppress]
2121
@p_Mail_CC VARCHAR(1000) = NULL,
2222
@p_PerformAutoExecutionOfLogWalkJob BIT = 0,
2323
@p_DbName VARCHAR(125) = NULL,
24-
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@tivo.slack.com;[email protected];',
24+
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@contso.slack.com;[email protected];',
2525
@p_Help BIT = 0
2626
AS
2727
BEGIN

LogShipping/Old.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CREATE PROCEDURE [dbo].[usp_GetLogWalkJobHistoryAlert_Suppress]
2121
@p_Mail_CC VARCHAR(1000) = NULL,
2222
@p_PerformAutoExecutionOfLogWalkJob BIT = 0,
2323
@p_DbName VARCHAR(125) = NULL,
24-
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@tivo.slack.com;[email protected];',
24+
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@contso.slack.com;[email protected];',
2525
@p_Help BIT = 0
2626
AS
2727
BEGIN

LogShipping/ServiceBroker-LogWalk.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ ALTER PROCEDURE [dbo].[usp_GetLogWalkJobHistoryAlert_Suppress]
956956
@p_SendMail BIT = 0,
957957
@p_Mail_TO VARCHAR(1000) = NULL,
958958
@p_Mail_CC VARCHAR(1000) = NULL,
959-
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@tivo.slack.com;[email protected];',
959+
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@contso.slack.com;[email protected];',
960960
@p_Help BIT = 0
961961
AS
962962
BEGIN

LogShipping/v1.2 - [usp_GetLogWalkJobHistoryAlert_Suppress].sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ALTER PROCEDURE [dbo].[usp_GetLogWalkJobHistoryAlert_Suppress]
1717
@p_SendMail BIT = 0,
1818
@p_Mail_TO VARCHAR(1000) = NULL,
1919
@p_Mail_CC VARCHAR(1000) = NULL,
20-
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@tivo.slack.com;[email protected];',
20+
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@contso.slack.com;[email protected];',
2121
@p_Help BIT = 0
2222
AS
2323
BEGIN

LogShipping/v1.3 - [usp_GetLogWalkJobHistoryAlert_Suppress].sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ALTER PROCEDURE [dbo].[usp_GetLogWalkJobHistoryAlert_Suppress]
1717
@p_SendMail BIT = 0,
1818
@p_Mail_TO VARCHAR(1000) = NULL,
1919
@p_Mail_CC VARCHAR(1000) = NULL,
20-
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@tivo.slack.com;[email protected];',
20+
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@contso.slack.com;[email protected];',
2121
@p_Help BIT = 0
2222
AS
2323
BEGIN

LogShipping/v1.4 - [usp_GetLogWalkJobHistoryAlert_Suppress].sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ALTER PROCEDURE [dbo].[usp_GetLogWalkJobHistoryAlert_Suppress]
1919
@p_Mail_CC VARCHAR(1000) = NULL,
2020
@p_PerformAutoExecutionOfLogWalkJob BIT = 0,
2121
@p_DbName VARCHAR(125) = NULL,
22-
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@tivo.slack.com;[email protected];',
22+
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@contso.slack.com;[email protected];',
2323
@p_Help BIT = 0
2424
AS
2525
BEGIN

LogShipping/v1.5 - [usp_GetLogWalkJobHistoryAlert_Suppress].sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ALTER PROCEDURE [dbo].[usp_GetLogWalkJobHistoryAlert_Suppress]
1717
@p_Mail_CC VARCHAR(1000) = NULL,
1818
@p_PerformAutoExecutionOfLogWalkJob BIT = 0,
1919
@p_DbName VARCHAR(125) = NULL,
20-
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@tivo.slack.com;[email protected];',
20+
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@contso.slack.com;[email protected];',
2121
@p_Help BIT = 0
2222
AS
2323
BEGIN

LogShipping/v1.6 - [usp_GetLogWalkJobHistoryAlert_Suppress].sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ALTER PROCEDURE [dbo].[usp_GetLogWalkJobHistoryAlert_Suppress]
1717
@p_Mail_CC VARCHAR(1000) = NULL,
1818
@p_PerformAutoExecutionOfLogWalkJob BIT = 0,
1919
@p_DbName VARCHAR(125) = NULL,
20-
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@tivo.slack.com;[email protected];',
20+
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@contso.slack.com;[email protected];',
2121
@p_Help BIT = 0
2222
AS
2323
BEGIN

LogShipping/v10.0 - [usp_GetLogWalkJobHistoryAlert_Suppress].sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ALTER PROCEDURE [dbo].[usp_GetLogWalkJobHistoryAlert_Suppress]
1818
@p_Mail_CC VARCHAR(1000) = NULL,
1919
@p_PerformAutoExecutionOfLogWalkJob BIT = 0,
2020
@p_DbName VARCHAR(125) = NULL,
21-
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@tivo.slack.com;[email protected];',
21+
@p_SlackMailID VARCHAR(1000) = 'k2b0c1w9g1k7d5e0@contso.slack.com;[email protected];',
2222
@p_Help BIT = 0
2323
AS
2424
BEGIN

Misscellaneous Queries/Get-EventLog-SQLCluster.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ $a | Select-Object * | ogv
77

88
$a | Sort-Object -Property TimeGenerated | Export-Clixml -Path c:\EventLogs_ACE_Cluster.xml
99

10-
$logs = Import-Clixml 'C:\Users\adwivedi\OneDrive - TiVo Inc\Attachments\Daily Tasks\2019 Sep\EventLogs_ACE_Cluster.xml'
11-
$logs | Where-Object {$_.Source -ne 'DCOM'} | select TimeGenerated, MachineName, EventID, EntryType, Source, Message | ogv
10+
$logs = Import-Clixml 'C:\Users\adwivedi\OneDrive - contso Inc\Attachments\Daily Tasks\2019 Sep\EventLogs_ACE_Cluster.xml'
11+
$logs | Where-Object {$_.Source -ne 'DCOM'} | select TimeGenerated, MachineName, EventID, EntryType, Source, Message | ogv

Misscellaneous Queries/Tell Me About Yourself.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Tell Me About Yourself
22

3-
I have been working with TiVo as a SQL DBA for past 8 months.
3+
I have been working with contso as a SQL DBA for past 8 months.
44
During this time, apart from Day to Day DBA tasks and client assignments, I have worked on several process improvements and have received multiple appreciations from management and clients for innovation and team work.
55

6-
Prior to TiVo, I have work experience with 3 other Organizations. I started my career with TATA Consultancy Services on various roles like Data Migration Developer, Data Warehouse Developer, and Core SQL DBA. I was lucky to implement few automations there which includes dynamic template creation for Migration, TSQL Query to generate Backup/Restore without using cmdshell, and few other tasks. After 4.3 years with TCS, I later had opportunity to work with Ericsson and United Health Group. In Ericsson I took the responsibility as primary source for Query Performance Issues. Similary I was fortunate enough to save approx 1 million through Space Capacity Automation.
6+
Prior to contso, I have work experience with 3 other Organizations. I started my career with TATA Consultancy Services on various roles like Data Migration Developer, Data Warehouse Developer, and Core SQL DBA. I was lucky to implement few automations there which includes dynamic template creation for Migration, TSQL Query to generate Backup/Restore without using cmdshell, and few other tasks. After 4.3 years with TCS, I later had opportunity to work with Ericsson and United Health Group. In Ericsson I took the responsibility as primary source for Query Performance Issues. Similary I was fortunate enough to save approx 1 million through Space Capacity Automation.
77

88
Now, I am looking forward to take my career to the next level with Microsoft as Support Engineer. Within Microsoft, I will aim 'Parnter Technical Consultant' role eventually with next 5 years. Other than the work, I like to share my experience, and help SQL Server Community with technical blogs, answering on QA platform like StackOverflow, SQLServerCentral, facebook etc.
99
And finally, I love teaching and mentoring, and have been using a YouTube channel to do the same for larger audiance.

PowerShell Commands/Common-Commands.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ foreach($server in $Servers)
176176
$SqlInstance += $r;
177177
}
178178

179-
$SqlInstance | Export-Excel 'C:\temp\TivoSQLServerInventory.xlsx'
179+
$SqlInstance | Export-Excel 'C:\temp\contsoSQLServerInventory.xlsx'
180180

181181

182182
-- 17) Group-Object & Measure-Object
@@ -326,4 +326,4 @@ $BackupSizeBytes = $backup.BackupSize;
326326
"$($this.Bytes) bytes"
327327
}
328328
}
329-
$BackupSize | Add-Member -MemberType ScriptMethod -Name tostring -Value $MethodBlock -Force;
329+
$BackupSize | Add-Member -MemberType ScriptMethod -Name tostring -Value $MethodBlock -Force;

Replication-Transactional/Backup-Restore.sql

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
BACKUP DATABASE [TivoSQLInventory]
2-
TO DISK = N'G:\MSSQLData\SQL2016_Backup\TivoSQLInventory\FULL\TivoSQLInventory_FULL_20190206_225446.bak'
1+
BACKUP DATABASE [contsoSQLInventory]
2+
TO DISK = N'G:\MSSQLData\SQL2016_Backup\contsoSQLInventory\FULL\contsoSQLInventory_FULL_20190206_225446.bak'
33
WITH NO_CHECKSUM, COMPRESSION;
44

55

6-
RESTORE DATABASE [TivoSQLInventory_Ajay] FROM DISK = N'G:\MSSQLData\SQL2016_Backup\TivoSQLInventory\FULL\TivoSQLInventory_FULL_20190206_225446.bak'
6+
RESTORE DATABASE [contsoSQLInventory_Ajay] FROM DISK = N'G:\MSSQLData\SQL2016_Backup\contsoSQLInventory\FULL\contsoSQLInventory_FULL_20190206_225446.bak'
77
WITH RECOVERY
88
,STATS = 3
9-
,MOVE N'TivoSQLInventory' TO N'F:\MSSQLData\SQL2016_Data\TivoSQLInventory_Ajay.mdf'
10-
,MOVE N'TivoSQLInventory_log' TO N'F:\MSSQLData\SQL2016_Log\TivoSQLInventory_Ajay_log.ldf'
9+
,MOVE N'contsoSQLInventory' TO N'F:\MSSQLData\SQL2016_Data\contsoSQLInventory_Ajay.mdf'
10+
,MOVE N'contsoSQLInventory_log' TO N'F:\MSSQLData\SQL2016_Log\contsoSQLInventory_Ajay_log.ldf'
1111

1212
GO
1313

1414

15-
RESTORE DATABASE [TivoSQLInventory_Dev] FROM DISK = 'G:\MSSQLData\SQL2016_Backup\TivoSQLInventory_Distributor\FULL\TivoSQLInventory_Distributor_FULL_20190214_034700.bak'
15+
RESTORE DATABASE [contsoSQLInventory_Dev] FROM DISK = 'G:\MSSQLData\SQL2016_Backup\contsoSQLInventory_Distributor\FULL\contsoSQLInventory_Distributor_FULL_20190214_034700.bak'
1616
WITH RECOVERY
1717
,STATS = 3
1818
,REPLACE
19-
,MOVE N'TivoSQLInventory' TO N'F:\MSSQLData\SQL2016_Data\TivoSQLInventory_Dev.mdf'
20-
,MOVE N'TivoSQLInventory_log' TO N'F:\MSSQLData\SQL2016_Data\TivoSQLInventory_Dev_log.ldf'
19+
,MOVE N'contsoSQLInventory' TO N'F:\MSSQLData\SQL2016_Data\contsoSQLInventory_Dev.mdf'
20+
,MOVE N'contsoSQLInventory_log' TO N'F:\MSSQLData\SQL2016_Data\contsoSQLInventory_Dev_log.ldf'
2121
GO
2222

2323

SQL Jobs/GFK_FTP_Access.ps1

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$env:PSModulePath = $env:PSModulePath + ";" + "C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files\MVPSI\Modules\";
1+
$env:PSModulePath = $env:PSModulePath + ";" + "C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files\MVPSI\Modules\";
22

33
Import-Module PSFTP
44

@@ -18,13 +18,13 @@ Set-FTPConnection -Credentials $FTPCredential -Server $FTPServer -Session MyTest
1818
$Session = Get-FTPConnection -Session MyTestSession
1919

2020
$ftpFiles = Get-FTPChildItem -Session $Session #-Path /TestRootDir -Recurse -Depth 2
21-
$ftpFiles_TIVO_CE_WORLD = $ftpFiles | Where-Object {$_.Name -match "TIVO_CE_WORLD_[A-Za-z]{3}\d{2}_[A-Za-z]{3}\d{2}\.xlsx"}
21+
$ftpFiles_contso_CE_WORLD = $ftpFiles | Where-Object {$_.Name -match "contso_CE_WORLD_[A-Za-z]{3}\d{2}_[A-Za-z]{3}\d{2}\.xlsx"}
2222
$month_enum = [Ordered]@{'JAN' = 1; 'FEB' = 2; 'MAR' = 3; 'APR' = 4; 'MAY' = 5; 'JUN' = 6; 'JUL' = 7; 'AUG' = 8; 'SEP' = 9; 'OCT' = 10; 'NOV' = 11; 'DEC' = 12}
23-
$Files_TivoCeWorld = @()
24-
foreach($file in $ftpFiles_TIVO_CE_WORLD)
23+
$Files_contsoCeWorld = @()
24+
foreach($file in $ftpFiles_contso_CE_WORLD)
2525
{
2626
$filename = $file.Name;
27-
if($filename -match "TIVO_CE_WORLD_(?'Month'[A-Za-z]{3})(?'Year'\d{2})_[A-Za-z]{3}\d{2}\.xlsx")
27+
if($filename -match "contso_CE_WORLD_(?'Month'[A-Za-z]{3})(?'Year'\d{2})_[A-Za-z]{3}\d{2}\.xlsx")
2828
{
2929
$year = $Matches['Year']
3030
$month = $Matches['Month']
@@ -35,30 +35,30 @@ foreach($file in $ftpFiles_TIVO_CE_WORLD)
3535
'Month' = $month_enum["$($month)"]
3636
}
3737
$fileInfoObj = New-Object -TypeName psobject -Property $fileInfo;
38-
$Files_TivoCeWorld += $fileInfoObj
38+
$Files_contsoCeWorld += $fileInfoObj
3939
}
4040
}
4141

4242
$tsqlQuery = @"
43-
select top 1 SourceFile from [dbo].[TIVO_CE_WORLD] o
44-
where o.CollectionTime = (select max(i.CollectionTime) from [dbo].[TIVO_CE_WORLD] i)
43+
select top 1 SourceFile from [dbo].[contso_CE_WORLD] o
44+
where o.CollectionTime = (select max(i.CollectionTime) from [dbo].[contso_CE_WORLD] i)
4545
"@
4646
$queryResult = Invoke-Sqlcmd -ServerInstance $dbServer -Database $dbName -Query $tsqlQuery | Select-Object -ExpandProperty SourceFile;
4747
$SourceFile = $queryResult.Substring($queryResult.LastIndexOf('\')+1);
4848
if (-not ([string]::IsNullOrEmpty($tsqlQuery)))
4949
{
50-
if ($SourceFile -match "TIVO_CE_WORLD_(?'Month'[A-Za-z]{3})(?'Year'\d{2})_[A-Za-z]{3}\d{2}\.xlsx")
50+
if ($SourceFile -match "contso_CE_WORLD_(?'Month'[A-Za-z]{3})(?'Year'\d{2})_[A-Za-z]{3}\d{2}\.xlsx")
5151
{
5252
$SourceFile_Year = $Matches['Year']
5353
$SourceFile_Month = $month_enum["$($Matches['Month'])"]
5454
}
5555
}
5656

57-
$Files_TivoCeWorld_ToApply = $Files_TivoCeWorld | Where-Object {$_.Year -ge $SourceFile_Year -and $_.Month -gt $SourceFile_Month} | Sort-Object -Property Year, Month;
57+
$Files_contsoCeWorld_ToApply = $Files_contsoCeWorld | Where-Object {$_.Year -ge $SourceFile_Year -and $_.Month -gt $SourceFile_Month} | Sort-Object -Property Year, Month;
5858

5959
# Remove old files from disk
60-
Get-ChildItem -Path C:\temp | Where-Object {$_.Name -like '*_TIVO_CE_WORLD_*.xlsx'} | Remove-Item;
61-
foreach($file in $Files_TivoCeWorld_ToApply)
60+
Get-ChildItem -Path C:\temp | Where-Object {$_.Name -like '*_contso_CE_WORLD_*.xlsx'} | Remove-Item;
61+
foreach($file in $Files_contsoCeWorld_ToApply)
6262
{
6363
$rs = Get-FTPItem -Session $Session -Path $file.FullName -LocalPath C:\temp -Overwrite
6464
$filepath = 'C:\temp\'+$file.Name;
@@ -76,4 +76,4 @@ catch {
7676
finally {
7777
#powershell.exe -ExecutionPolicy Bypass . 'E:\MSSQLData\GFK_FTP_Access.ps1';
7878
exit $returnCode
79-
}
79+
}

SQLDBATools-Inventory/__00) Normal Queries.sql

+5-5
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ from SQLDBATools..Application as a;
6666
;WITH T_Apps AS (
6767
select [Category], [BusinessUnit], [Businessowner], [TechnicalOwner], [SecondaryTechnicalOwner]
6868
,ROW_NUMBER()over(ORDER by [Category], [BusinessUnit], [Businessowner], [TechnicalOwner], [SecondaryTechnicalOwner]) as RecordID
69-
from [DbaTestServer\SQL2016].[TivoSQLInventory].dbo.Server s
69+
from [DbaTestServer\SQL2016].[contsoSQLInventory].dbo.Server s
7070
where (s.Businessowner is not null or s.[TechnicalOwner] is not null or s.[SecondaryTechnicalOwner] is not null)
7171
group by [Category], [BusinessUnit], [Businessowner], [TechnicalOwner], [SecondaryTechnicalOwner]
7272
--order by [Category], [BusinessUnit], [Businessowner], [TechnicalOwner], [SecondaryTechnicalOwner]
@@ -78,14 +78,14 @@ where a.RecordID not in (1,3,4,7,27,29,32,36)
7878
ORDER BY a.RecordID ASC;
7979

8080
select *
81-
into #TivoSQLInventory_Server
82-
from [DbaTestServer\SQL2016].[TivoSQLInventory].dbo.Server
81+
into #contsoSQLInventory_Server
82+
from [DbaTestServer\SQL2016].[contsoSQLInventory].dbo.Server
8383

8484

8585
update s
8686
set s.ApplicationID = a.ApplicationID
8787
--select b.ServerID, b.Server, b.ShortDescription, b.AdditionalNotes, s.FQDN, a.ApplicationID
88-
from #TivoSQLInventory_Server as b
88+
from #contsoSQLInventory_Server as b
8989
inner join dbo.Application as a
9090
on a.BusinessUnit = ltrim(rtrim(b.BusinessUnit))
9191
and a.Category = ltrim(rtrim(b.Category))
@@ -134,4 +134,4 @@ END
134134

135135
CLOSE vendor_cursor;
136136
DEALLOCATE vendor_cursor;
137-
-- END: Query to Get Update Column =============================================================================
137+
-- END: Query to Get Update Column =============================================================================

SpaceCapacity-Automation/Automation - Restrict File growth.sql

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ GO
66
ALTER PROCEDURE [dbo].[usp_AnalyzeSpaceCapacity]
77
@getInfo BIT = 0, @getLogInfo BIT = 0, @volumeInfo BIT = 0, @help BIT = 0, @addDataFiles BIT = 0, @addLogFiles BIT = 0, @restrictDataFileGrowth BIT = 0, @restrictLogFileGrowth BIT = 0, @generateCapacityException BIT = 0, @unrestrictFileGrowth BIT = 0, @removeCapacityException BIT = 0, @UpdateMountPointSecurity BIT = 0, @restrictMountPointGrowth BIT = 0, @expandTempDBSize BIT = 0, @optimizeLogFiles BIT = 0, @getVolumeSpaceConsumers BIT = 0,
88
@newVolume VARCHAR(200) = NULL, @oldVolume VARCHAR(200) = NULL, @mountPointGrowthRestrictionPercent TINYINT = 79, @tempDBMountPointPercent TINYINT = NULL, @tempDbMaxSizeThresholdInGB INT = NULL, @DBs2Consider VARCHAR(1000) = NULL, @mountPointFreeSpaceThreshold_GB INT = 60
9-
,@verbose BIT = 0 ,@testAllOptions BIT = 0 ,@forceExecute BIT = 0 ,@allowMultiVolumeUnrestrictedFiles BIT = 0 ,@output4IdealScenario BIT = 0, @handleXPCmdShell BIT = 0
9+
,@verbose BIT = 0 ,@testAllOptions BIT = 0 ,@forceExecute BIT = 0 ,@allowMulcontsolumeUnrestrictedFiles BIT = 0 ,@output4IdealScenario BIT = 0, @handleXPCmdShell BIT = 0
1010
AS
1111
BEGIN
1212
/*
@@ -1266,12 +1266,12 @@ BEGIN
12661266
END
12671267

12681268
/* By default, if another unrestricted file exists in any other volume, then don't create files for that db */
1269-
IF @allowMultiVolumeUnrestrictedFiles = 1
1269+
IF @allowMulcontsolumeUnrestrictedFiles = 1
12701270
BEGIN
12711271
IF @_LogOrData = 'Log'
12721272
BEGIN
12731273
IF @verbose = 1
1274-
PRINT ' Updating #T_Files_Derived table for @allowMultiVolumeUnrestrictedFiles option.';
1274+
PRINT ' Updating #T_Files_Derived table for @allowMulcontsolumeUnrestrictedFiles option.';
12751275
UPDATE fo
12761276
SET isExisting_UnrestrictedGrowth_on_OtherVolume = 0
12771277
FROM #T_Files_Derived AS fo
@@ -2569,7 +2569,7 @@ BEGIN
25692569
--
25702570
UNION ALL
25712571
--
2572-
SELECT '@allowMultiVolumeUnrestrictedFiles','BIT','0','All creation of multiple data/log files with unrestricted growth on multiple volumes.'
2572+
SELECT '@allowMulcontsolumeUnrestrictedFiles','BIT','0','All creation of multiple data/log files with unrestricted growth on multiple volumes.'
25732573
--
25742574
UNION ALL
25752575
--
@@ -2594,7 +2594,7 @@ BEGIN
25942594
|
25952595
@addDataFiles = { 1 | 0 } ,@newVolume = <drive_name>, @oldVolume = <drive_name> [,@DBs2Consider = <comma separated database names>] [,@forceExecute = 1]
25962596
|
2597-
@addLogFiles = { 1 | 0 } ,@newVolume = <drive_name>, @oldVolume = <drive_name> [,@allowMultiVolumeUnrestrictedFiles = 1] [,@DBs2Consider = <comma separated database names>] [,@forceExecute = 1]
2597+
@addLogFiles = { 1 | 0 } ,@newVolume = <drive_name>, @oldVolume = <drive_name> [,@allowMulcontsolumeUnrestrictedFiles = 1] [,@DBs2Consider = <comma separated database names>] [,@forceExecute = 1]
25982598
|
25992599
@restrictDataFileGrowth = { 1 | 0 } ,@oldVolume = <drive_name> [,@DBs2Consider = <comma separated database names>] [,@forceExecute = 1]
26002600
|
@@ -2654,8 +2654,8 @@ BEGIN
26542654
EXEC [dbo].[usp_AnalyzeSpaceCapacity] @addLogFiles = 1 ,@newVolume = ''E:\Logs1\'' ,@oldVolume = ''E:\Logs\''
26552655
EXEC [dbo].[usp_AnalyzeSpaceCapacity] @addLogFiles = 1 ,@newVolume = ''E:\Logs1\'' ,@oldVolume = ''E:\Logs\'' ,@DBs2Consider = ''unet, Test1Db, MirrorTestDB'';
26562656
EXEC [dbo].[usp_AnalyzeSpaceCapacity] @addLogFiles = 1 ,@newVolume = ''E:\Logs1\'' ,@oldVolume = ''E:\Logs\'' ,@forceExecute = 1
2657-
EXEC [dbo].[usp_AnalyzeSpaceCapacity] @addLogFiles = 1 ,@newVolume = ''E:\Logs1\'' ,@oldVolume = ''E:\Logs\'' ,@allowMultiVolumeUnrestrictedFiles = 1
2658-
EXEC [dbo].[usp_AnalyzeSpaceCapacity] @addLogFiles = 1 ,@newVolume = ''E:\Logs1\'' ,@oldVolume = ''E:\Logs\'' ,@allowMultiVolumeUnrestrictedFiles = 1 ,@forceExecute = 1
2657+
EXEC [dbo].[usp_AnalyzeSpaceCapacity] @addLogFiles = 1 ,@newVolume = ''E:\Logs1\'' ,@oldVolume = ''E:\Logs\'' ,@allowMulcontsolumeUnrestrictedFiles = 1
2658+
EXEC [dbo].[usp_AnalyzeSpaceCapacity] @addLogFiles = 1 ,@newVolume = ''E:\Logs1\'' ,@oldVolume = ''E:\Logs\'' ,@allowMulcontsolumeUnrestrictedFiles = 1 ,@forceExecute = 1
26592659
26602660
This generates TSQL Code for add log files on @newVolume for each database on @oldVolume.
26612661
@@ -4967,4 +4967,4 @@ USE [master];
49674967

49684968
RETURN @_errorOccurred; -- 1 = Error, 0 = Success
49694969

4970-
END -- End Procedure
4970+
END -- End Procedure

0 commit comments

Comments
 (0)