Резервное копирование 1C для MS SQL
Материал из LinTest Wiki
(Различия между версиями)
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) |
||
Строка 1: | Строка 1: | ||
+ | <source lang="sql"> | ||
BACKUP DATABASE [budget] TO DISK = N'd:\backup\budget.bak' WITH INIT, NOUNLOAD, NAME = N'budget backup', NOSKIP, STATS = 10, NOFORMAT | BACKUP DATABASE [budget] TO DISK = N'd:\backup\budget.bak' WITH INIT, NOUNLOAD, NAME = N'budget backup', NOSKIP, STATS = 10, NOFORMAT | ||
BACKUP LOG [budget] WITH TRUNCATE_ONLY | BACKUP LOG [budget] WITH TRUNCATE_ONLY | ||
Строка 5: | Строка 6: | ||
DBCC SHRINKFILE (budget_log, TRUNCATEONLY) | DBCC SHRINKFILE (budget_log, TRUNCATEONLY) | ||
GO | GO | ||
+ | </source> | ||
+ | <source lang="cmd"> | ||
d:\WinRAR.exe a d:\backup\bud_ -agYYYY-MM-DD_HH-MM d:\backup\budget.bak d:\1SBase\budget\*.* | d:\WinRAR.exe a d:\backup\bud_ -agYYYY-MM-DD_HH-MM d:\backup\budget.bak d:\1SBase\budget\*.* | ||
+ | </source> | ||
=== Уменьшение размера log файла в SQL Server 2008 === | === Уменьшение размера log файла в SQL Server 2008 === | ||
+ | <source lang="sql"> | ||
USE budget; | USE budget; | ||
ALTER DATABASE budget SET RECOVERY SIMPLE; | ALTER DATABASE budget SET RECOVERY SIMPLE; | ||
DBCC SHRINKFILE(budget_log, 0); | DBCC SHRINKFILE(budget_log, 0); | ||
ALTER DATABASE budget SET RECOVERY FULL; | ALTER DATABASE budget SET RECOVERY FULL; | ||
+ | </source> | ||
+ | |||
+ | === Контроль соединений === | ||
+ | |||
+ | <source lang="sql"> | ||
+ | select program_name,net_transport | ||
+ | from sys.dm_exec_sessions as t1 | ||
+ | left join sys.dm_exec_connections AS t2 ON t1.session_id=t2.session_id | ||
+ | where not t1.program_name is null | ||
+ | </source> |
Текущая версия на 22:13, 25 сентября 2015
BACKUP DATABASE [budget] TO DISK = N'd:\backup\budget.bak' WITH INIT, NOUNLOAD, NAME = N'budget backup', NOSKIP, STATS = 10, NOFORMAT BACKUP LOG [budget] WITH TRUNCATE_ONLY USE budget GO DBCC SHRINKFILE (budget_log, TRUNCATEONLY) GO
d:\WinRAR.exe a d:\backup\bud_ -agYYYY-MM-DD_HH-MM d:\backup\budget.bak d:\1SBase\budget\*.*
[править] Уменьшение размера log файла в SQL Server 2008
USE budget; ALTER DATABASE budget SET RECOVERY SIMPLE; DBCC SHRINKFILE(budget_log, 0); ALTER DATABASE budget SET RECOVERY FULL;
[править] Контроль соединений
select program_name,net_transport from sys.dm_exec_sessions as t1 left join sys.dm_exec_connections AS t2 ON t1.session_id=t2.session_id where not t1.program_name is null