Object Level Recovery utility (olr.exe) allows you to restore objects from the command-line interface (CLI).
This topic covers:
olr.exe ( -? | <list_backup_contents> | <view_or_restore_tables> | <restore_other_objects> | <execute_select_script>)
Connection Options:
-U <username>
-P <password>
Backup Files:
-F <full_backup_filename>
[-N <file_number>]
[-K <encryption_key>] ]
[-D <diff_backup_filename>
[-N <file_number>]
[-K <encryption_key>] ]
[-g <log_backup_filename>
[ ( [-N <file_number>]
[-K <encryption_key>] )
| (-h <striped_log_backup_filename>
[-N <file_number>]
[-K <encryption_key>] ) ] ]
[-L (Create|Keep|Delete)]
Cloud connection options:
[--CloudVendor <vendor name>]
[--CloudAccessKey <key name>]
[--CloudAccessKeyEnc <encrypted key name>]
[--CloudSecretKey <key name>]
[--CloudSecretKeyEnc <encrypted key name>]
[--CloudBucketName <bucket name>]
[--CloudRegionName <cloud region name>]
[--CloudEndpoint <cloud endpoint:port>]
[--CloudAcceptAllCertificates <0, 1>]
[--CloudGovRegion <government region number>]
[--CloudStorageClass <standard, standard-ia, standard-rrs>]
[--AWSUseServerSideEncryption <1, 0>]
[--AzureBlobType <block, page>]
[--CloudAutoStriping <1, 0>]
[--CloudAutoStripingThreshold <param size in GB>]
[--UseSSL <1, 0>]
Script Options:
[ -G <ON_filegroup_name> ]
[ -I <TEXTIMAGE_ON_filegroup_name> ]
[ -i <table_objects> ]
[ -p <prefix> ]
[ -s <suffix> ]
[ --UDT <0|1> ]
List Contents:
-V
[-W <temp_directory>]
[-y ]
[-Y <object_type>]
<backup_files>
[-E <destination_server_name> ]
[<connection_options>]
View or Recover Tables:
-O <table_name>
-E <destination_server_name>
[ (-S <database_name>
[-T <table_name>]
[-W <temp_directory>]
[-X <ship_directory>]
[-b 1]
-J <output_filename> ]
[-y ]
[<script_options>]
<backup_files>
<connection_options>
Recover Objects Other than Tables:
( -C [ <object_name> ]
-Y ( object_type | 'Database' )
| -Z <objects_filename> )
[ -Q <script_filename> ]
[<script_options>]
<backup_files>
[-y ]
[-W <temp_directory>]
-E <destination_server_name>
<connection_options>
Execute Select Script:
-B
(-H <script_text> | -Q <script_file_name>)
[-y ]
-E <destination_server_name>
[ (-S <database_name>
[-T <table_name>]
[-W <temp_directory>]
[-I <filegroup_name>]
[-X <ship_directory>]
[-b 1 ]
| -J <output_filename> ]
<backup_files>
<connection_options>
NOTES:
Argument |
Name |
Description | |||
---|---|---|---|---|---|
-? |
--Help |
Displays the syntax summary of the LiteSpeed command-line utility. | |||
-B |
--ExecuteScript |
Indicates Execute SELECT mode of operation. | |||
-b | --BackEnd |
Object Level Recovery can restore tables using two different internal techniques to handle the record inserts. The first and default method uses BCP files and a TSQL BULK INSERT statement. Object Level Recovery will write a BCP format file and an accompanying binary data file to the local file system. These files may become very large depending on the table size and will require permissions to write to a temporary directory. The default TEMP location can be set by using the @TempDirectory parameter or by setting a permanent temp location in the LiteSpeed configuration file. An alternate insertion method can be specified to use Sql Server’s Sql Native Client capabilities. This method inserts row-data directly into the destination database bypassing any storage on the local file-system. To enable this method, use the parameter @backend='SQLNativeClient' (or -b 1 from the command line). To make this the default method set the value “BackEnd=SQLNativeClient” in the Object Level Recovery section of the LiteSpeed configuration file. Regardless of the insertion method used, the batch size can be globally managed by setting the value “BulkImportBatchSize=<N>”. This will set the number of row inserts for each batched transaction. | |||
-C <object_name> |
--CreateScript |
Specifies the name of the object to recover. | |||
-d |
--RestoreAsOnDiskTable |
This option allows you to restore an in-memory table as a regular table. | |||
-D <diff_backup_filename> |
--DifferentialBackupFileName |
Name of backup file to restore. Used for differential backups instead of full backup files. You can supply multiple instances of this argument. | |||
-E <destination_server_name> |
--DestinationServer |
Name of the destination server. | |||
-F <full_backup_filename> |
--FullBackupFilename |
Location and name of the backup file device containing the object to recover. Examples: UNC Path: \\servername\share\path\filename Local path: c:\filedirectory\filename NOTE: There can be multiple files but they must be listed in the order in which they were backed up. | |||
-G <filegroup_name> |
--OnFileGroup |
Destination ON filegroup name. | |||
-g <log_filename> | --LogBackupFileName |
Specifies location and name of the log backup file. You can supply multiple instances of this argument. | |||
-H <script_text> |
--ScriptText |
SELECT Script literal text. For more information, see Supported SELECT Statements. | |||
-h <striped_logfilename> | --LogBackupStripeFileName |
Specifies the striped log file name. NOTE: The striped files for a given log backup must be specified before the next log backup set is specified. | |||
-i <table_objects> | --IncludeTableObjects |
Type:String Instructs LiteSpeed to script or recover one or more of the following:
The value is a list of options, separated with commas. | |||
-I <filegroup_name> |
--TextImageOnFileGroup |
Destination TEXTIMAGE_ON filegroup name. Used to restore a BLOB (binary large object). | |||
-J <filename> |
--ResultsFileName |
Name of comma separated file (.csv) that is generated instead restoring into a database. This is an ad hoc solution for users want to see the restored data in Excel. You can only use this argument for text data. | |||
-k |
--KeepComputedColumns |
Instructs LiteSpeed to keep the computed columns with the object restore. This argument accepts one of the following values:
| |||
-K <encryption_key> |
--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' | |||
-l |
--LSMPath |
Specify a custom path for finding or creating the LSM file. | |||
-L <option> |
--LSM |
Specifies handling for OLR LSM mapfile(s).
| |||
-M |
--FileStreamOnFileGroup |
Specifies a file stream filegroup to include in the object restore. | |||
-m |
--PersistLogProcessing |
Instructs LiteSpeed to persist log processing, so the same database backup does not have to be processed for each Object Level Recovery operation. This argument accepts one of the following values:
| |||
-N <file_number> |
--FileNumber |
Specifies the particular backup to use when recasting, restoring, extracting or reading from files with multiple appended backups. | |||
-O <object_name> |
--RestoreTable |
Specifies the name of the object to recover. NOTE: Currently only tables. Table name must be preceded by database owner. | |||
-p <prefix> | --PrefixTableObjects |
Adds a prefix to the names of the table's objects you selected to script or recover. | |||
-P <password> |
--Password |
Specifies the user password. Passwords are case-sensitive. Required if the connection type is not a trusted connection. | |||
-Q <script_file_name> |
--ScriptFileName |
The file name that the script is output into. When used with execute-select, this file contains the select statement(s). | |||
-R | --Trusted |
This is Windows Authentication. | |||
-s <suffix> | --SuffixTableObjects |
Adds a suffix to the names of the table's objects you selected to script or recover. | |||
-S <destination_database_name> |
--DestinationDatabase |
Specifies the destination database. | |||
-t |
--Trace |
Used by LiteSpeed to activate trace logging. | |||
-T <destination_table_name> |
--TableName |
Specifies the name of the destination table. LiteSpeed will not overwrite an existing table. If you select the same server instance and database as the original table, you must use a different table name. NOTE: For Execute-Select operations, LiteSpeed will attempt to insert (append) all selected records into existing table. | |||
-U <username> |
--UserName |
Specifies user login ID. Required if the connection type is not a trusted connection. Login IDs are case-sensitive. | |||
--UDT |
Create table script:
| ||||
-V |
--ViewContents |
View contents. | |||
-W <temp_directory> |
--WriteDirectory |
Specifies a temporary directory for use with Object Level Recovery. Use this argument when the default Windows temp directory does not have enough free disk space for the restore process.
| |||
-X <ship_directory> |
--ShipDirectory |
Ship directory for packaging files for subsequent restore. | |||
-Y <object_type> |
--Type |
Specifies the type of object. If you omit this parameter the object type defaults to table, so you should use this argument to recover schema objects other than tables. This argument accepts one of the following values:
| |||
-y | --DisableLogProcessing |
Instructs LiteSpeed to skip all transaction log backups and tail log processing. This may improve read and recovery times. | |||
-Z <filename> |
--ObjFileName |
Identifies a file that contains a list of objects. The format of this file is "ObjectType,ObjectName" per line. Tip: You can use -V and -Y arguments to create the objects list. |
Cloud-specific arguments work in conjunction with the LiteSpeed arguments. See Syntax and Examples for more information.
-Argument |
--Argument |
Description | |
---|---|---|---|
(none) | --AWSUseServerSideEncryption |
The @AWSUseServerSideEncryption argument enables the encryption of data stored at rest in Amazon S3. This argument accepts one of the following values:
| |
(none) | --AzureBlobType |
Type: Varchar The @AzureBlobType argument specifies the types of blobs that can be stored in the Microsoft Azure cloud storage. This argument accepts one of the following values: "Block", "Page".
| |
(none) | --CloudAccessKey |
Type: Varchar 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 |
Type: Varchar The @CloudAccessKeyEnc argument specifies the name of the encrypted unique Cloud Web Service alphanumeric access key that identifies each user. | |
(none) | --CloudAutoStriping |
This parameter enables automatic file striping for LiteSpeed cloud backups. | |
(none) | --CloudAutoStripingThreshold |
This parameter contains the stripe size in GBs. LiteSpeed logic uses the database size to make a decision about the number of stripes needed for LiteSpeed cloud backups. For example, if you have a database with a size of 200GB and set @CloudAutoStripingThreshold = 50, then LiteSpeed uses 200/50 = 4 stripes. | |
(none) | --CloudBucketName |
Type: Varchar 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 |
Type: Varchar 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 |
Type: Varchar 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 |
Type: Varchar 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) |
--CloudStorageClass |
Type: Varchar The @CloudStorageClass argument specifies a range of storage classes established for different use cases including: For Amazon S3:
For Google Storage:
| |
(none) | --CloudVendor |
Type: Varchar 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 |
Type: Varchar 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 |
Type: Boolean 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) | --GSProject |
DEPRECATED LiteSpeed 8.8: Was used to store for the Google Cloud Storage project ID; the project ID is now obtained from login. This parameter is retained for compatibility with old backup/restore scripts. | |
(none) |
--UseSSL |
The @UseSSL argument specifies that the connection uses SSL security. This argument accepts one of the following values:
|
List all objects in the LiteSpeedLocal database in the LITESPEED_full.bak backup file:
olr.exe -V -F "C:\temp\LITESPEED_full.bak" -Y "All"
Preview a table, do not use tail log:
olr.exe -F "C:\temp\LITESPEED_full.bak" -N 1 -O dbo.LitespeedActivity -y -E LITESPEED\SQL2005
Recover the contents of the LiteSpeedActivity table to the LITESPEED\SQL2005 server, TEST database, LiteSpeedActivity117 table:
olr.exe -F "C:\temp\LITESPEED_full.bak" -N2 -D "c:\temp\LITESPEED_diff.bak" -N3 -O dbo.LiteSpeedActivity -E LITESPEED\SQL2005 -S TEST -Tdbo.LiteSpeedActivity117
Recover the contents of the LiteSpeedActivity table to the LITESPEED\SQL2005 server, TEST database, LiteSpeedActivity table using custom temp directory:
olr.exe -F "C:\temp\LITESPEED_full.bak" -N2 -D "c:\temp\LITESPEED_diff.bak" -N3 -O dbo.LiteSpeedActivity -E LITESPEED\SQL2005 -S TEST -Tdbo.LiteSpeedActivity -Wd:\products
Recover dbo.Employees from a striped backup:
olr.exe -F "C:\temp\FOX_full.bak" -K****** -g"C:\temp\FOX_tlog1.bak" -h"C:\temp\FOX_tlog2.bak" -h"C:\temp\FOX_tlog3.bak" -K****** -Odbo.Employees -i "constraints, foreignKeys" -E LITESPEED\SQL2005 -S HR -Tdbo.Employees
Query the backup:
olr.exe -F "C:\temp\LITESPEED_full.bak" -B -H "select top (100)* from dbo.LiteSpeedActivity" -E LITESPEED\SQL2005
Execute select script and save results in a database:
olr.exe -F "C:\temp\LITESPEED_full.bak" -B -Q "C:\temp\New Folder\select_script.sql" -E LITESPEED\SQL2005 -SQResults -T DBID6
Query the backup and save results in a .csv file:
olr.exe -F "C:\temp\LITESPEED_full.bak" -B -H "select * from dbo.LiteSpeedActivity where PercentCompleted < 100" -E LITESPEED\SQL2005 -J "C:\LS_Activity.csv"
Create scripts in the "c:\temp\scripts" folder to recover dbo.Employees later:
olr.exe -F "C:\temp\FOX_full.bak" -K****** -g"C:\temp\FOX_tlog1.bak" -h"C:\temp\FOX_tlog2.bak" -h"C:\temp\FOX_tlog3.bak" -K****** -Odbo.Employees -i "constraints, foreignKeys" -E LITESPEED\SQL2005 -S NHR -T dbo.Employees -X c:\temp\scripts
Generate a script to restore the table schema only:
olr.exe -F "C:\temp\LITESPEED_full.bak" -N 1 -C dbo.LitespeedActivity -i "constraints, foreignkeys" -s "_restored"
Generate a script for an object other than a table:
olr.exe -F "C:\temp\FOX_full.bak" -K****** -N3 -C dbo.FOX_view -Y View
Create a script file for objects listed in the objects.txt file:
olr.exe -F "C:\temp\FOX_full.bak" -K****** -N3 -Z "c:\temp\objects.txt" -Q d:\temp\create_view.sql
Create a 'Create Database' script:
olr.exe -F "C:\temp\FOX_full.bak" -K****** -N3 -C -Y Database -Q d:\temp\create_database_FOX.sql
Restore Objects
olr.exe -F "C:\temp\FOX_full.bak" -K****** -N3 -C -Y Database -Q d:\temp\create_database_FOX.sql --UDT 0
Read files direct from cloud storage
olr.exe -F "s3:\\bucket.US\abyr-full-s3.bak" -V -Y All --CloudVendor "AmazonS3" --CloudAccessKeyEnc "***" --CloudSecretKeyEnc "***"
0 (success) or 1 (failure)
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center