Tüm Ürünler
Search
Belge Merkezi

Object Storage Service:Restore objects

Son Güncelleme:Oct 01, 2026

OSS'deki Archive, Cold Archive ve Deep Cold Archive nesneleri, depolama maliyetlerini düşürmek için dondurulur. Bu nesneleri indirmek, işlemek veya analiz etmek için önce okunabilir bir duruma getirmeniz gerekir.

Çalışma prensibi

Geri yükleme işlemi, dondurulmuş bir nesnenin depolama sınıfını değiştirmeden geçici ve okunabilir bir kopyasını oluşturur. Nesne şu aşamalardan geçer:

  1. Dondurulmuş durum: Varsayılan durumdur. Nesne okunamaz. Yalnızca meta verileri sorgulayabilir veya nesneyi silebilirsiniz.

  2. Geri yükleniyor: İlk kez bir RestoreObject isteği gönderdiğinizde nesne bu duruma girer. Sunucu isteği eşzamansız olarak işler.

    • API, ilk istek için 202 Accepted yanıtını döndürür.

    • Aynı önceliğe sahip yinelenen bir istek 409 Conflict hatası döndürür. Geri yüklemeyi hızlandırmak için daha yüksek öncelikli bir istek gönderebilirsiniz.

  3. Geri yüklendi: Geçici kopya oluşturulur ve nesne okunabilir hale gelir. Sonraki bir geri yükleme isteği 200 OK döndürür ve kopyanın geçerlilik süresini uzatır.

  4. Kopya süresi doldu: Geçici kopya silinir. Nesneyi tekrar okumak için başka bir geri yükleme isteği gönderin.

Geri yükleme önceliği seçme

Geri yükleme süresi, depolama sınıfına ve önceliğe göre değişir. Gerçek süre farklılık gösterebilir.

Nesne depolama sınıfı

Açıklama

Archive

Genellikle 1 dakika.

Cold Archive

  • Expedited: Geri yükleme genellikle 1 saat içinde tamamlanır.

  • Standard: Geri yükleme genellikle 2 ila 5 saat içinde tamamlanır.

  • Bulk: Geri yükleme genellikle 5 ila 12 saat içinde tamamlanır.

Deep Cold Archive

  • Expedited: Geri yükleme genellikle 12 saat içinde tamamlanır.

  • Standard: Geri yükleme genellikle 48 saat içinde tamamlanır.

Kopya geçerlilik süresi seçme

Kopya geçerlilik süresi, ek veri alma ücretleri ödemeden geri yüklenen bir nesnenin kaç gün boyunca okunabilir kalacağını belirtir. Tek seferlik erişim için 1 gün, tekrarlanan erişimlerde ek geri yükleme maliyetlerinden kaçınmak için daha uzun bir süre ayarlayın.


Nesne depolama sınıfı


Açıklama


Archive


1 ile 7 arasında bir tamsayı. Birim gündür.


Cold Archive


1 ile 365 arasında bir tamsayı. Birim gündür.


Deep Cold Archive


1 ile 365 arasında bir tamsayı. Birim gündür.

Geri yükleme işlemini gerçekleştirme

Bir nesneyi geri yüklemek için aşağıdaki yöntemlerden birini kullanın.

Konsol

Konsol, aynı klasördeki nesnelerin toplu olarak geri yüklenmesini desteklemez. Toplu işlemler için ossutil, SDK'lar veya API kullanın.

  1. OSS konsolu oturumunu açın.

  2. Buckets öğesine tıklayın, ardından hedef paketin adına tıklayın.

  3. Sol gezinme bölmesinde Object Management > Objects seçeneğini belirleyin.

  4. Hedef nesnenin Actions sütununda more > Restore seçeneğini belirleyin. İletişim kutusunda Replica Validity Period ve Restore Priority değerlerini yapılandırın.

SDK

Nesneleri programlı olarak geri yüklemek, esnek otomasyon ve hata işleme sağlamak için bir SDK kullanın.

import com.aliyun.oss.*;
import com.aliyun.oss.common.auth.*;
import com.aliyun.oss.common.comm.SignVersion;
import com.aliyun.oss.model.*;

public class Demo {
    public static void main(String[] args) throws Exception {
        // In this example, the endpoint of the China (Hangzhou) region is used. Specify your actual endpoint. 
        String endpoint = "https://oss-cn-hangzhou.aliyuncs.com";
        // Obtain access credentials from environment variables. Before you run the sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are configured. 
        EnvironmentVariableCredentialsProvider credentialsProvider = CredentialsProviderFactory.newEnvironmentVariableCredentialsProvider();
        // Specify the name of the bucket. Example: examplebucket. 
        String bucketName = "examplebucket";
        // Specify the full path of the Archive object. Do not include the bucket name in the full path. 
        String objectName = "exampledir/object";
        // Specify the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
        String region = "cn-hangzhou";

        // Create an OSSClient instance. 
        // Call the shutdown method to release resources when the OSSClient is no longer in use.
        ClientBuilderConfiguration clientBuilderConfiguration = new ClientBuilderConfiguration();
        clientBuilderConfiguration.setSignatureVersion(SignVersion.V4);        
        OSS ossClient = OSSClientBuilder.create()
        .endpoint(endpoint)
        .credentialsProvider(credentialsProvider)
        .clientConfiguration(clientBuilderConfiguration)
        .region(region)               
        .build();

        try {
            ObjectMetadata objectMetadata = ossClient.getObjectMetadata(bucketName, objectName);

            // Check whether the object is an Archive object. 
            StorageClass storageClass = objectMetadata.getObjectStorageClass();
            if (storageClass == StorageClass.Archive) {
                // Restore the object. 
                ossClient.restoreObject(bucketName, objectName);

                // Specify the time to wait for the object to be restored. 
                do {
                    Thread.sleep(1000);
                    objectMetadata = ossClient.getObjectMetadata(bucketName, objectName);
                } while (!objectMetadata.isRestoreCompleted());
            }

            // Query the restored object. 
            OSSObject ossObject = ossClient.getObject(bucketName, objectName);
            ossObject.getObjectContent().close();
        } catch (OSSException oe) {
            System.out.println("Caught an OSSException, which means your request made it to OSS, "
                    + "but was rejected with an error response for some reason.");
            System.out.println("Error Message:" + oe.getErrorMessage());
            System.out.println("Error Code:" + oe.getErrorCode());
            System.out.println("Request ID:" + oe.getRequestId());
            System.out.println("Host ID:" + oe.getHostId());
        } catch (ClientException ce) {
            System.out.println("Caught an ClientException, which means the client encountered "
                    + "a serious internal problem while trying to communicate with OSS, "
                    + "such as not being able to access the network.");
            System.out.println("Error Message:" + ce.getMessage());
        } finally {
            if (ossClient != null) {
                ossClient.shutdown();
            }
        }
    }
}           
import time
import argparse
import alibabacloud_oss_v2 as oss

# Create a command-line argument parser.
parser = argparse.ArgumentParser(description="restore object sample")
# Add the required command-line arguments.
parser.add_argument('--region', help='The region in which the bucket is located.', required=True)
parser.add_argument('--bucket', help='The name of the bucket.', required=True)
parser.add_argument('--endpoint', help='The domain names that other services can use to access OSS.')
parser.add_argument('--key', help='The name of the object.', required=True)

def main():
    # Parse the incoming command-line arguments.
    args = parser.parse_args()

    # Load authentication information from environment variables.
    credentials_provider = oss.credentials.EnvironmentVariableCredentialsProvider()

    # Use the default SDK configurations.
    cfg = oss.config.load_default()
    # Set the credential provider to environment variable-based authentication.
    cfg.credentials_provider = credentials_provider
    # Set the region.
    cfg.region = args.region
    # If an endpoint is provided, set the endpoint as a configuration item.
    if args.endpoint is not None:
        cfg.endpoint = args.endpoint

    # Create an OSS client.
    client = oss.Client(cfg)

    # Execute the request to restore the object.
    result = client.restore_object(oss.RestoreObjectRequest(
        bucket=args.bucket,
        key=args.key,
        restore_request=oss.RestoreRequest(
            days=1,
            # Optional: Set the restoration priority for Cold Archive or Deep Cold Archive objects. Valid values: Expedited, Standard, and Bulk. Default value: Standard.
            # tier="Bulk",
        )
    ))

    # Print the result of the restore request.
    print(f'status code: {result.status_code},'
          f' request id: {result.request_id},'
          f' version id: {result.version_id},'
          f' restore priority: {result.restore_priority},'
    )

    # Loop to check whether the object is restored.
    while True:
        # Get the object header.
        result = client.head_object(oss.HeadObjectRequest(
            bucket=args.bucket,
            key=args.key,
        ))

        # Check the restored state.
        if result.restore and result.restore != 'ongoing-request="true"':
            print('Restore is successful')
            break
        # Check again after 5 seconds.
        time.sleep(5)
        print(result.restore)

# Program entry point.
if __name__ == "__main__":
    main()
const OSS = require('ali-oss')

const client = new OSS({
  // Set region to the region where the bucket is located. For example, if the bucket is in the China (Hangzhou) region, set region to oss-cn-hangzhou.
  region: 'yourRegion',
  // Obtain access credentials from environment variables. Before you run the sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are set.
  accessKeyId: process.env.OSS_ACCESS_KEY_ID,
  accessKeySecret: process.env.OSS_ACCESS_KEY_SECRET,
  authorizationV4: true,
  // Specify the bucket name. For example, examplebucket.
  bucket: 'examplebucket',
});

// Specify the name of the Archive object to restore. For example, exampleobject.txt.
client.restore('exampleobject.txt').then((res) => {
    console.log(res);
}).catch(err => {
    console.log(err);
})
using Aliyun.OSS;
using Aliyun.OSS.Model;
using Aliyun.OSS.Model;
using System.Net;
using System.Text;
using Aliyun.OSS.Common;

// Specify the endpoint of the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com. 
var endpoint = "yourEndpoint";
// Obtain access credentials from environment variables. Before you run the sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are configured. 
var accessKeyId = Environment.GetEnvironmentVariable("OSS_ACCESS_KEY_ID");
var accessKeySecret = Environment.GetEnvironmentVariable("OSS_ACCESS_KEY_SECRET");
// Specify the name of the bucket. 
var bucketName = "examplebucket";
// Specify the full path of the object. The path cannot contain the bucket name. 
var objectName = "yourObjectName";
// Specify the content of the object. 
var objectContent = "More than just cloud.";
int maxWaitTimeInSeconds = 600;
// Specify the region in which the bucket is located. For example, if the bucket is located in the China (Hangzhou) region, set the region to cn-hangzhou.
const string region = "cn-hangzhou";

// Create a ClientConfiguration instance and modify the default parameters based on your requirements.
var conf = new ClientConfiguration();

// Use the signature algorithm V4.
conf.SignatureVersion = SignatureVersion.V4;

// Create an OSSClient instance.
var client = new OssClient(endpoint, accessKeyId, accessKeySecret, conf);
client.SetRegion(region);
try
{
    // Create an Archive bucket. 
    var bucket = client.CreateBucket(bucketName, StorageClass.Archive);
    Console.WriteLine("Create Archive bucket succeeded, {0} ", bucket.Name);
}
catch (Exception ex)
{
    Console.WriteLine("Create Archive bucket failed, {0}", ex.Message);
}
// Upload the object to the bucket and set the storage class of the object to Archive. 
try
{
    byte[] binaryData = Encoding.ASCII.GetBytes(objectContent);
    MemoryStream requestContent = new MemoryStream(binaryData);
    client.PutObject(bucketName, objectName, requestContent);
    Console.WriteLine("Put object succeeded, {0}", objectName);
}
catch (Exception ex)
{
    Console.WriteLine("Put object failed, {0}", ex.Message);
}
var metadata = client.GetObjectMetadata(bucketName, objectName);
string storageClass = metadata.HttpMetadata["x-oss-storage-class"] as string;
if (storageClass != "Archive")
{
    Console.WriteLine("StorageClass is {0}", storageClass);
    return;
}
// Restore the Archive object. 
RestoreObjectResult result = client.RestoreObject(bucketName, objectName);
Console.WriteLine("RestoreObject result HttpStatusCode : {0}", result.HttpStatusCode);
if (result.HttpStatusCode != HttpStatusCode.Accepted)
{
    throw new OssException(result.RequestId + ", " + result.HttpStatusCode + " ,");
}
while (maxWaitTimeInSeconds > 0)
{
    var meta = client.GetObjectMetadata(bucketName, objectName);
    string restoreStatus = meta.HttpMetadata["x-oss-restore"] as string;
    if (restoreStatus != null && restoreStatus.StartsWith("ongoing-request=\"false\"", StringComparison.InvariantCultureIgnoreCase))
    {
        break;
    }
    Thread.Sleep(1000);
    // The maximum wait time decreases by 1 second. 
    maxWaitTimeInSeconds--;
}
if (maxWaitTimeInSeconds == 0)
{
    Console.WriteLine("RestoreObject is timeout. ");
    throw new TimeoutException();
}
else
{
    Console.WriteLine("RestoreObject is successful. ");
}
// Restore the object.
RestoreObjectRequest restore = new RestoreObjectRequest();
// Specify the bucket name. Example: examplebucket.
restore.setBucketName("examplebucket");
// Specify the full path of the object. Do not include the bucket name in the full path. Example: exampleobject.txt.
restore.setObjectKey("exampleobject.txt");
OSSAsyncTask task = oss.asyncRestoreObject(restore, new OSSCompletedCallback<RestoreObjectRequest,
        RestoreObjectResult>() {
    @Override
    public void onSuccess(RestoreObjectRequest request, RestoreObjectResult result) {
        Log.i("info", "code::"+result.getStatusCode());

    }

    @Override
    public void onFailure(RestoreObjectRequest request, ClientException clientException,
                          ServiceException serviceException) {
        Log.e("errorMessage", "error: "+serviceException.getRawMessage());

    }
});

task.waitUntilFinished();
OSSRestoreObjectRequest *request = [OSSRestoreObjectRequest new];
// Bucket containing the archived object
request.bucketName = @"examplebucket";
// Full path of the object (do not include the bucket name)
request.objectKey = @"exampleobject.txt";

OSSTask *restoreObjectTask = [client restoreObject:request];
[restoreObjectTask continueWithBlock:^id _Nullable(OSSTask * _Nonnull task) {
    if (!task.error) {
        NSLog(@"Restore request submitted successfully");
        // Note: The object is not immediately accessible.
        // Check restoration status before attempting to read.
    } else {
        NSLog(@"Restore request failed: %@", task.error);
        // Handle specific errors (see Error handling section)
    }
    return nil;
}];
// Use synchronous blocking if you need to wait for request submission to complete
// Not recommended for UI thread as it blocks execution
// [restoreObjectTask waitUntilFinished];
#include <alibabacloud/oss/OssClient.h>
#include <thread>
#include <chrono>
#include <algorithm>

using namespace AlibabaCloud::OSS;

int main(void)
{
    /* Initialize OSS account information. */
    
    /* Set yourEndpoint to the Endpoint of the region where the bucket is located. For example, for the China (Hangzhou) region, set the Endpoint to https://oss-cn-hangzhou.aliyuncs.com. */
    std::string Endpoint = "yourEndpoint";
    /* Set yourRegion to the region where the bucket is located. For example, for the China (Hangzhou) region, set the Region to cn-hangzhou. */
    std::string Region = "yourRegion";
    /* Set BucketName to the name of your bucket, for example, examplebucket. */
    std::string BucketName = "examplebucket";
    /* Set ObjectName to the full path of the Archive object. The path does not include the bucket name. */
    std::string ObjectName = "yourObjectName";
  
    /* Initialize network resources. */
    InitializeSdk();
    
    ClientConfiguration conf;
    conf.signatureVersion = SignatureVersionType::V4;
    /* Obtain access credentials from environment variables. Before you run this code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are set. */
    auto credentialsProvider = std::make_shared<EnvironmentVariableCredentialsProvider>();
    OssClient client(Endpoint, credentialsProvider, conf);
    client.SetRegion(Region);
  
    /* Restore the Archive object. */
    auto outcome = client.RestoreObject(BucketName, ObjectName);
    /* Objects that are not in the Archive storage class cannot be restored. */
    if (!outcome.isSuccess()) {
        /* Handle exceptions. */
        std::cout << "RestoreObject fail, code: " << outcome.error().Code() <<
        ", message: " << outcome.error().Message() <<
        ", requestId: " << outcome.error().RequestId() << std::endl;
        return -1;
    }
    std::string onGoingRestore("ongoing-request=\"false\"");
    int maxWaitTimeInSeconds = 600;
    while (maxWaitTimeInSeconds > 0)
    {
        auto meta = client.HeadObject(BucketName, ObjectName);
        std::string restoreStatus = meta.result().HttpMetaData()["x-oss-restore"];
        std::transform(restoreStatus.begin(), restoreStatus.end(), restoreStatus.begin(), ::tolower);
        if (!restoreStatus.empty() && 
        restoreStatus.compare(0, onGoingRestore.size(), onGoingRestore)==0) {
            std::cout << " success, restore status:" << restoreStatus << std::endl;
            /* The Archive object is successfully restored. */
            break;
        }
        std::cout << " info, WaitTime:" << maxWaitTimeInSeconds
        << "; restore status:" << restoreStatus << std::endl;
        std::this_thread::sleep_for(std::chrono::seconds(10));
        maxWaitTimeInSeconds--;     
    }
    if (maxWaitTimeInSeconds == 0)
    {
        std::cout << "RestoreObject fail, TimeoutException" << std::endl;
    }
    /* Release network resources. */
    ShutdownSdk();
    return 0;
}
#include "oss_api.h"
#include "aos_http_io.h"
/* Set yourEndpoint to the endpoint of the region where the bucket is located. For example, if the bucket is in the China (Hangzhou) region, set the endpoint to https://oss-cn-hangzhou.aliyuncs.com. */
const char *endpoint = "yourEndpoint";
/* Specify the bucket name. Example: examplebucket. */
const char *bucket_name = "examplebucket";
/* Specify the full path of the object. The full path cannot contain the bucket name. Example: exampledir/exampleobject.txt. */
const char *object_name = "exampledir/exampleobject.txt";
/* Set yourRegion to the region where the bucket is located. For example, if the bucket is in the China (Hangzhou) region, set the region to cn-hangzhou. */
const char *region = "yourRegion";
void init_options(oss_request_options_t *options)
{
    options->config = oss_config_create(options->pool);
    /* Initialize the aos_string_t type with a char* string. */
    aos_str_set(&options->config->endpoint, endpoint);
    /* Obtain access credentials from environment variables. Before you run this sample code, make sure that the OSS_ACCESS_KEY_ID and OSS_ACCESS_KEY_SECRET environment variables are set. */
    aos_str_set(&options->config->access_key_id, getenv("OSS_ACCESS_KEY_ID"));
    aos_str_set(&options->config->access_key_secret, getenv("OSS_ACCESS_KEY_SECRET"));
    // Configure the following two parameters.
    aos_str_set(&options->config->region, region);
    options->config->signature_version = 4;
    /* Specify whether a CNAME is used. 0 indicates that no CNAME is used. */
    options->config->is_cname = 0;
    /* Set network parameters, such as the timeout period. */
    options->ctl = aos_http_controller_create(options->pool, 0);
}
int main(int argc, char *argv[])
{
    /* Call the aos_http_io_initialize method at the program entry to initialize global resources such as the network and memory. */
    if (aos_http_io_initialize(NULL, 0) != AOSE_OK) {
        exit(1);
    }
    /* A memory pool for memory management. This is equivalent to apr_pool_t. The implementation code is in the apr library. */
    aos_pool_t *pool;
    /* Create a memory pool. The second parameter is NULL, which indicates that the new memory pool does not inherit from another memory pool. */
    aos_pool_create(&pool, NULL);
    /* Create and initialize options. This parameter contains global configuration information, such as endpoint, access_key_id, access_key_secret, is_cname, and curl. */
    oss_request_options_t *oss_client_options;
    /* Allocate memory to options in the memory pool. */  
    oss_client_options = oss_request_options_create(pool);
    /* Initialize the client options oss_client_options. */
    init_options(oss_client_options);
    /* Initialize parameters. */
    aos_string_t bucket;
    aos_string_t object;   
    aos_table_t *headers = NULL;
    aos_table_t *resp_headers = NULL; 
    aos_status_t *resp_status = NULL; 
    aos_str_set(&bucket, bucket_name);
    aos_str_set(&object, object_name);
    headers = aos_table_make(pool, 0);
       
    /* Restore the object. */
    do {
        headers = aos_table_make(pool, 0);
        resp_status = oss_restore_object(oss_client_options, &bucket, &object, headers, &resp_headers);
        printf("restore object resp_status->code: %d \n", resp_status->code);
        if (resp_status->code != 409) {
            break;
        } else {
            printf("restore object is already in progress, resp_status->code: %d \n", resp_status->code);
            apr_sleep(5000);
        }
    } while (1);
    /* Release the memory pool. This releases the memory allocated to resources during the request. */
    aos_pool_destroy(pool);
    /* Release the previously allocated global resources. */
    aos_http_io_deinitialize();
    return 0;
}
package main

import (
	"context"
	"flag"
	"log"

	"github.com/aliyun/alibabacloud-oss-go-sdk-v2/oss"
	"github.com/aliyun/alibabacloud-oss-go-sdk-v2/oss/credentials"
)

// Define global variables for command-line arguments.
var (
	region     string // The OSS region.
	bucketName string // The bucket name.
	objectName string // The object name.
)

// init initializes the command-line flags.
func init() {
	flag.StringVar(&region, "region", "", "The region in which the bucket is located.")
	flag.StringVar(&bucketName, "bucket", "", "The name of the bucket.")
	flag.StringVar(&objectName, "object", "", "The name of the object.")
}

func main() {
	// Parse command-line flags.
	flag.Parse()

	// Check if the bucket name is empty.
	if len(bucketName) == 0 {
		flag.PrintDefaults()
		log.Fatalf("invalid parameters, bucket name required")
	}

	// Check if the region is empty.
	if len(region) == 0 {
		flag.PrintDefaults()
		log.Fatalf("invalid parameters, region required")
	}

	// Check if the object name is empty.
	if len(objectName) == 0 {
		flag.PrintDefaults()
		log.Fatalf("invalid parameters, object name required")
	}

	// Load the default configuration, and set the credential provider and region.
	cfg := oss.LoadDefaultConfig().
		WithCredentialsProvider(credentials.NewEnvironmentVariableCredentialsProvider()).
		WithRegion(region)

	// Create an OSS client.
	client := oss.NewClient(cfg)

	// Create a request to restore the object.
	request := &oss.RestoreObjectRequest{
		Bucket: oss.Ptr(bucketName), // The bucket name.
		Key:    oss.Ptr(objectName), // The object name.
		RestoreRequest: &oss.RestoreRequest{
			Days: 3, // Set the restoration period to 3 days.
		},
	}

	// Send the request to restore the object.
	result, err := client.RestoreObject(context.TODO(), request)
	if err != nil {
		log.Fatalf("failed to restore object %v", err)
	}

	// Print the result.
	log.Printf("restore object result:%#v\n", result)
}
<?php

// Include the autoload file to load dependencies.
require_once __DIR__ . '/../vendor/autoload.php';

use AlibabaCloud\Oss\V2 as Oss;

// Define and describe command-line parameters.
$optsdesc = [
    "region" => ['help' => 'The region in which the bucket is located.', 'required' => True], // (Required) Specify the region in which the bucket is located.
    "endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False], // (Optional) Specify the endpoint for accessing OSS.
    "bucket" => ['help' => 'The name of the bucket', 'required' => True], // (Required) Specify the name of the bucket.
    "key" => ['help' => 'The name of the object', 'required' => True], // (Required) Specify the name of the object.
];

// Convert the descriptions to a list of long options required by getopt.
// Add a colon (:) to the end of each parameter to indicate that a value is required.
$longopts = \array_map(function ($key) {
    return "$key:";
}, array_keys($optsdesc));

// Parse the command-line parameters.
$options = getopt("", $longopts);

// Check whether the required parameters are configured.
foreach ($optsdesc as $key => $value) {
    if ($value['required'] === True && empty($options[$key])) {
        $help = $value['help']; // Obtain help information for the parameters.
        echo "Error: the following arguments are required: --$key, $help" . PHP_EOL;
        exit(1); // Exit the program if a required parameter is missing.
    }
}

// Assign the values parsed from the command-line parameters to the corresponding variables.
$region = $options["region"]; // The region in which the bucket is located.
$bucket = $options["bucket"]; // The name of the bucket.
$key = $options["key"];       // The name of the object.

// Load access credentials from environment variables.
// Use EnvironmentVariableCredentialsProvider to retrieve the AccessKey ID and AccessKey secret from environment variables.
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();

// Use the default configuration of the SDK.
$cfg = Oss\Config::loadDefault();
$cfg->setCredentialsProvider($credentialsProvider); // Specify the credential provider.
$cfg->setRegion($region); // Specify the region in which the bucket is located.
if (isset($options["endpoint"])) {
    $cfg->setEndpoint($options["endpoint"]); // Specify the endpoint if one is provided.
}

// Create an OSSClient instance.
$client = new Oss\Client($cfg);

// Create a RestoreObjectRequest object to restore the Archive object.
$request = new Oss\Models\RestoreObjectRequest(bucket: $bucket, key: $key);

// Restore the object.
$result = $client->restoreObject($request);

// Display the result.
printf(
    'status code:' . $result->statusCode . PHP_EOL . // The HTTP status code. For example, HTTP status code 200 indicates that the request succeeded.
    'request id:' . $result->requestId . PHP_EOL     // The request ID, which can be used to debug or trace the request.
);

ossutil

ossutil, OSS'yi yönetmek için kullanılan bir CLI aracıdır ve betik tabanlı toplu geri yüklemeler için uygundur.

Archive nesnelerini geri yükleme

  • examplebucket paketindeki exampleobject.txt adlı bir Archive nesnesini geri yükleyin:

    ossutil restore oss://examplebucket/exampleobject.txt
  • Bir Archive nesnesini geri yükleyin ve kopya geçerlilik süresini 3 gün olarak ayarlayın:

    ossutil restore oss://examplebucket/exampleobject.txt --days 3
  • Nesneleri bir listeden geri yükleyin.

    Not

    Her satır, oss://{bucket}/{key} biçiminde bir OSS yoludur.

    Örnek list.txt:

    oss://examplebucket/key1
    oss://examplebucket/key2
    ossutil restore list://list.txt
  • Nesne durumunu kontrol etmeden nesneleri bir listeden geri yükleyin.

    ossutil restore list://list.txt --no-check-status 
  • Nesneleri bir envanter dosyasından geri yükleyin.

    Not

    Envanter yapılandırması, bu işlem için gerekli olan bir csv.gz dosyası ve bir manifest.json dosyası oluşturur.

    ossutil restore list://ca8007fc-4123-493e-9a01-dd1511fbac54.csv.gz --list-format inventory --list-manifest-from manifest.json
  • Nesne durumunu kontrol etmeden nesneleri bir envanter dosyasından geri yükleyin.

    ossutil restore list://ca8007fc-4123-493e-9a01-dd1511fbac54.csv.gz --list-format inventory --list-manifest-from manifest.json --no-check-status

Cold Archive nesnelerini geri yükleme

Bir Cold Archive nesnesini geri yükleyin ve kopya geçerlilik süresini 5 gün olarak ayarlayın:

ossutil restore oss://examplebucket/exampleobject.txt --tier Bulk --days 5

Deep Cold Archive nesnelerini geri yükleme

Bir Deep Cold Archive nesnesini geri yükleyin ve kopya geçerlilik süresini 10 gün olarak ayarlayın:

ossutil restore oss://examplebucket/exampleobject.txt --tier Standard --days 10

Daha fazla bilgi için bkz. restore (Nesneleri geri yükleme).

ossbrowser

ossbrowser, konsola benzer paket düzeyinde işlemleri destekler. Nesneleri geri yüklemek için ossbrowser arayüzünü takip edin. Daha fazla bilgi için bkz. Yaygın İşlemler.

API

Yüksek özelleştirme gerektiren ihtiyaçlar için doğrudan REST API istekleri gönderin. İmzaları hesaplamak için kod yazmanız gerekir. Daha fazla bilgi için bkz. RestoreObject.

Faturalandırma


Faturalandırılan öğe


Açıklama


Uygulanabilir depolama sınıfları


Veri alma ücreti


Geri yüklenen veri hacmine (GB) dayalı tek seferlik bir ücret. Bu, geri yüklemenin temel maliyetidir.


Archive, Cold Archive ve Deep Cold Archive


İstek ücreti


Her RestoreObject isteği için ücretlendirilirsiniz.


Archive (Put istekleri olarak faturalandırılır), Cold Archive ve Deep Cold Archive (alma istekleri olarak faturalandırılır)


Depolama ücreti


Depolama ücretleri, depolama sınıfına bağlı olarak geri yükleme sırasında ve sonrasında uygulanır.


Archive, Cold Archive ve Deep Cold Archive


Geçici depolama ücreti


Geçici kopya depolama alanı tüketir. Kopya geçerlilik süresi boyunca günlük olarak ücretlendirilirsiniz.


Cold Archive ve Deep Cold Archive

Kotalar ve sınırlamalar

  • Tek bir bölgedeki tek bir Alibaba Cloud hesabı için Cold Archive nesnelerinin referans geri yükleme kotası ortalama saniyede 500 nesnedir. Üç geri yükleme önceliği için toplam geri yükleme kotası günde 100 TB ile 120 TB arasındadır.İşiniz daha yüksek geri yükleme kotaları gerektiriyorsa Teknik Destek ile iletişime geçin.

  • Tek bir bölgedeki tek bir Alibaba Cloud hesabı için Deep Cold Archive nesnelerinin referans geri yükleme kotası ortalama saniyede 100 nesnedir. İki geri yükleme önceliği için toplam geri yükleme kotası günde 10 TB ile 15 TB arasındadır.İşiniz daha yüksek geri yükleme kotaları gerektiriyorsa Teknik Destek ile iletişime geçin.

Not

Kota aşılırsa geri yükleme istekleri göndermeye devam edebilirsiniz. İstekler kuyruğa alınır ve belirtilen öncelik süresinden daha uzun sürebilir.

SSS