2015-01-06 3 views
1

Я хотел бы сделать резервную копию базы данных в SQL Server 2008 R2 с помощью запроса. Я реализовал этот запросЗапрос на резервное копирование базы данных SQL дает ошибку

BACKUP DATABASE Test TO DISK='D:\bakup.bak' 

Но я получаю сообщение об ошибке

Msg 3013, уровень 16, состояние 1, строка 1
Невозможно открыть устройство резервного копирования 'D: \ bakup.bak'. Ошибка операционной системы 21 (Устройство не готово).
BACKUP DATABASE завершается аномально.

Я не знаю, почему, пожалуйста, помогите

+1

Является ли каталог D: \ доступен и делает процесс SQL Server имеют соответствующие права на запись в этот каталог ? Что такое D? Лента, внешний накопитель, сетевой диск? –

+0

@BerndLinde: 'D' - это имя моей папки, где я хочу сохранить свою резервную копию базы данных. –

+0

D - буква диска, какой тип диска? Папка будет подчиненной директорией на диске D. –

ответ

1

резервного копирования базы данных будет создан на компьютере, где SQL Server работает - что может быть удаленный сервер где-то - и не на своем локальном компьютере ,

Итак, вопрос в том, имеет ли этот серверный компьютер привод D: и может ли там процесс SQL Server писать?

+1

Да, я пошел, и я увидел, что резервная копия была создана с дорожкой, которая показывалась, когда я делал резервную копию. Спасибо Marc_S теперь я получил идею, в основном там, где она хранится. Большое спасибо..!!! –

0

Попробуйте это, Refer Here

Чтобы создать резервную копию базы данных с помощью среды SQL Server Management Studio,

1. After connecting to the appropriate instance of the Microsoft SQL Server Database Engine, in Object Explorer, click the server name to expand the server tree. 

2. Expand Databases, and depending on the database, either select a user database or expand System Databases and select a system database. 

3. Right-click the database, point to Tasks, and then click Back Up. The Back Up Database dialog box appears. 

4. In the Database list box, verify the database name. You can optionally select a different database from the list. 

5. You can perform a database backup for any recovery model (FULL, BULK_LOGGED, or SIMPLE). 

6. In the Backup type list box, select Full. 

Note that after creating a full database backup, you can create a differential database backup; for more information, see Create a Differential Database Backup (SQL Server). 

7. Optionally, you can select Copy Only Backup to create a copy-only backup. A copy-only backup is a SQL Server backup that is independent of the sequence of conventional SQL Server backups. For more information, see Copy-Only Backups (SQL Server). 

Note When the Differential option is selected, you cannot create a copy-only backup. 

8. For Backup component, click Database. 

9. Either accept the default backup set name suggested in the Name text box, or enter a different name for the backup set. 

10.Optionally, in the Description text box, enter a description of the backup set. 

11.Choose the type of backup destination by clicking Disk, Tape or URL. To select the paths of up to 64 disk or tape drives containing a single media set, click Add. The selected paths are displayed in the Backup to list box. 
To remove a backup destination, select it and click Remove. To view the contents of a backup destination, select it and click Contents. 

12. To view or select the media options, click Media Options in the Select a page pane. 

13. Select an Overwrite Media option, by clicking one of the following: 
Back up to the existing media set 
For this option, click either Append to the existing backup set or Overwrite all existing backup sets. For more information, see Media Sets, Media Families, and Backup Sets (SQL Server). 
Optionally, select Check media set name and backup set expiration to cause the backup operation to verify the date and time at which the media set and backup set expire. 
Optionally, enter a name in the Media set name text box. If no name is specified, a media set with a blank name is created. If you specify a media set name, the media (tape or disk) is checked to see whether the actual name matches the name you enter here. 
Important note Important 
This option is disabled if you selected URL as the backup destination in the General page. For more information, see Back Up Database (Media Options Page) 
If you plan to use encryption, do not select this option. If you select this option, the encryption options in the Backup Options page will be disabled. Encryption is not supported when appending to the existing backup set. 
Back up to a new media set, and erase all existing backup sets 
For this option, enter a name in the New media set name text box, and, optionally, describe the media set in the New media set description text box. 
Important note Important 
This option is disabled if you selected URL in the General page. These actions are not supported when backing up to Windows Azure storage. 

14. In the Reliability section, optionally check: 
Verify backup when finished. 
Perform checksum before writing to media, and, optionally, Continue on checksum error. For information on checksums, see Possible Media Errors During Backup and Restore (SQL Server). 

15. If you are backing up to a tape drive (as specified in the Destination section of the General page), the Unload the tape after backup option is active. Clicking this option activates the Rewind the tape before unloading option. 
Note Note 
The options in the Transaction log section are inactive unless you are backing up a transaction log (as specified in the Backup type section of the General page). 

16. To view or select the backup options, click Backup Options in the Select a page pane. 

17. Specify when the backup set will expire and can be overwritten without explicitly skipping verification of the expiration data: 
To have the backup set expire after a specific number of days, click After (the default option), and enter the number of days after set creation that the set will expire. This value can be from 0 to 99999 days; a value of 0 days means that the backup set will never expire. 
The default value is set in the Default backup media retention (in days) option of the Server Properties dialog box (Database Settings Page). To access this, right-click the server name in Object Explorer and select properties; then select the Database Settings page. 
To have the backup set expire on a specific date, click On, and enter the date on which the set will expire. 
For more information about backup expiration dates, see BACKUP (Transact-SQL). 

18. SQL Server 2008 Enterprise and later supports backup compression. By default, whether a backup is compressed depends on the value of the backup-compression default server configuration option. However, regardless of the current server-level default, you can compress a backup by checking Compress backup, and you can prevent compression by checking Do not compress backup. 
To view or change the current backup compression default 
View or Configure the backup compression default Server Configuration Option 

19. Specify whether to use encryption for the backup. Select an encryption algorithm to use for the encryption step, and provide a Certificate or Asymmetric key from a list of existing certificates or asymmetric keys. Encryption is supported in SQL Server 2014 or later. For more details on the Encryption options, see Back Up Database (Backup Options Page). 
Смежные вопросы