When we imported the Mr Data, we found that the disk space was not enough, the result is that our program is likely to throw an exception, we need to import data when the log to thin the body.
Q 1: When importing data, does weight loss result in database exceptions?
- The DBA provides a solution:
Answer question 1:
No problem. Does not create a conflict. But make room for the day to prevent it from being filled.
1. Confirm that the recovery model for M_develop is simple.
See the script below.
Select Recovery_model_desc,name
From sys.databases
where Name= ' M_develop '
2. If not simple. Please change to Simple
Modify the script as follows:
Use [master]
GO
ALTER DATABASE [M_develop] SET RECOVERY simple with no_wait
GO.
3. After the recovery mode is simple. Confirm log size, and percent occupancy: The script is as follows:
DBCC SQLPERF (LOGSPACE)
4. If the database is simple, log space used (%) The log percentage should be smaller.
5. Shrink the log file size
Use M_develop
Go
--Find the log file name of the library
Select Name
From Sys.database_files
Where type_desc= ' log '
--to reduce the log, assuming that the above query results log name M_develop_log, shrink to 10G, then the script is as follows
DBCC SHRINKFILE (M_develop _log,10240)
--Check the log size again
DBCC SQLPERF (LOGSPACE)
(Note: The database schema is changed to simple for performance reasons.) If you do not change it, you need to back up logs, backup log. Not recommended)
SQL Cleanup log file