Tchater maintenant avec le support
Tchattez avec un ingénieur du support

LiteSpeed for SQL Server 8.9.8 - Security and Compliance Guide

Script Maintenance Plans Tasks

You can perform various database maintenance tasks from the command line. To use the SLSSQLMaint utility, change the directory until you are in the directory containing slssqlmaint.exe. (Usually, C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\Binn).

NOTE: You can generate scripts by opening tasks in the LiteSpeed UI Console and clicking View T-SQL. About Creating Maintenance Plans

This topic covers the following:

Syntax

slssqlmaint.exe
-? | (<connection_options> <task_options>)

Connection options:

-S <server_name\instance_name>
-T | (-U <login_ID> -P <password>)

Backup Database task options (Disk):

-D <names_group_or_patterns>
-BkUpMedia DISK
-BkUpDB|-BkUpLog
( (<path_and_filename>
-BkFileName
[-NOINIT] )
| ( (-UseDefDir|<path>)
[-CrBkSubDir]
-Default <file_format> ) )
[-BkExt <extension>]
[-Differential]
[-FileGroups <filegroups>]
[-Expiration <date_time> | -Retaindays <number_of_days> ]
[-DelBkUps <number>(HOURS|DAYS|WEEKS|MONTHS|YEARS)]
[-VrfyBackup]
[-With "COPY_ONLY"]
[-AdaptiveCompression (speed|size) | -CompressionLevel <value> ]
[-Logging (0|1|2)]
[-Comment <comment>]
[-Threads <number>]
[-Throttle <value>]
[-BufferCount <number>]
[-MaxTransferSize <size>]
[-Priority (0|1|2)]
[-Affinity <mask>]
[-X
    [DISK_RETRY_COUNT <value>]
    [DISK_RETRY_WAIT <value>]]
[-CryptLevel <value>
(-jobp <encrypted_key> | -BackupKey <encryption_password>) ]
[-DblClick (1|2)]
[-OPTOLR|-NOOPTOLR]
[-Reliability (1|2|3)]
[-Mirror <path>]
[-Attached <file_or_directory>]
[-Exclude
    [Offline]
    [LogShippng]
    [ReadOnly]
    [Selected]
    [Deleted]
    [<wildcard_or_regex_pattern>]
    [IgnoreReplica
        [Primary]
        [Secondary]]

Backup Database task options (TSM or TSM Archive):

-D <names_group_or_patterns>
-BkUpMedia (TSM|TSMARCHIVE)
(-BkUpDB|-BkUpLog)
-BkFileName
[-CrBkSubDir]
-Default <file_format>
[-Differential]
[-FileGroups <filegroups>]
[-TSMClientNode <client_node>]
[-TSMClientOwnerPWD <password>]
-TSMConfigFile <path>
-TSMObjectPath <TSM_path>
[-TSMManagementClass <name>]
[-TSMDeviceTimeoutMinutes <timeout_period>]
[-VrfyBackup]
[-With "COPY_ONLY"]
[-AdaptiveCompression (speed|size) | -CompressionLevel <value> ]
[-Logging (0|1|2)]
[-Comment <comment>]
[-Threads <number>]
[-Throttle <value>]
[-BufferCount <number>]
[-MaxTransferSize <size>]
[-Priority (0|1|2)]
[-Affinity <mask>]
[-CryptLevel <value>
(-jobp <encrypted_key> | -BackupKey <encryption_password>) ]
[-Reliability (1|2|3)]
[-Attached <file_or_directory>]
[-Exclude
    [Offline]
    [LogShippng]
    [ReadOnly]
    [Selected]
    [Deleted]
    [<wildcard_or_regex_pattern>]
    [IgnoreReplica
        [Primary]
        [Secondary]]

Backup Database task options (Tape):

-D <names_group_or_patterns>
-BkUpMedia TAPE
(-BkUpDB|-BkUpLog)
<path>
-BkFileName
[-NOINIT]
[-Differential]
[-FileGroups <filegroups>]
[-Expiration <date_time> | -Retaindays <number_of_days> ]
[-VrfyBackup]
[-With "COPY_ONLY"]
[-AdaptiveCompression (speed|size) | -CompressionLevel <value> ]
[-Logging (0|1|2)]
[-Comment <comment>]
[-Threads <number>]
[-Throttle <value>]
[-BufferCount <number>]
[-MaxTransferSize <size>]
[-Priority (0|1|2)]
[-Affinity <mask>]
[-CryptLevel <value>
(-jobp <encrypted_key> | -BackupKey <encryption_password>) ]
[-Reliability (1|2|3)]
[-Attached <file_or_directory>]
[-Exclude
    [Offline]
    [LogShippng]
    [ReadOnly]
    [Selected]
    [Deleted]
    [<wildcard_or_regex_pattern>]
    [IgnoreReplica
        [Primary]
        [Secondary]]

Fast Compression task options (Disk):

-D <names_group_or_patterns>
-BkUpMedia DISK
-BkUpDB <path>
-BkFileName
[-CrBkSubDir]
[-NOINIT]
-SmartDiff <number>DAYS???
(-DataDelta <value> | -SizeDelta <value>)
[-ExcludeDays <values>]
-SingleFile (0|1)
[-RequireFull
[-AltBkpDir <path>]]
[-BackupEsc]
[-VerifyOpt (Last|FullDiff|All)]
[-NotifyOpt (Failure|Every)]
[-NotifyAgent <name>]
[-FullDiffRtn 28 ]
[-LogRtn 28]
[-AdaptiveCompression (speed|size) | -CompressionLevel <value> ]
[-Logging (0|1|2)]
[-Comment <comment>]
[-Threads <number>]
[-Throttle <value>]
[-BufferCount <number>]
[-MaxTransferSize <size>]
[-Priority (0|1|2)]
[-Affinity <mask>]
[-X
    [DISK_RETRY_COUNT <value>]
    [DISK_RETRY_WAIT <value>]]
[-CryptLevel <value>
(-jobp <encrypted_key> | -BackupKey <encryption_password>) ]
[-OPTOLR|-NOOPTOLR]
[-Reliability (1|2|3)]
[-Mirror <path>]
[-Attached <file_or_directory>]
[-Exclude
    [Offline]
    [LogShippng]
    [ReadOnly]
    [Selected]
    [Deleted]
    [<wildcard_or_regex_pattern>]
    [IgnoreReplica
        [Primary]
        [Secondary]]

Fast Compression task options (TSM):

-D <names_group_or_patterns>
-BkUpMedia DISK
-BkUpDB <path>
-BkFileName
[-CrBkSubDir]
-Default <file_format>
[-TSMClientNode <client_node>]
[-TSMClientOwnerPWD <password>]
-TSMConfigFile <path>
[-TSMObjectPath <filespace_name>]
[-TSMManagementClass <name>]
[-TSMDeviceTimeoutMinutes <timeout>]
-SmartDiff <number>DAYS???
(-DataDelta <value> | -SizeDelta <value>)
[-ExcludeDays <values>]
-SingleFile (0|1)
[-RequireFull
[-AltBkpDir <path>]]
[-BackupEsc]
[-VerifyOpt (Last|FullDiff|All)]
[-NotifyOpt (Failure|Every)]
[-NotifyAgent <name>]
[-FullDiffRtn 28 ]
[-LogRtn 28]
[-AdaptiveCompression (speed|size) | -CompressionLevel <value> ]
[-Logging (0|1|2)]
[-Comment <comment>]
[-Threads <number>]
[-Throttle <value>]
[-BufferCount <number>]
[-MaxTransferSize <size>]
[-Priority (0|1|2)]
[-Affinity <mask>]
[-CryptLevel <value>
(-jobp <encrypted_key> | -BackupKey <encryption_password>) ]
[-Reliability (1|2|3)]
[-Attached <file_or_directory>]
[-Exclude
    [Offline]
    [LogShippng]
    [ReadOnly]
    [Selected]
    [Deleted]
    [<wildcard_or_regex_pattern>]
    [IgnoreReplica
        [Primary]
        [Secondary]]

Cleanup History task options:

-CleanHis
    <number>(HOURS|DAYS|WEEKS|MONTHS|YEARS)
    [BKUP]
    [JBS]
    [MAINTPLN]
    [Activity]
    [CentralActivity]
    [PurgeInfo]
    [Logshipping]
    [Status]
    [ShrinkLog]

Cleanup Maintenance Plans task options:

-MAINTDEL
    -DelDeviceType DISK
    -DELTYPE (FileBkup|FileRpt|FileAny)
    [-DELUSEAGE
        -DELUNIT <number>
        -DELUNITTYPE (MINUTES|HOURS|DAYS|WEEKS|MONTHS|YEARS)]
    (-DELFOLDER <directory>
    -DELEXTENSION <extension>
    [-DELSUBFOLDERS]
    [-DelEmptyFolder])
    |(-DELFILE
        -DELFILEPATH <path_and_filename>)

Legacy Task options:

(-PlanID <plan_ID>|-PlanName <plan_name>)
[<backup_task_options>]
[-CkDB|-CkDBNoIdx]
[-ReorgIDX]
[<cleanup_maint_plans_task_options>]
[<clean_up_history_task_options>]
[-OpNotify <names>
    -OpMessage <message>
    -OpSubject <subject>
    -OpImportance (0|1|2)]
[-RebldIdx <1-100> ]
[-RmUnusedSpace <max_size> <free_space_to_remain>
    [NoTrunc]]
[-UpdOptiStats <number> -UpdStatsTarget (Columns|Index|All) -UpdStatsScan (FullScan|Rows|Percent)]
[-Rpt <path>.txt
[-DelTxtRpt <number><time_unit>]]
[-HtmlRpt <path>.html
[-DelHtmlRpt <number><time_unit>]]
[-To <operator_name>]
[-Writehistory]
[-LogEngine (0|1|2)]

Arguments

-Argument

Description

-AdaptiveCompression <value>

Automatically selects the optimal compression level based on CPU usage or Disk IO. For more information, see Compression Methods.

You can tell Adaptive Compression to optimize backups either for size or for speed. This argument accepts one of the following values:

  • Size
  • Speed
-AFFINITY <mask>

Specifies the affinity mask for the process. The mask is a 64-bit integer value. By default, it is 0 and will utilize all CPUs.

For more information, see Processor Affinity.

-AltBkpDir <path> Specifies the directory where to search for the backup file.

-Attached <file_or_directory>

Specifies filepaths to include in both backup and restore operations. The filepath can be either a single file or a directory. If it is a directory, then LiteSpeed recursively includes all files and subdirectories. All attached files are encrypted and compressed, with all pertinent backup parameters supported. This feature works for disk, tape, TSM, and Double Click Restore as well. You can supply multiple instances of this argument.

When used within the context of a restore operation, the path parameter can be expanded to include a new destination. This form will take the syntax of <file_path> to <new_file_path>. The new filepath can be used to specify a new location but cannot rename a file.

This argument only restores the attached files. It does not restore the database, just the files that were attached to that backup.

NOTES:

  • The original entire directory path need not be supplied (e.g. c: to c:\testadSattsm is allowed).
  • c:\testad to testadr would restore all files in directory c:\testad to c:\testadr.
-BackupEsc

This option causes LiteSpeed to issue a full backup, if one of the following problems is discovered in the current backup set:

  • The full backup is missing.
  • A differential backup is missing from the backup set (excludes backups automatically removed after the specified retention period).
  • LSN verification fails in the backup set.
  • Verify operation fails on full or differential backup.
  • Differential backup fails for reasons other than out-of-disk .

NOTE: If a problem is detected and a full backup is created through escalation, an error will be returned.

-BackupKey <encryption_password>

Type: Varchar

Value used to generate the encryption key for the encryption algorithm. If you do not supply encryption key, then the program will not encrypt the backup. If you use the wrong encryption key, the restore will fail.

Caution: When encrypting data, take care not to lose the encryption key; a backup cannot be restored or recovered without the original encryption key.

Example of key: 'Mypassword'

-BkExt <extension> Specifies the extension of the backup files.
-BkFileName Specifies that each path specified includes the filename.
-BkUpDB

Specifies the database backup type.

-BkUpLog Specifies the tlog backup type.
-BkUpMedia <value>

Specifies the backup destination. This argument accepts one of the following values:

  • DISK
  • TAPE
  • TSM
  • TSMArchive
-BkUpOnlyIfClean Specifies that the backup occurs only if any specified checks did not find problems with the data.
-BUFFERCOUNT

Specifies the number of SQL Server buffers available for a LiteSpeed operation. The default value is set by SQL Server.

-CkAl

 

-CkAlNoIdx (Legacy plans)
-CkCat  
-CkDB

(Legacy plans)Checks the allocation and structural integrity of tables and indexes.

-CkDBNoIdx (Legacy plans)Checks the allocation and structural integrity of tables.
-CKDBREPAIR Checks data and index linkage with fast repairs.
-CleanHis <values>

Enables the Cleanup History task. This argument accepts one or more of the following:

  • <number><time_unit>—Removes historical data older than specified time period. You can use one of the following time units:
    • HOURS
    • DAYS
    • WEEKS
    • MONTHS
    • YEARS
  • BKUP—Deletes back up and restore history.
  • JBS—Deletes SQL Server Agent jobs history.
  • MAINTPLN—Deletes Maintenance plans history.
  • Activity—Deletes LiteSpeed activity from the Local Repository.
  • CentralActivity—Deletes LiteSpeed activity from the Central Repository.
  • PurgeInfo—Deletes any information for deleted databases.
  • LogShipping—Deletes log shipping history.
  • Status—Deletes status history (Job, DTS, Maint Plans).
  • ShrinkLog—Shrinks the repository databases log files.
-COMMENT <comment>

Type: String

Appends a user comment to the backup.

This argument accepts variables. For more information, see LiteSpeed Variables.

-COMPRESSIONLEVEL <value>

Specifies the compression level for the backup. Valid values are 0 through 8. 0 bypasses the compression routines. The remaining values of 1 through 8 specify compression with increasingly aggressive computation. 2 is the default value for disk backups and 7 is the default value for cloud backups.

When choosing a compression level, it is best to try various options using your equipment and data to determine the best option for your environment. Use the Backup Analyzer to test the performance of different compression levels. For more information, see Test Optimal Backup Settings.

NOTE: If both the compression level and Adaptive Compression option are passed in, LiteSpeed will not error out and will select and use Adaptive Compression.

-CrBkSubDir

Creates a subdirectory for each database.

-CRYPTLEVEL <value>

Specifies the encryption level. This argument accepts one of the following values:

  • 0—40-bit RC2

  • 1—56 bit RC2

  • 2—112 bit RC2

  • 3—128 bit RC2

  • 4—168 bit 3DES

  • 5—128 bit RC4

  • 6—128 bit AES

  • 7—192 bit AES

  • 8—256 bit AES

  • 9—MS_AES_128

  • 10—MS_AES_192

  • 11—MS_AES_256

-D <names_group_or_patterns>

Specifies the database names or the following built-in database groups to include in the backup:

  • "ALL DATABASES"
  • "ALL SYSTEM DATABASES"
  • "ALL USER DATABASES"

Alternately, you can specify wildcard or regular expression patterns using one of the following formats:

  • Mask:"<wildcard_expression>"
  • Regex:"<regular_expression>"

For more information, see Use Wildcard and Regular Expressions in LiteSpeed.

-DataDelta <value>

Specifies the minimum amount of database changes required for the full backup.

Accepted values are 1-99, the default value is 35.

-DblClick

Creates a Double Click Restore executable. This argument accepts one of the following values:

  • 1—Creates one Double-Click Restore executable file. Note the following warning: The executable may be greater than 4GB for large databases. Windows Server is unable to run executable files larger than 4GB. However, the file will be convertible/restorable by LiteSpeed file.
  • 2—Creates a Double Click Restore loader in the same location. (Default)

For more information, see Double Click Restore Executables.

-Default <format>

Specifies the default file format, usually %D_%T_%Y-%m-%d-%H%M%S.%EXT%, where:

  • %D—Database name
  • %T—Backup type (Full, Diff or Log)
  • %Y-%m-%d-%H%M%S—Date and time
  • %EXT%—File extension

For more information, see LiteSpeed Variables.

-DelBkUps <number><time_unit>

Deletes old backups based on the time period specified in the format: <number><time_unit>, where the time unit is one of the following:

  • HOURS
  • DAYS
  • WEEKS
  • MONTHS
  • YEARS
-DelDeviceType DISK Specifies the device type. Currently DISK is the only supported device type.
-DelEmptyFolder Deletes empty folders.
-DelExtension <extension> Specifies the extension of the files eligible for deletion.
-DelFile Deletes a specific file.
-DelFilePath <filename> Specifies the location and name of the files.
-DelFolder <path> Deletes a specific folder.
-DelHtmlRpt <number><time_unit>

(Legacy plans)Deletes .html reports older than the given time period. This argument accepts one of the following time units:

  • HOURS
  • DAYS
  • WEEKS
  • MONTHS
  • YEARS
-DelSubFolders Deletes the first-level subfolders.
-DelTxtRpt <number><time_unit>

(Legacy plans)Deletes .txt reports older than the given time period. This argument accepts one of the following time units:

  • HOURS
  • DAYS
  • WEEKS
  • MONTHS
  • YEARS
-DelType <value>

Deletes file by type. This argument accepts one of the following values:

  • FileBkupbackup—Backup files
  • FileRptreport—Maintenance plan text reports
  • FileAny—Any file
-DelUnit Deletes files based on the file age.
-DelUnitType <value>

Specifies the unit type for file age. This argument accepts one of the following values:

  • MINUTES
  • HOURS
  • DAYS
  • WEEKS
  • MONTHS
  • YEARS
-DelUseAge Specifies the file age.
-DIFFERENTIAL Specifies that the database or file backup should consist only of the portions of the database or file changed since the last full backup. A differential backup is usually smaller than a full backup. Use this option so that all individual log backups since the last full backup do not need to be applied.
-ENCRYPTIONKEY <key>

Type: Varchar

Value used to generate the encryption key for the encryption algorithm. If you do not supply encryption key, then the program will not encrypt the backup. If you use the wrong encryption key, the restore will fail.

Caution: When encrypting data, take care not to lose the encryption key; a backup cannot be restored or recovered without the original encryption key.

Example of key: 'Mypassword'

-Exclude <values>

Excludes databases. This argument accepts one or more of the following:

  • Selected—This option will exclude databases supplied with the -D argument.
  • LogShippng
  • ReadOnly

  • Offline
  • Deleted
  • Mask:"<wildcard_expression>"—This option will exclude databases that match the specified expression.
  • Regex:"<regular_expression>"
  • IgnoreReplica—This option will ignore the preferred replica setting and will back up all replicas, unless they are excluded by the Primary and Secondary options.
  • Primary
  • Secondary
-ExcludeDays <values> Specifies days of the week when a full backup is never performed. This argument accepts one or more of the following:
  • Mn
  • Tu
  • Wd
  • Th
  • Fr
  • St
  • Sn
-Expiration <date_time>

Specifies the date and time when the backup expires. LiteSpeed will not overwrite this file until expiration datetime is passed. This argument accepts one of the following formats:

  • yyyy-mm-dd
  • yyyy-mm-dd hh:mm:ss
-FileGroups <filegroup_names>

Specifies a database filegroup to include in the backup or restore. You can supply multiple instances of this argument.

A filegroup backup is a single backup of all files in the filegroup and is equivalent to explicitly listing all files in the filegroup when creating the backup. Files in a filegroup backup can be restored individually or as a group.

-FullDiffRtn <number_of_days>

Specifies the number of units (N). The full or differential backup must be at least N units old before it is eligible for cleanup.

See BackupRetainUnits for unit types details

Note: Old argument BackupRetainDays is still supported for compatibility reasons.

-HtmlRpt <report_filename>.HTML (Legacy plans)Writes an HTML report.
-JobP <encrypted_key> Specifies an encrypted key.
-LogEngine <value>

Controls the debug logging options for a plan. This argument accepts one of the following values:

  • 0—Logging off.

  • 1 or any odd value—Logging on. Log file is removed on success.

  • 2 or any even value—Logging on.

For more information, see Reporting and Logging in Maintenance Plans.

-LOGGING <value>

Controls the logging options for backups. This argument accepts one of the following values:

  • 0—Logging off.

  • 1 or any odd value—Logging on. Log file is removed on success.

  • 2 or any even value—Logging on.

For more information, see Configure Logging in LiteSpeed.

-LogRtn <number_of_days>

Specifies the number of units (N). The t-log backup must be at least N units old before it is eligible for cleanup.

See also LogRetainUnits for unit types details

Note: Old argument @LogRetainDays is still supported for compatibility reasons.

-MAINTDEL Enables the Cleanup Maintenance Plans task.
-MAXTRANSFERSIZE <size>

Specifies the largest unit of transfer in bytes to be used between SQL Server and LiteSpeed. The possible values are multiples of 65536 bytes (64 KB) ranging up to 4,194,304 bytes (4 MB). The default is 1048576 (1 MB).

-Mirror <path> Mirrors the backup file (copies the backup to multiple locations). If you back up the primary to a set of striped files, all mirrored backups must match the primary in the number of stripes in each mirror.
-NOINIT Does not overwrite the existing backup files.
-NOOPTOLR Does not generate a map file during a backup for Object Level Recovery.
-NO_OUTPUT Does not display the output.
-NotifyAgent <operator> Specifies the operator.
-NotifyOpt <value>

Specifies the notification options after backup. This argument accepts one of the following values:

  • Every—Notify every time
  • Failure—Notify on failure only
-OpImportance <value>

Specifies whether the message is of low, high or normal importance. This argument accepts one of the following values:

  • 0—Low
  • 1—Normal
  • 2—High
-OpMessage <message> (Legacy plans)Specifies the message for the Notify Operator task.
-OpNotify <names> (Legacy plans)Specifies the operator names for the Notify Operator task.
-OpProfile <profile> (Legacy plans)Specifies operators profile.
-OpSubject <subject> (Legacy plans)Specifies the message subject for the Notify Operator task.subject
-OPTOLR

Generates a map file during a backup for Object Level Recovery.

-P <password>

Specifies the user password. Passwords are case-sensitive. Required if the connection type is not a trusted connection.

-PlanID <plan_id> Specifies GUID identifying the maintenance plan in 36 character hex format.
-PlanName <name> Specifies the maintenance plan name.
-PRIORITY <value>

Type: Integer

Specifies the priority of the LiteSpeed process compared to other processes running on the same server. This argument accepts one of the following values:

  • 0—Normal (Default)

  • 1—AboveNormal

  • 2—High

-RebldIdx <%_free_space> Drops and recreates indexes to improve performance, creates the specified amount of free space on each data page (1-100).(Legacy plans)
-Reliability <value>

Specifies whether LiteSpeed should perform checksums before writing to media and whether it should continue on error. This argument accepts one of the following values:

  • 1—Causes checksums to be verified when a LiteSpeed backup is created, LiteSpeed does not continue on error.
  • 2—Causes the backup be executed on error, checksums are not verified.
  • 3—Causes the backup be executed despite encountering an invalid backup checksum.
-ReorgIDX Defragments and compacts existing indexes to improve performance. (Legacy plans)
-RequireFull

Checks if the expected full backup exists when backing up to separate files and returns a failure message if it is not found. If the full backup file does not exist, it performs a full backup. If the full backup file does exist, the decision to perform a new full or a differential backup will depend on other conditions specified.

-Retaindays <number_of_days>

Specifies a number of days to retain the backup. LiteSpeed will not overwrite this file for this number of days. 

-RmUnusedSpace <max_size> <free_space_to_remain>

(Legacy plans) Reduces the size of data and log files in a database that grow beyond a specified size. This arguments accepts the following values:

  • Database size, in MB, when the database grows beyond this amount , it becomes eligible for shrinking. The default is 50.
  • The percentage of free space to remain after shrinking. The default is 10.
  • NoTrunc—(Optional) Returns freed space to operating system.

-Rpt <report_filename>.txt (Legacy plans)Writes a .TXT report.
-S <server_name>

Specifies the instance of Microsoft SQL Server to connect to. This argument accepts one of the following values:

  • server_name
  • server_name\instance_name

If no server is specified, the LiteSpeed command-line utility will connect to the default instance of SQL Server on the local computer.

-SingleFile <value>

This argument accepts one of the following values:

  • 0—Specifies self-contained backup set.
  • 1—Appends data to an existing full backup file.

For more information, see Fast Compression.

-SizeDelta <value>

Specifies the last differential backup size to last full backup size ratio. When exceeding the specified ratio LiteSpeed performs a full backup.

Accepted values are 1-99, the default value is 35.

-SmartDiff <number>DAYS

Specifies the minimum number of days since last full backup required to perform full backup. The default value is 14.

-SupportComputedColumn Run DBCC maintenance commands on computed columns.
-T Uses a trusted connection (to the server) instead of requiring a password.
-THREADS <number_of_threads>

Type: Integer

Determines the number of threads used for the backup or restore. You will achieve the best results by specifying multiple threads, but the exact value depends on several factors including: processors available, affinity setting, compression level, encryption settings, IO device speed, and SQL Server responsiveness. The default is n-1 threads, where n is the number of processors.

-THROTTLE <value>

Specifies the maximum CPU usage allowed. The argument accepts an integer value between 1 and 100. The default value is 100. This is the percentage of the total amount of CPU usage (across all enabled processors) available.

TIP: Before you start tuning the CPU Throttle or Affinity parameters to adjust backup performance, try limiting the number of threads. If you decide to use an affinity value other than default, it is recommended that you limit the threading as well. You may also want to consider using Adaptive Compression to maintain backup performance. For more information, see Adaptive Compression.

-To <names> (Legacy plans) Specifies operator's name.
-TSMClientNode <node_name>

Specifies the TSM server LiteSpeed connects to during backups and restores. Not required, if specified in the options file or if backing up with the Passwordaccess Generate option.

-tsmclientownername Specifies TSM client owner name.
-TSMClientOwnerPWD <password>

Specifies the TSM client owner user password. Not required, if specified in the options file or if backing up with the Passwordaccess Generate option.

-TSMConfigFile <path>

Specifies the TSM configuration file.

-TSMDeviceTimeoutMinutes <timeout>

Specifies how long to wait for a TSM device in the advent that a MAX TAPE MOUNTS EXCEEDED error is received from TSM at the start of the backup. This parameter ensures that the TSM device is acquired and dedicated to this backup before the backup actually begins. If this parameter is not set or passed in then no timeout is used and instead the backup will then fail immediately if the MAX TAPE MOUNTS EXCEEDED is received from TSM.

-TSMManagementClass <class>

Specifies the TSM management class. If not specified, LiteSpeed uses the default management class.

-TSMObjectPath <path> Specifies path to the TSM backup. For Fast Compression backups, it only specifies the filespace.
-U <username>

Specifies user login ID. Required if the connection type is not a trusted connection.

Login IDs are case-sensitive.

-UpdOptiStats <number> (Legacy plans)Enables the Update Statistics task. The number following this argument is the amount of database to sample (in rows or percent). The default is 50 percent.
-UpdStatsScan <value>

Specifies how to measure the amount of database to sample. This argument accepts one of the following values:

  • Rows
  • Percent
  • FullScan
-UpdStatsTarget <value>

Updates index and/or column statistics. This argument accepts one of the following values:

  • Columns
  • Index
  • All
-UseDefDir Instructs LiteSpeed to use the default backup directory.
-VerifyOpt <value>

Performs a restore verification on the backup file just created (if backup was successful). This argument accepts one of the following values:

  • Last—Verifies last backup performed (can be either a full or differential).
  • FullDiff—Verifies the last full backup and last differential is available.
  • All—Verifies last full backup and all differentials since.
-VrfyBackup

Performs a restore verification on the backup file just created (if backup was successful).

-With "COPY_ONLY" Specifies the copy-only backup.
-WriteHistory (Legacy plans)Writes history to msdb.dbo.sysdbmaintplan_history.
-X <option> <option_value> <option> <option_value>

Specifies if LiteSpeed should wait and retry the read or write operation on failure. You can define retry options using the following parameters:

  • DISK_RETRY_COUNT—Specifies the number of times that a specific operation will be retried on failure. The default is 4 retries, the maximum allowed setting is 1000.
  • DISK_RETRY_WAIT—Specifies the number of seconds to wait immediately following a failure before retrying. The default is 15 seconds, the maximum allowed setting is 300.

NOTE: This functionality is only available for disk and cloud operations.

For more information, see Network Resilience.

Input output flag.

  • WRITE_THROUGH
  • NO_BUFFERING
  • SEQUENTIAL_SCAN
  • RANDOM_ACCESS
  • OVERLAPPED
  • DELETE
  • FILE_EXTENSION
  • DISK_RETRY_COUNT—
  • DISK_RETRY_WAIT

Examples

  1. Perform full backups of all user databases, except those starting with "temp".

    slssqlmaint.exe -S LITESPEED\SQL2005 -U sa -P ****** -D "ALL USER DATABASES" -BkUpMedia DISK -BkUpDB -UseDefDir -AdaptiveCompression speed -Default "%D_%z.bak" -CryptLevel 8 -BackupKey ****** -Exclude Offline LogShippng ReadOnly Mask:"temp*"

  2. For LiteSpeedLocal and LiteSpeedCentral databases, perform full Fast Compression backups if the amount of database changes since the last full backup is 40% or more.

    slssqlmaint.exe -S LITESPEED\SQL2005 -U sa -P ****** -D "LiteSpeedLocal" "LiteSpeedCentral" -BkUpMedia DISK -BkUpDB "C:\temp" -BkFileName -AdaptiveCompression speed -SmartDiff 14DAYS -DataDelta 40 -SingleFile 0 -RequireFull -BackupEsc -Exclude Offline LogShippng ReadOnly

  3. Delete backup files older than 14 days from the d:\temp folder and its subfolders, if the files have "bkp" extension.

    slssqlmaint.exe -S LITESPEED\SQL2005 -U sa -P ****** -MAINTDEL -DelDeviceType DISK -DELTYPE FileBkup -DELUSEAGE -DELUNIT "14" -DELUNITTYPE "DAYS" -DELSUBFOLDERS -DELEXTENSION "bkp" -DELFOLDER "d:\temp"

  4. Remove backup and restore history older than 3 months from the LiteSpeed Local repository, shrink LiteSpeed Local repository.

    slssqlmaint.exe -S LITESPEED\SQL2005 -U sa -P ****** -CleanHis 3MONTHS BKUP Activity ShrinkLog

  5. Script a legacy plan.

    slssqlmaint.exe -S LITESPEED\SQL2005 -U sa -P ****** -PlanID "00638AA2-C493-4F90-9C3B-275B55091D60" -BkUpMedia DISK -BkUpDB -UseDefDir -CrBkSubDir -BkExt "bak" -NOOPTOLR -Logging 2 -AdaptiveCompression speed -Default "%D_%T_%Y%d%m%H%M%S.%EXT%" -CkDB -ReorgIDX -MAINTDEL -DelDeviceType DISK -DELTYPE FileBkup -DELUSEAGE -DELUNIT "3" -DELUNITTYPE "DAYS" -DELSUBFOLDERS -DELEXTENSION "bak" -DELFOLDER "c:\temp" -CleanHis 90DAYS MAINTPLN Activity PurgeInfo ShrinkLog -RebldIdx 100 -RmUnusedSpace 50 10 -UpdOptiStats 50 -UpdStatsTarget All -UpdStatsScan FullScan -WriteHistory -LogEngine 0

  6. Perform an Amazon S3 cloud backup.

    Tip: When using variables in a command line script, use double %% or else they will not be parsed correctly.

    • Correct example: -Default "%%T-%%m-%%H-%%M-%%S"
    • Incorrect example: -Default "%T-%m-%H-%M-%S"

    slssqlmaint.exe -D "master" -BkUpMedia CLOUD -BkUpDB -BkFileName -Logging 0 -CompressionLevel 2 -Default "%%T-%%m-%%H-%%M-%%S" -OPTOLR -CSType "AmazonS3" -CSAccessKey "******" -CSSecretKeyPlain "*********" -CSContainer "california" -CSAccessPoint "us-west-1" -CSObject "test\" -Exclude Deleted Offline LogShippng -T -S servername

  7. Azure Cloud Storage:

    Slssqlmaint.exe -D "prodb" -BkUpMedia CLOUD -BkUpDB -BkFileName -NOINIT -Logging 0 -CompressionLevel 7 -Default "%D_%T_%Y-%m-%d-%H%M%S.%EXT%" -OPTOLR -CSType "AzureBlob" -CSAccessKeyPlain "***" -CSSecretKey "***" -CSContainer "mycontainer" -CSObject "backups" -AutoStrip -UseSSL -CSBlobType "Block" -Exclude Deleted Offline LogShippng

  8. Google Cloud Storage:

    slssqlmaint.exe -D "prodb" -BkUpMedia CLOUD -BkUpDB -BkFileName -NOINIT -Logging 0 -CompressionLevel 7 -Default "%D_%T_%Y-%m-%d-%H%M%S.%EXT%" -OPTOLR -CSType "GoogleStorage" -CSAccessKey "***" -CSSecretKeyPlain "***" -CSContainer "mybucket" -CSAccessPoint "australia-southeast1" -CSObject "mybackups\" -CSProjectID "***" -CSStorageClass 2 -Exclude Deleted Offline LogShippng

 

Related Topics

SLSSQLMaint options:

[-S <Server Name>]

[-U <Login ID> [-P <Password>]]

[-D <Database Name|Mask:"..."|Regex:"...">] Include databases (Mask - Dos mask

include [*|?] characters; Regex - VBScript regular expressions pattern)

[-Rpt <Output File>]

[-To <Operator Name>]

[-CkDB | -CkDBNoIdx] Checks and find problems with the data if the maintenanc

e plan fails

[-CkAl | -CkAlNoIdx] Checks and find problems with the data if the maintenanc

e plan fails

[-CkCat] Checks and find problems with the data if the maintenance plan fails

[-RebldIdx <% Free Space>]

[-BkUpDB <Backup Path> | -BkUpLog <Backup Path>] Log backups

[-BkUpOnlyIfClean] Specifies that the backup occurs only if any specified -Ck

checks did not find problems with the data

[-BkUpMedia DISK [-DelBkUps <time period>] | TAPE | TSM | TSMArchive]

[-UpdOptiStats <% of Database to sample>]

[-HtmlRpt <Html File>]

[-VrfyBackup] Specifies that RESTORE VERIFYONLY is run on the backup when it c

ompletes

[-RmUnusedSpace <Minimum DB in MB> <% of free space to leave>]

[-PlanID <GUID identifying the maintenance plan in 36 character hex format>]

[-PlanName <Maintenance plan name>]

[-CrBkSubDir] Create a sub-directory (for storing backup files) for the databa

se(s).

[-UseDefDir] Use the default backup directory.

[-WriteHistory] Write history to msdb.dbo.sysdbmaintplan_history.

[-DelTxtRpt <time period>] Delete text reports older than given time period

[-DelHtmlRpt <time period>] Delete html reports older than given time period

[-MAINTDEL]

[-CKDBREPAIR] Check Data and Index Linkage with fast repairs

[-BKEXT <Backup Extension>]

[-COMMENT <A comment to add>]

[-JobP <Encryption key for job>]

[-X <WRITE_THROUGH|NO_BUFFERING|SEQUENTIAL_SCAN|RANDOM_ACCESS|OVERLAPPED|DELET

E|FILE_EXTENSION|DISK_RETRY_COUNT|DISK_RETRY_WAIT>] Input Output Flag

[-BackupKey <Password to backup>]

[-ENCRYPTIONKEY <Encryption key>]

[-CRYPTLEVEL <Encryption Level>]

[-PRIORITY <Priority>]

[-THREADS <Number of threads>]

[-LOGGING <Logging level>]

[-THROTTLE <Throttle level>]

[-COMPRESSIONLEVEL <Compression Level>]

[-AdaptiveCompression <1|2>] Adaptive compression 1-size, 2-speed

[-AFFINITY <Affinity Level>]

[-NOOPTOLR] Don't optimize Object Level Recovery

[-OPTOLR] Do optimize Object Level Recovery]

[-MAXTRANSFERSIZE <Maximum buffer size>]

[-BUFFERCOUNT <Buffer count>]

[-DIFFERENTIAL] Differential backups

[-Exclude <Selected|LogShippng|Offline|Deleted|Mask:"..."|Regex:"...">|IgnoreR

eplica|Primary|Secondary] Exclude databases (Mask - Dos mask include [*|?] chara

cters; Regex - VBScript regular expressions pattern)

[-IgnoreOffline] Exclude offline databases (old flag, use -Exclude Offline)

[-DblClick] Make dblclick backup

[-tsmclientnode <Client node>]

[-tsmclientownerpwd <Client owner password>]

[-tsmmanagementclass <Management class>]

[-tsmconfigfile] <Configuration file>]

[-tsmdevicetimeoutminutes <Maximum minutes SLS will wait for a TSM device>]

[-tsmclientownername <Client owner name>]

[-tsmobjectpath <TSM backup path>

[-DelFile] Delete specific file

[-DelFilePath <Filename>]

[-DelUseAge] Enabled use age

[-DelFolder <Folder path>]

[-DelExtension <Extension for delete files>]

[-DelSubFolders] Include first-level subfolders

[-DelUnit <Unit for file age>]

[-DelUnitType <MINUTES|HOURS|DAYS|WEEKS|MONTHS|YEARS>] File Age Type

[-DelType <FileBkup|FileRpt|FileAny>] - Delete file by type: backup, report or

any file

[-DelEmptyFolder] - Delete empty folder

[-MaintDel] Enabled delete task

[-Mirror <Mirror Path>] - Directories to mirror the backup

[-Attached <Attached file or directory>] - Files or directories to attach to t

he backup

[-CleanHis [BKUP|JBS|MAINTPLN|Activity|CentralActivity|PurgeInfo]] - Cleanup h

istory

[-SmartDiff <time period>] - Create full backup than given time period

[-DataDelta <Percent>] - Of data pages changed

[-SizeDelta <Percent>] - Size ratio of last diff and last full

[-ExcludeDays <Mn|Tu|Wd|Th|Fr|St|Sn>] - Do not run full backup on specified da

ys of week

[-VerifyOpt <All|Last|FullDiff>] - Specify the verification options after back

up

[-NotifyOpt <Every|Failure>] - Specify the notification options after backup

[-NotifyAgent <operator>] - Send notification operator

[-SingleFile] - Self-contained backup set

[-RequireFull] - Verify full backup exists prior to performing a differential

backup

[-AltBkpDir <Path for full backup>] - Search full backup in alternate folder

[-BackupEsc] - Enable backup escalation

[-FullDiffRtn <Days>] - Full/Differential backup retention

[-LogRtn <Days>] - Transaction log backup retention

[-SupportComputedColumn] Run DBCC maintenance commands on computed columns.

[-OpSubject <Subject>] - Notify Operator subject

[-OpProfile <Profile>] - Notify Operator profile

[-OpNotify <Operator1|Operator2|...>] Notify Operators

[-OpMessage <Message>] - Notify Operator message

[-LogEngine <0|1|2>] - 0ùLogging off. 1ùLogging on. Log file is removed on success. 2 Logging on.

Documents connexes

The document was helpful.

Sélectionner une évaluation

I easily found the information I needed.

Sélectionner une évaluation