The slsSmartCleanup command-line utility (slsSmartCleanUp.exe) allows you to find and remove old full, differential and transaction log backups based on a user-defined period (either the file age or the date).
The backup retention will never delete:
Files that have the filesystem archive bit set (if that option is selected)
slsSmartCleanup.exe ( -? | --ShowHelp | --ShowSyntax | <options> )
Connection options:
--Database <database_name>
--Server <server_name>
--WindowsAuth | (--UserName <username> --Password <password>)
Cleanup options:
--BackupRetainDays <number> | --BackupExpiration <date>
--LogRetainDays <number> | --LogExpiration <date>
--KeepArchiveFiles
--MultiDatabaseType
[--CopyOnlyBackups <option>]
TSM connection options:
[--TSMConfigFile <path>]
[--TSMClientNode <node>]
[--TSMClientOwnerPwd <password>]
[--TSMdsmi_dir <path>]
[--TSMdsmi_log <path>]
[--TSMLogName <name>]
[--TSMAdminName <name>]
[--TSMAdminPwd <password>]
[Cloud connection options:]
[--CloudVendor <vendor name>]
[--CloudAccessKey <key name>]
[--CloudAccessKeyEnc <encrypted key name>]
[--CloudAutoStriping <1 or 0>]
[--CloudAutoStripingThreshold <auto, number GB>]
[--CloudSecretKey <key name>]
[--CloudSecretKeyEnc <encrypted key name>]
[--CloudBucketName <bucket name>]
[--CloudRegionName <cloud region name>]
[--CloudEndpoint <cloud endpoint:port>]
[--CloudAcceptAllCertificates <0 or 1>]
[--CloudGovRegion <government region number>]
[Proxy connection options:]
[--ProxyHost <proxy host name>]
[--ProxyLogin <proxy server login credential>]
[--ProxyPassword <proxy server password credential>]
[--ProxyPasswordEnc <encrypted proxy server password credential>]
[--ProxyPort <proxy server port number>]
Other options:
[--DryRun]
[--LogLevel (0|1|2) [--trace logpath = "path"]]
NOTES:
-Argument |
--Argument |
Description |
---|---|---|
-a | --KeepArchiveFiles |
Turns on monitoring and refuses to delete files that have the archive filesystem bit set. When enabled dependent files are not deleted. |
-b | --BackupRetain |
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. |
(none) | --BackupRetainUnits |
Defines unit type for BackupRetain argument. Allowed values: hour / day / week / month / year. Note: Month = 30 days, Year = 365 days |
-c | --BackupExpiration |
Specifies the date using one of the following formats: YYYY-MM-DD YYYY-MM-DD HH:MM:SS where
To be eligible for cleanup, the full or differential backup must be older than this date. |
-C | --CopyOnlyBackups |
Controls how LiteSpeed handles copy-only backups. This argument accepts one of the following values:
NOTES:
|
-D | --Database |
Name of database to be backed up or restored. Only backups of this database are eligible for cleanup. |
(none) | --Destination | Specifies the instance of the destination server to cleanup. |
-d | --DryRun |
Displays backups that are to be removed (delete candidates) or kept according to the specified conditions and SmartCleanup logic. SmartCleanup does not remove any backups, if this parameter is specified. |
-k | --LogExpiration |
Specifies the date of one of the following formats: YYYY-MM-DD YYYY-MM-DD HH:MM:SS where
To be eligible for cleanup, the t-log backup must be older than this date. |
-L | --LogLevel |
Creates a log file. This argument accepts one of the following values:
The default output directory is C:\Documents and Settings\All Users\Application Data\Quest Software\LiteSpeed\SQL Server\Logs (or C:\ProgramData\Quest Software\LiteSpeed\SQL Server\Logs) (or C:\ProgramData\Quest Software\LiteSpeed\SQL Server\Logs). To log to a different directory run this utility with the following argument: --trace logpath = "path". |
-l | --LogRetain |
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. |
(none) | --LogRetainUnits |
Defines unit type for LogRetain argument. Allowed values: hour / day / week / month / year. Note: Month = 30 days, Year = 365 days |
(none) | --MultiDatabaseType |
Produces a cleanup for several types of databases. Types can include: all, system, user, or selected databases. This argument accepts one of the following values:
|
(none) | --ReviewAllBackups |
Specifies Smart Cleanup behavior for searching backups to delete
|
(none) | --Locations |
Defines locations (spread by semicolon symbol) to apply cleanup policy. Disk: “F:\\Backups; F:\\mirrors” Cloud folders: "fff\; test123\" |
-S | --Server |
Specifies the instance of Microsoft SQL Server to connect to. This argument accepts one of the following values:
If no server is specified, the LiteSpeed command-line utility will connect to the default instance of SQL Server on the local computer. |
(none) | --ServerToDelete |
Specifies the instance of the destination server to delete. |
(none) | --TSMAdminName |
Specifies the TSM administrative user name that has client authority for the TSM node. Some operations may require an administrative user with client owner authority to be specified in order to open a TSM session. The correct username and password may be obtained from the TSM administrator. |
(none) | --TSMAdminPwd |
Specifies the plain text password of the administrative user which is used to log in to the TSM server and start the TSM session. |
(none) | --TSMClientNode |
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. |
(none) | --TSMClientOwnerPwd |
Specifies the TSM client owner user password. Not required, if specified in the options file or if backing up with the Passwordaccess Generate option. |
-j | --TSMConfigFile |
Specifies the TSM configuration file. |
(none) | --TSMdsmi_dir |
DSMI_DIR path if needed. |
(none) | --TSMdsmi_log |
DSMI_LOG path. |
(none) | --TSMLogName |
Log name. |
-U | --UserName |
Specifies user login ID. Required if the connection type is not a trusted connection. Login IDs are case-sensitive. |
-P | --Password |
Specifies the user password. Passwords are case-sensitive. Required if the connection type is not a trusted connection. |
-T | --WindowsAuth | Specifies Windows authentication. Uses a trusted connection (to the server) instead of requiring a password. |
-? | --ShowHelp |
Displays the syntax summary of the LiteSpeed command-line utility. |
(none) | --ShowSyntax | Displays the utility syntax. |
Cloud-specific arguments work in conjunction with the LiteSpeed arguments. See Syntax and SmartCleanup Command-Line Arguments for more information.
-Argument |
--Argument |
Description |
---|---|---|
(none) | --CloudAccessKey |
The @CloudAccessKey argument specifies the name of the unique Cloud Web Service alphanumeric access key that identifies each user. The selections include Amazon Access Key, Azure Account Name, Google e-mail styled account, S3 Compatible Storage Access Key. |
(none) | --CloudAccessKeyEnc |
The @CloudAccessKeyEnc argument specifies the name of the encrypted unique Cloud Web Service alphanumeric access key that identifies each user. |
(none) | --CloudBucketName |
The @CloudBucketName argument specifies the name of the container for cloud objects. Bucket names must be at least 3 and no more than 63 characters long. The selections are Amazon Bucket Name, Azure Container Name, Google Bucket Name, Google Bucket Name requirements are described at https://cloud.google.com/storage/docs/naming, S3 Compatible Storage Bucket Name, |
(none) | --CloudGovRegion |
The @CloudGovRegion argument enables a special restricted region for the US Government use in Amazon S3 and Azure Clouds. This argument accepts one of the following values:
|
(none) | --CloudRegionName |
The @CloudRegionName argument specifies the name of the Cloud Web Service region to use for a bucket. Example values are but not limited to: us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, eu-central-1, eu-west-1, eu-west-2, ap-south-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, ap-northeast-2, sa-east-1, N'Germany' and N'China'. |
(none) | --CloudSecretKey |
The @CloudSecretKey argument specifies the name of the Cloud Web Service secret key that is assigned when you initially get a Cloud account. |
(none) | --CloudSecretKeyEnc |
The @CloudSecretKeyEnc argument specifies the name of the encrypted Cloud Web Service secret key that is assigned when you initially get a Cloud account. |
(none) | --CloudVendor |
The @CloudVendor argument specifies the name of the cloud service provider. The argument accepts one of the following values: "AmazonS3", "AzureBlob", "GoogleStorage" or "S3Compatible". |
(none) | --CloudEndpoint |
The @CloudEndpoint argument specifies the endpoint for S3 Compatible Storage and custom endpoint for Amazon S3 service (in case of VPC). Format: servername:port .Example values: "servername", "servername:port", "ip:port", "10.0.0.200:9021". |
(none) | --CloudAcceptAllCertificates |
The @CloudAcceptAllCertificates argument instructs LiteSpeed accept self-signed certificates for S3 Compatible Storage. This argument accepts one of the following values:
Note: Delete backups is not supported in Maintenance Plans with this option. |
(none) |
--UseSSL |
The @UseSSL argument specifies that the connection uses SSL security. This argument accepts one of the following values:
|
Proxy-specific arguments work in conjunction with the LiteSpeed arguments. See Syntax and SmartCleanup Command-Line Arguments for more information.
-Argument |
--Argument |
Description | |
---|---|---|---|
(none) |
--ProxyHost |
The @ProxyHost argument is optional and specifies the name of the proxy host name that is running the proxy server.
| |
(none) | --ProxyLogin |
The @ProxyLogin argument is optional and specifies the proxy server login credential.
| |
(none) | --ProxyPassword |
The @ProxyPassword argument is optional and specifies the proxy server password credential.
| |
(none) | --ProxyPasswordEnc |
The @ProxyPasswordEnc argument is optional and specifies the encrypted proxy server password credential.
| |
(none) | --ProxyPort |
The @ProxyPort argument is optional and contains the port number of the proxy server. The TCP/IP port values can be 1-65535.
|
Delete disk full and differential backups older than 28 days, delete log backups older than 2 days, allow deletions of the copy-only backups:
SLSSmartCleanup.exe --Database test2 --BackupRetain 28 --BackupRetainUnits “day” --LogRetain 2 --LogRetainUnits “day” --Locations “F:\\Backups; F:\\mirrors” --CopyOnlyBackups AllowDeletes --Server LITESPEED\SQL2005 -U sa -P *******
Delete disk full and differential backups created before 11/15/2012:
SLSSmartCleanup.exe --Database test2 --BackupExpiration "2012-11-15" --Server LITESPEED\SQL2005 --WindowsAuth
Delete tsm log backups older than 2 days:
SLSSmartCleanup.exe --Database test_tsm --TSMConfigFile "C:\Program Files\Tivoli\TSM\baclient\dsm.opt" --TSMClientNode w2k3_TSM2 --TSMClientOwnerPwd ***** --LogRetainDays 2 --WindowsAuth
Delete full, differential and log TSM backups created before 06/15/2012, using the PASSWORDAccess generate option to connect to the TSM Server:
SLSSmartCleanup.exe --Database test_tsm --TSMConfigFile "C:\Program Files\Tivoli\TSM\baclient\dsm_gp.opt" --BackupExpiration 2012-06-15 --LogExpiration 2012-06-15 --WindowsAuth
Delete Amazon S3 cloud backup.
TIP: The parameter “-CSecretKey” must be generated by the Maintenance plan wizard and cut\paste into the command line script.
SLSsmartcleanup.exe -D model --BackupExpiration "2014-03-02 00:00:00" --CloudVendor "AmazonS3" --CloudBucketName "california" --CloudAccessKey "***** " --CloudSecretKey "******" --CloudRegionName "us-west-1" --UseSSL -S"servername"
0 (success) or 1 (failure)
© ALL RIGHTS RESERVED. Termini di utilizzo Privacy Cookie Preference Center