USE master
ALTER DATABASE [TargetDB] SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE;
RESTORE DATABASE [TargetDB]
FROM DISK = N'C:\SQL_Backup\TargetDB.bak'
WITH FILE = 1,
MOVE N'TargetDB' TO N'C:\MSSQL\SQLData\TargetDB.mdf',
MOVE N'TargetDB_Log' TO N'C:\MSSQL\SQLLog\TargetDB_Log.ldf',
NOUNLOAD, REPLACE, STATS = 1;
Use TargetDB
ALTER DATABASE TargetDB SET RECOVERY SIMPLE;
DBCC SHRINKFILE ([TargetDB_Log], 1);
ALTER DATABASE [TargetDB] SET RECOVERY FULL;
ALTER DATABASE [TargetDB] SET MULTI_USER WITH ROLLBACK IMMEDIATE;
'[ Programing ] > Database' 카테고리의 다른 글
[MySQL] 현재 날짜에서 시간 계산 (0) | 2023.01.16 |
---|---|
[MySQL] UNIX_TIMESTAMP / FROM_UNIXTIME (0) | 2022.11.10 |
MS-SQL SSMS 원격 접속 Error 18456 그리고 ErrorLog 없을 때. (0) | 2021.12.06 |
MS-SQL DB 생성하기. (DB Instance) (0) | 2021.12.03 |
MS-SQL SET TRANSACTION ISOLATION LEVEL (0) | 2021.12.02 |