restore
If real-time access of Archive objects is not enabled, you can read an Archive object only after you restore it. Real-time access is not supported for Cold Archive or Deep Cold Archive objects, so you can read these objects only after you restore them. Restoring an Archive object usually takes several minutes, restoring a Cold Archive object usually takes several hours, and restoring a Deep Cold Archive object usually takes 12 to 48 hours. These durations are estimates, and the actual restoration time may vary. This topic describes how to run the restore command to restore objects.
Usage notes
-
To restore a single object, you must have the
oss:RestoreObjectpermission. To restore objects by directory, you must have theoss:RestoreObjectandoss:ListObjectspermissions. For instructions, see Grant a custom policy. -
For more information about the restoration status and billing rules of Archive, Cold Archive, and Deep Cold Archive objects, see Restore objects.
Command syntax
ossutil restore oss://bucket/object [flags]
|
Parameter |
Type |
Description |
|
--days |
int |
The number of days for which the object remains in the restored state. Valid values: 1 to 365. When you perform a batch operation on objects in mixed storage classes, and the --days value exceeds the maximum value supported by a storage class, the value is automatically adjusted to the maximum value supported by that storage class. For example, Archive supports a maximum of 7 days and Deep Cold Archive supports 365 days. If you set --days to 100, the value is automatically adjusted to 7 for Archive objects, and 100 is used for Deep Cold Archive objects. Note
|
|
--tier |
string |
The restoration priority. You do not need to specify this parameter for Archive objects, which are restored in 1 minute.
When you perform a batch operation on objects in mixed storage classes, and the --tier value exceeds the priority supported by a storage class, the value is automatically adjusted to the lowest priority supported by that storage class. For example, Cold Archive supports Bulk and Deep Cold Archive supports only Standard. If you set --tier to Bulk, the value is automatically adjusted to Standard for Deep Cold Archive objects. Note
Different restoration priorities incur different data retrieval request fees and data retrieval capacity fees. Expedited incurs the highest fees. For more information, see Request fees. |
|
--archive-max-days |
int |
The maximum number of days for which Archive objects remain in the restored state in a batch restore operation. Default value: 7. If --days is greater than this value, Archive objects are restored for this number of days, and objects in other storage classes are still restored for the number of days specified by --days. Note
|
|
--checkers |
int |
The number of check tasks that run in parallel. Default value: 16. Note
|
|
--dirs |
/ |
Returns the objects and subdirectories in the current directory instead of recursively listing all objects in all subdirectories. Note
|
|
--encoding-type |
string |
The encoding method of the object name or file name that you specify. Valid value: url. Note
|
|
--end-with |
string |
Returns objects whose names are alphabetically before the specified value, including the specified value. Note
|
|
--exclude |
stringArray |
The exclusion rule for paths or object names. Note
|
|
--exclude-from |
stringArray |
Reads exclusion rules from a rule file. Note
|
|
--files-from |
stringArray |
Reads the list of source object names from a file. Empty lines and comment lines are ignored. Note
|
|
--files-from-raw |
stringArray |
Reads the list of source object names from a file. Note
|
|
--filter |
stringArray |
The filter rule for paths or object names. Note
|
|
--filter-from |
stringArray |
Reads filter rules from a rule file. Note
|
|
-f, --force |
/ |
Forces the operation without prompting for confirmation. Note
|
|
--include |
stringArray |
The inclusion rule for paths or object names. Note
|
|
--include-from |
stringArray |
Reads inclusion rules from a rule file. Note
|
|
-j, --job |
int |
The number of concurrent tasks across multiple objects in a batch operation. Default value: 3. Note
|
|
--limited-num |
int |
The maximum number of results to return. Note
|
|
--list-objects |
/ |
Lists objects by calling the ListObjects operation. Note
|
|
--min-age |
Duration |
Excludes objects whose last modified time is later than this value. The default unit is seconds. You can also append a unit suffix. For example, 1h indicates one hour. Note
|
|
--max-age |
Duration |
Excludes objects whose last modified time is earlier than this value. The default unit is seconds. You can also append a unit suffix. For example, 1h indicates one hour. Note
|
|
--min-mtime |
Time |
Excludes objects whose last modified time is earlier than this value. The time must be in UTC. Example: 2006-01-02T15:04:05. Note
|
|
--max-mtime |
Time |
Excludes objects whose last modified time is later than this value. The time must be in UTC. Example: 2006-01-02T15:04:05. Note
|
|
--max-size |
SizeSuffix |
The maximum size of an object to transfer. The default unit is bytes. You can also append a unit suffix: B, K, M, G, T, or P, where 1K (KiB) = 1024B. Note
|
|
--metadata-exclude |
stringArray |
Excludes objects whose metadata matches the rule. Metadata is matched in the Note
|
|
--metadata-filter |
stringArray |
The filter rule for object metadata. For details, see Filter objects based on object metadata. Note
|
|
--metadata-filter-from |
stringArray |
Reads object metadata filter rules from a rule file. For details, see Filter objects based on object metadata. Note
|
|
--metadata-include |
stringArray |
Includes only objects whose metadata matches the rule. Other objects are excluded by default. Metadata is matched in the Note
|
|
--min-size |
SizeSuffix |
The minimum size of an object to transfer. The default unit is bytes. You can also append a unit suffix: B, K, M, G, T, or P, where 1K (KiB) = 1024B. Note
|
|
--no-check-status |
/ |
Takes effect only in Note
|
|
--no-error-report |
/ |
Does not generate an error report file during a batch operation. Note
|
|
--no-progress |
/ |
Does not display the progress. Note
|
|
--output-dir |
string |
The output directory of the error report file generated during a batch operation. Default value: ossutil_output. Note
|
|
--page-size |
int |
The maximum number of objects to return per page when objects are listed in a batch operation. Default value: 1000. Valid values: 1 to 1000. Note
|
|
-r, --recursive |
/ |
Performs the operation recursively. If this option is specified, the command operates on all matching objects in the bucket. Otherwise, the command operates only on the object specified by the path. Note
|
|
--request-payer |
string |
The payer of the request. Set this value if pay-by-requester mode is used. Valid value: requester. Note
|
|
--start-after |
string |
Returns objects whose names are alphabetically after the specified value, excluding the specified value. Note
|
|
--support-dir-object |
/ |
Treats directory objects, which are objects whose names end with /, as regular objects when the object list is read from a file, such as when you use --files-from. Note
|
|
--version-id |
string |
The version ID of the object. Note
|
|
--list-format |
string |
The format of the list file. Valid values: plain and inventory. Note
|
|
--list-manifest-from |
string |
Reads the format description of the list file from a file. You must set this parameter if the format of the list file is inventory. Note
|
For more information, see Command-line options.
Examples
Restore Archive objects
-
The following example restores the Archive object exampleobject.txt in the destination bucket examplebucket.
ossutil restore oss://examplebucket/exampleobject.txt -
The following example restores the Archive object exampleobject.txt in the destination bucket examplebucket and keeps the object in the restored state for 3 days.
ossutil restore oss://examplebucket/exampleobject.txt --days 3 -
The following example restores objects from a list.
NoteEach line in the list file represents one object and uses the OSS path format oss://{bucket}/{key}. The following list.txt file is an example:
oss://examplebucket/key1 oss://examplebucket/key2ossutil restore list://list.txt -
The following example uses list mode to send restore requests directly for the objects in list.txt without checking their status. Objects in the list that are being restored return the RestoreAlreadyInProgress error, and objects whose storage class is not Archive, Cold Archive, or Deep Cold Archive return the OperationNotSupported error.
ossutil restore list://list.txt --no-check-status -
The following example restores objects from an inventory file.
NoteAfter an inventory task runs, a csv.gz file and a manifest.json file are generated in the inventory results. Both files are required to restore objects from an inventory file.
ossutil restore list://ca8007fc-4123-493e-9a01-dd1511fbac54.csv.gz --list-format inventory --list-manifest-from manifest.json -
The following example restores objects directly from an inventory file without checking the status of the objects.
ossutil restore list://ca8007fc-4123-493e-9a01-dd1511fbac54.csv.gz --list-format inventory --list-manifest-from manifest.json --no-check-status
Restore Cold Archive objects
The following example restores the Cold Archive object exampleobject.txt in the destination bucket examplebucket and keeps the object in the restored state for 5 days.
ossutil restore oss://examplebucket/exampleobject.txt --tier Bulk --days 5
The following example recursively restores all Cold Archive .csv objects in the dir directory of the destination bucket examplebucket and keeps the objects in the restored state for 5 days.
ossutil restore oss://examplebucket/dir/ -r --include "*.csv" --metadata-include "x-oss-storage-class=ColdArchive" --tier Bulk --days 5
The following example recursively selects Cold Archive objects in the dir directory and explicitly excludes objects whose restoration is complete. The ongoing-request="false" value indicates completed restoration, and the trailing * matches the varying expiry date. Place the exclusion rule before the inclusion rule. The default status check of a batch restore operation skips objects that are still being restored.
ossutil restore oss://examplebucket/dir/ -r --tier Standard --days 365 --metadata-exclude 'x-oss-restore=ongoing-request="false"*' --metadata-include "x-oss-storage-class=ColdArchive"
To exclude both objects that are being restored and objects whose restoration is complete, use x-oss-restore=* instead. Do not use x-oss-restore=, which matches no objects, so the exclusion rule has no effect.
ossutil restore oss://examplebucket/dir/ -r --tier Standard --days 365 --metadata-exclude "x-oss-restore=*" --metadata-include "x-oss-storage-class=ColdArchive"
Restore Deep Cold Archive objects
The following example restores the Deep Cold Archive object exampleobject.txt in the destination bucket examplebucket and keeps the object in the restored state for 10 days.
ossutil restore oss://examplebucket/exampleobject.txt --tier Standard --days 10
The following example recursively restores all Deep Cold Archive .csv objects in the dir directory of the destination bucket examplebucket and keeps the objects in the restored state for 10 days.
ossutil restore oss://examplebucket/dir/ -r --include "*.csv" --tier Standard --days 10
Billing
You are charged data retrieval fees when you restore Archive, Cold Archive, and Deep Cold Archive objects. For more information, see Data processing fees.
You are charged Put request fees when you restore Archive objects. For more information, see Request fees.
You are charged data retrieval request fees when you restore Cold Archive and Deep Cold Archive objects. For more information, see Request fees.
Archive, Cold Archive, and Deep Cold Archive objects are charged storage fees based on their respective storage classes both while they are being restored and after they are restored. For more information, see Storage fees.
When you restore a Cold Archive or Deep Cold Archive object, a replica of the object is created in the Standard storage class to allow access. While the object is in the restored state, you are charged for the temporary storage of this replica at the rate of the Standard storage class. For more information, see Temporary storage fees.
Archive objects can remain in the restored state for up to 7 days. Cold Archive and Deep Cold Archive objects can remain in the restored state for up to 365 days. No additional data retrieval fees are incurred during this period.
After the restored state ends, the object returns to the frozen state. If you restore the object again, data retrieval fees are incurred.