简体   繁体   English

如何检查 blob 存储上的旧备份 (SQL SERVER)。 我想检查容器中是否存在最近一年的备份文件

[英]how to check old backup (SQL SERVER) on blob storage. I want to check whether last one year backup files present in Container or not

Hi All I want to check last one year backup files on container how can i do it?大家好,我想检查容器上最近一年的备份文件,我该怎么做? checking manually is tedious can any one suggest.任何人都可以建议手动检查很乏味。 I search a lot but i find how to delete these old backup files using power shell script.我搜索了很多,但我发现如何使用电源 shell 脚本删除这些旧备份文件。 can anyone suggest??有人可以建议吗?

For example, to a single blob, you can do like below to get the year of your backup blob create time:例如,对于单个 blob,您可以执行以下操作来获取备份 blob 创建时间的年份:

        String str = "https://0730bowmanwindow.blob.core.windows.net/test/interview2.txt";
        Uri uri = new Uri(str);
        CloudBlockBlob blob = new CloudBlockBlob(uri);
        blob.FetchAttributes();
        DateTime blobtime = blob.Properties.Created.Value.UtcDateTime;
        String year = blobtime.Year.ToString();
        int year2 = Int32.Parse(blobtime.Year.ToString());
        Console.WriteLine("Hello World!" + "\n" + blobtime + "\n" + year + "\n" + year2);

Above code is how to get create year of your single backup file, and Mutiple blob in container is similar.以上代码是如何获取单个备份文件的创建年份,容器中的多个 blob 类似。 Let me know whether this answered your question.:)让我知道这是否回答了您的问题。:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM