DRAG DROP
You have a SQL Server 2012 database named Database1. Database1 has a data file
named database1_data.mdf and a transaction log file named database1_Log.ldf.
Database1_Data.mdf is 1.5 GB.
Database1_Log.ldf is 1.5 terabytes. A full backup of Database1 is performed every day.
You need to reduce the size of the log file. The solution must ensure that you can
performtransaction log backups in the future. Which code segment should you execute? To
answer,move the appropriate code segments from the list of code segments to the answer
area andarrange them in the correct order.
Explanation:
http://technet.microsoft.com/en-us/library/ms190757.aspx
http://technet.microsoft.com/en-us/library/ms189493.aspx
http://technet.microsoft.com/en-us/library/ms365418.aspx
http://technet.microsoft.com/en-us/library/ms189272.aspx
http://technet.microsoft.com/en-us/library/ms179478.aspx
Simple recovery
DBCC SHRINKFILE
Full recovery
1- Use database1
2-simple recovery
3-DBCC
4-Full recovery
1- Use database1
2-simple recovery
3-DBCC
4-Full recovery
If the transaction log is that big it means the recovery model is already full. It should be enough to:
1 – BACKUP LOG Database1 TO Database1_Log_Backup
2 – USE Database1;
3 – DBCC SHRINKFILE (Database1_Log);
Database1_Log.ldf is 1.5 terabytes. It is not good idea to backup it.
So:
1- Use database1
2- simple recovery
3- DBCC SHRINKFILE(Database1_log)
4- Full recovery
B. Shrinking a log file to a specified target size
The following example shrinks the log file in the AdventureWorks2008R2 database to 1 MB. To allow the DBCC SHRINKFILE command to shrink the file, the file is first truncated by setting the database recovery model to SIMPLE.
Transact-SQL
USE AdventureWorks2008R2;
GO
— Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE AdventureWorks2008R2
SET RECOVERY SIMPLE;
GO
— Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (AdventureWorks2008R2_Log, 1);
GO
— Reset the database recovery model.
ALTER DATABASE AdventureWorks2008R2
SET RECOVERY FULL;
GO
https://technet.microsoft.com/en-us/library/ms189493(v=sql.105).aspx
agree with Vladimir’s answer