If you get an error that reads The statement BACKUP LOG is not allowed while the recovery model is SIMPLE when trying to back up a database in SQL Server or Azure SQL Edge, it’s because you’re trying to back up the transaction logs on a database that uses the simple recovery model.
To fix this, change the recovery model to either full or bulk logging.
The Error
Here’s an example of T-SQL code that results in the error:
BACKUP LOG Music
TO DISK = '/var/opt/mssql/backups/Music.trn';
Result:
Msg 4208, Level 16, State 1, Line 1 The statement BACKUP LOG is not allowed while the recovery model is SIMPLE. Use BACKUP DATABASE or change the recovery model using ALTER DATABASE.
The Cause
As mentioned, the error is caused when you try to back up the transaction logs on a database that uses the simple recovery model.
The simple recovery model doesn’t support log backups.
The Solution
To overcome this issue, set the database recovery model to either FULL
or BULK_LOGGED
:
USE master;
ALTER DATABASE Music
SET RECOVERY FULL;
That example set the database to full recovery mode.
However, you will also need to perform at least one full database backup before you start backing up your transaction logs. If you don’t do this, you’ll get error 4214, which states that BACKUP LOG cannot be performed because there is no current database backup.
Here’s an example of performing a full database backup:
BACKUP DATABASE Music
TO DISK = '/var/opt/mssql/backups/Music.bak'
WITH FORMAT;
Now the transaction logs can be backed up as required:
BACKUP LOG Music
TO DISK = '/var/opt/mssql/backups/Music.trn';
Result:
Processed 3 pages for database 'Music', file 'Music_log' on file 1.
Using Azure SQL Edge?
If you use Azure SQL Edge, you might find this issue happens a lot. That’s probably because databases created with SQL Edge use the simple recovery model by default. And that’s because the model
database uses the simple recovery model.
You can always change the recovery model on the model
database to FULL
, which will result in subsequent databases using full recovery mode by default.
MurCode
- Форумы
- Поиск
- О проекте
Бэкап лога
Kikbox
Дата: 11.03.2008 12:23:35
Делаю бэкап лога:
backup log sitex
ошибка:
Инструкция BACKUP LOG недопустима в модели восстановления SIMPLE. Используйте инструкцию BACKUP DATABASE или измените модель восстановления с помощью инструкции ALTER DATABASE.
в чем причина?
Glory
Дата: 11.03.2008 12:24:19
Причина описана в сообщении — «недопустима в модели восстановления SIMPLE»
Denis A.
Дата: 11.03.2008 19:39:02
Kikbox |
Делаю бэкап лога: backup log sitex ошибка: Инструкция BACKUP LOG недопустима в модели восстановления SIMPLE. Используйте инструкцию BACKUP DATABASE или измените модель восстановления с помощью инструкции ALTER DATABASE. в чем причина? |
Каков слово из ошибки неясно?
Kikbox
Дата: 12.03.2008 12:10:18
Все разобрался
вопрос отпал.
- Remove From My Forums
-
Question
-
Hi All,
SQL newbie here. I just looked at my Job Activity monitor and found that my Transaction log backups are failing. I looked at the error and it read as follows:
Executing the query «BACKUP LOG [OperationsManager] TO DISK = N’D:\SQL\MSSQL.1\MSSQL\Backup\OperationsManager\OperationsManager_backup_200805061000.trn’ WITH RETAINDAYS = 1, NOFORMAT, NOINIT, NAME = N’OperationsManager_backup_20080506100001′, SKIP, REWIND, NOUNLOAD, STATS = 10
» failed with the following error: «The statement BACKUP LOG is not allowed while the recovery model is SIMPLE. Use BACKUP DATABASE or change the recovery model using ALTER DATABASE.
BACKUP LOG is terminating abnormally.». Possible failure reasons: Problems with the query, «ResultSet» property not set correctly, parameters not set correctly, or connection not established correctly.I read some of the posts regarding this error, but I am not sure how to do the steps. How do I change the recovery model? I am new to this so I have no clue how to do this.
Any help would be greatly appreciated.
Thank you.
Answers
-
To set FULL RECOVERY on all databases, you can do the following:
Code Snippet
EXEC sp_msforeachdb ‘ALTER DATABASE [?] SET RECOVERY FULL’
This is an undocumented procedure that will execute the command in quotes for every database, while substituting the database name for the ?.
Skip to content
DPM cannot backup SQL database with transactions log while recovery model of database is SIMPLE. You have to just change “Recovery model” of your DB in SQL Server Management Studio.
1) Log on SQL Server Management Studio
2) Right click on database – Properties
3) In the left pane choose Options
4) Set the recovery model to Full
OR
Create a new SQL Query (use “New query” button on the standart bar):
USE YourDBNameHere ;
ALTER DATABASE YourDBNameHere SET RECOVERY FULL ;
5) Open your DPM Console and run Consistency Check on all databases with the same error.
0 / 0 / 0 Регистрация: 15.05.2020 Сообщений: 10 |
|
1 |
|
Инкрементальный бэкап10.01.2023, 21:11. Показов 2879. Ответов 8
Всем привет, перерыл множество ссылок, книг, но так и не нашел как создавать инкрементальный бэкап, везде только определения, либо программы по автоматическому созданию бэкапа, а мне нужен скрипт на скюле( вс ФУЛЛ — 60 гигов пн дифф — 26 гигов вт дифф — 37 гигов ср дифф — 38 гигов чт дифф — 40 гигов пт дифф — 45 гигов сб дифф — 48 гигов
И как я понимаю инкрементный бэкап писал бы только разницу между диффами (ну и в пн разницу с фулла), то есть существенно меньше (примерно 11, 1, 2, 5, 3).
0 |
Programming Эксперт 94731 / 64177 / 26122 Регистрация: 12.04.2006 Сообщений: 116,782 |
10.01.2023, 21:11 |
Ответы с готовыми решениями: Бэкап MS SQL БД Бэкап базы… Не могли бы Вы (у кого из вас конечно она есть) выложить бэкап базы данных… Бэкап Базы Не удалось выполнить бэкап БД Бэкап средствами SQL? 8 |
108 / 100 / 37 Регистрация: 14.10.2022 Сообщений: 424 |
|
11.01.2023, 11:39 |
2 |
Эээ… Инкрементальный бэкап, в терминах MSSQLSERVER — и есть разностный. Всё, больше никаких чудес. Можно, конечно, делать бэкапы отдельных файловых групп и т.д., но вам это не нужно.
1 |
87 / 65 / 24 Регистрация: 27.07.2022 Сообщений: 196 |
|
11.01.2023, 12:41 |
3 |
Эээ… Инкрементальный бэкап, в терминах MSSQLSERVER — и есть разностный. А разве не бэкап лога, по сути?
1 |
Даниил001 0 / 0 / 0 Регистрация: 15.05.2020 Сообщений: 10 |
||||
11.01.2023, 13:57 [ТС] |
4 |
|||
Да, похоже действительно это бэкап лога, спасибо!
Ведь если я заменю на BACKUP DATABASE, получится просто бэкап базы данных, а не ее лога. Поможет ли если изменить модель восстановления с помощью инструкции ALTER DATABASE, как рекомендует скюль?
0 |
299 / 185 / 92 Регистрация: 12.04.2022 Сообщений: 735 |
|
11.01.2023, 14:13 |
5 |
Да.
0 |
108 / 100 / 37 Регистрация: 14.10.2022 Сообщений: 424 |
|
11.01.2023, 14:15 |
6 |
А разве не бэкап лога, по сути? Да черт его знает. Нет такого понятия.
0 |
0 / 0 / 0 Регистрация: 15.05.2020 Сообщений: 10 |
|
11.01.2023, 14:49 [ТС] |
7 |
Alter database ведь изменяет саму базу данных, производит манипуляции с ней, вроде вот этого Если сделать так с имеющимися БД, продолжат ли они нормально функционировать
0 |
108 / 100 / 37 Регистрация: 14.10.2022 Сообщений: 424 |
|
11.01.2023, 15:34 |
8 |
ALTER DATABASE MyDatabase SET RECOVERY BULK-LOGGED; Будьте осторожны. Вы должны будете: Не используйте BULK_LOGGED. Используйте simple, если вы собираетесь восстанавливаться по состоянию на момент создания бэкапа, или используйте FULL, если вы хотите иметь возможность восстановиться на любой момент времени.
1 |
0 / 0 / 0 Регистрация: 15.05.2020 Сообщений: 10 |
|
11.01.2023, 19:17 [ТС] |
9 |
Спасибо, учту!
0 |