Копирование базы

Администрирование баз данных (Pervasive.SQL, MS SQL, Oracle, утилита Support)

Модераторы: m0p3e, edward_K, Модераторы

Ответить
maikl
Местный житель
Сообщения: 1503
Зарегистрирован: 29 мар 2005, 17:49
Откуда: Тверь

Копирование базы

Сообщение maikl »

Выполняю в MS SQL 2005 такой скрипт по архивации базы


BACKUP DATABASE [Galaxy] TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\Galaxy.bak' WITH NOFORMAT, NOINIT, NAME = N'Galaxy-Полная База данных Резервное копирование', SKIP, NOREWIND, NOUNLOAD, STATS = 1
GO

Почему то при копировании происходит добавление копии к предыдущей, т.е. ежедневно увеличивается размер сохраняемой копии. Не пойму почему она не ложится вместо старой. В чем загвоздка, может кто подскажет?
thor
Местный житель
Сообщения: 289
Зарегистрирован: 29 мар 2005, 17:49
Откуда: Saint-Petersburg
Контактная информация:

Сообщение thor »

Да вроде все в соответствии с докой :smile:

Думаю, замена NOINIT на INIT вам поможет...
Den
Местный житель
Сообщения: 1842
Зарегистрирован: 29 мар 2005, 17:49
Откуда: Ярославская область ОАО "Часовой завод Чайка" г. Углич
Контактная информация:

Сообщение Den »

SQL BOL :

INIT

Specifies that all backup sets should be overwritten, but preserves the media header. If INIT is specified, any existing backup set data on that device is overwritten.

The backup media is not overwritten if any one of the following conditions is met:

All backup sets on the media have not yet expired. For more information, see the EXPIREDATE and RETAINDAYS options.


The backup set name given in the BACKUP statement, if provided, does not match the name on the backup media. For more information, see the NAME clause.
Use the SKIP option to override these checks. For more information about interactions when using SKIP, NOSKIP, INIT, and NOINIT, see the Remarks section.



Note If the backup media is password protected, SQL Server does not write to the media unless the media password is supplied. This check is not overridden by the SKIP option. Password-protected media may be overwritten only by reformatting it. For more information, see the FORMAT option.


NOINIT

Indicates that the backup set is appended to the specified disk or tape device, preserving existing backup sets. NOINIT is the default.

The FILE option of the RESTORE command is used to select the appropriate backup set at restore time. For more information, see RESTORE.

If a media password is defined for the media set, the password must be supplied.



Ну вообщем thor все сказал уже..
maikl
Местный житель
Сообщения: 1503
Зарегистрирован: 29 мар 2005, 17:49
Откуда: Тверь

Сообщение maikl »

Да INIT, помогло. Спасибо. Вот что значит плохо читать документацию. :cool: :cool:
Ответить