Difference between revisions of "Template:SQWareProduction sqwmsq RebuildIndexDatabase.ksh example"

From Wiki_dbSQWare
Jump to: navigation, search
m (Updated by BatchUser)
m (Updated by BatchUser)
Line 1: Line 1:
 
<pre>
 
<pre>
Sourcing sqwmsq_Global.lib v2024.01 SQWareProduction for MsSql (dbSQWare) ...  
+
Sourcing sqwmsq_Global.lib v2024.02 SQWareProduction for MsSql (dbSQWare) ...  
  
 
#Standard help for script sqwmsq_RebuildIndexDatabase.ksh:
 
#Standard help for script sqwmsq_RebuildIndexDatabase.ksh:
Line 9: Line 9:
  
 
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -Locale en -h
 
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -Locale en -h
#Display online help for this script with forcing of the 'en' locale (default locale managed by the variable gvsqw_Locale)
+
#Display online help for this script with forcing of the 'en' locale (by default locale managed by $gvsqw_Locale)
  
 
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -s
 
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -s
 
#Display usage examples for this script
 
#Display usage examples for this script
  
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -AddMail 'mymail1@mydomaine.com,mymail2@mydomaine.com'
+
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName>
#Add the mail list to the default address managed by the variable gvsqw_GlobalMail
+
#Generate commands but don't execute them !
 +
 
 +
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -Exec
 +
#Rebuild indexes of target database <DbName>
 +
 
 +
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -Force -Exec
 +
#Force execution of generated commands
 +
 
 +
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -Online -Exec
 +
#Reconstruit les indexes sans poser de verrous sur les tables
 +
 
 +
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -SortInTempdb -Exec
 +
#Rebuild indexes with use tempdb to store the intermediate sort results
 +
#Reduces index rebuild time, but increases the amount of temporary space disk used
 +
 
 +
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -RebuildType <type> -Exec
 +
#Exectue Rebuild of type 'all' for tables, 'index' for indexes (by default '$gvsqw_RebuildType')
  
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -SendReport
+
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -MinRatioReb <ratio> -Exec
#Send the log by email at the end of the treatment even if there is no error
+
#Rebuild indexes when avg_fragmentation_in_percent is 30% (by default $gvsqw_MinRatioRgz %)
  
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -NoMail
+
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -MinRatioRgz <ratio> -Exec
#Deactivate sendmail on error to $gvsqw_GlobalMail (by default, send on error)
+
#Reorganize indexes when avg_fragmentation_in_percent is 10% (by default $gvsqw_MinRatioReb %)
  
 
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -SizeMinIndex 100 -SizeMaxIndex 1000 -Exec
 
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -SizeMinIndex 100 -SizeMaxIndex 1000 -Exec
 
#Take into account indexes with size between 100 and 1000 Mb
 
#Take into account indexes with size between 100 and 1000 Mb
  
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -Force -Exec
+
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -AddMail 'mymail1@mydomaine.com,mymail2@mydomaine.com' -Exec
#Force execution of generated commands
+
#Add the mail list to the default address managed by the variable gvsqw_GlobalMail
 +
 
 +
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -SendReport -Exec
 +
#Send the log by email at the end of the treatment even if there is no error
  
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName>
+
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -NoMail -Exec
#Generate commands but don't execute them !
+
#Disables sending an email on error to $gvsqw_GlobalMail (by default, send on error)
  
 
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -FRT <NumericValue> -Exec
 
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -FRT <NumericValue> -Exec
#Force return code to '<NumericValue>' on error (if no error, exit 0!)
+
#Force return code to '<NumericValue>' on error (if no error, "exit 0!")
 
#You can also force return code of this script on all your
 
#You can also force return code of this script on all your
 
#environnement if you set the variable: $gvsqw_ForcedReturnCodeScript_sqwmsq_RebuildIndexDatabase=<NumericValue>
 
#environnement if you set the variable: $gvsqw_ForcedReturnCodeScript_sqwmsq_RebuildIndexDatabase=<NumericValue>
Line 39: Line 58:
  
 
#Options to generate table list with filters (you can mix all off them):
 
#Options to generate table list with filters (you can mix all off them):
$gvsqw_SybBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -IT <listtbl>
+
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -IT <listtbl> -Exec
 
#Generate table list with 'in list':
 
#Generate table list with 'in list':
 
#=> and name in ('$ListInclude')
 
#=> and name in ('$ListInclude')
$gvsqw_SybBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -ET <listtbl>
+
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -ET <listtbl> -Exec
 
#Generate table list with 'not in list':
 
#Generate table list with 'not in list':
 
#=> and name not in ('$ListExclude')
 
#=> and name not in ('$ListExclude')
$gvsqw_SybBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -IL <likeclause>
+
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -IL <likeclause> -Exec
 
#Generate table list with 'like':
 
#Generate table list with 'like':
 
#=> and name like '$LikeClause'
 
#=> and name like '$LikeClause'
$gvsqw_SybBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -EL <likeclause>
+
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -EL <likeclause> -Exec
 
#Generate table list with 'not like':
 
#Generate table list with 'not like':
 
#=> and name not like '$NotLikeClause'
 
#=> and name not like '$NotLikeClause'
$gvsqw_SybBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -W <whereclause>
+
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -W <whereclause> -Exec
 
#Generate table list with 'where clause':
 
#Generate table list with 'where clause':
 
#=> and '$WhereClause'
 
#=> and '$WhereClause'
 
 
# XXXXX : -Flag
 
# XXXXX : -Online
 
# XXXXX : -RebuildType
 
# XXXXX : -MinRatioReb
 
# XXXXX : -MinRatioRgz
 
# XXXXX : -SortInTempdb
 
  
 
</pre>
 
</pre>

Revision as of 16:10, 7 April 2024

Sourcing sqwmsq_Global.lib v2024.02 SQWareProduction for MsSql (dbSQWare) ... 

#Standard help for script sqwmsq_RebuildIndexDatabase.ksh:


$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -h
#Display online help for this script

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -Locale en -h
#Display online help for this script with forcing of the 'en' locale (by default locale managed by $gvsqw_Locale)

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -s
#Display usage examples for this script

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName>
#Generate commands but don't execute them !

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -Exec
#Rebuild indexes of target database <DbName>

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -Force -Exec
#Force execution of generated commands

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -Online -Exec
#Reconstruit les indexes sans poser de verrous sur les tables 

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -SortInTempdb -Exec
#Rebuild indexes with use tempdb to store the intermediate sort results
#Reduces index rebuild time, but increases the amount of temporary space disk used

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -RebuildType <type> -Exec
#Exectue Rebuild of type 'all' for tables, 'index' for indexes (by default '$gvsqw_RebuildType')

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -MinRatioReb <ratio> -Exec
#Rebuild indexes when avg_fragmentation_in_percent is 30% (by default $gvsqw_MinRatioRgz %)

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -MinRatioRgz <ratio> -Exec
#Reorganize indexes when avg_fragmentation_in_percent is 10% (by default $gvsqw_MinRatioReb %)

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -SizeMinIndex 100 -SizeMaxIndex 1000 -Exec
#Take into account indexes with size between 100 and 1000 Mb

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -AddMail 'mymail1@mydomaine.com,mymail2@mydomaine.com' -Exec
#Add the mail list to the default address managed by the variable gvsqw_GlobalMail

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -SendReport -Exec
#Send the log by email at the end of the treatment even if there is no error

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -NoMail -Exec
#Disables sending an email on error to $gvsqw_GlobalMail (by default, send on error)

$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -FRT <NumericValue> -Exec
#Force return code to '<NumericValue>' on error (if no error, "exit 0!")
#You can also force return code of this script on all your
#environnement if you set the variable: $gvsqw_ForcedReturnCodeScript_sqwmsq_RebuildIndexDatabase=<NumericValue>
#in configuration file $gvsqw_MsqBin/../etc_cust/sqwmsq_GlobalVar.cfg

#Options to generate table list with filters (you can mix all off them):
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -IT <listtbl> -Exec
#Generate table list with 'in list':
#=> and name in ('$ListInclude')
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -ET <listtbl> -Exec
#Generate table list with 'not in list':
#=> and name not in ('$ListExclude')
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -IL <likeclause> -Exec
#Generate table list with 'like':
#=> and name like '$LikeClause'
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -EL <likeclause> -Exec
#Generate table list with 'not like':
#=> and name not like '$NotLikeClause'
$gvsqw_MsqBin/sqwmsq_RebuildIndexDatabase.ksh -I $Alias -D <DbName> -W <whereclause> -Exec
#Generate table list with 'where clause':
#=> and '$WhereClause'