Hello all ,
While working today , I got one error saying log file for my Database is full..
so for this i did some R&D and come with following queries
Hope they will help you all
1) How to check DB details
--check DB details
SELECT DB_NAME(database_id) AS DatabaseName,
Name AS Logical_Name,
Physical_Name, (size*8)/1024 SizeMB
FROM sys.master_files
WHERE DB_NAME(database_id) = 'yourDatabaseName'
--here yourDatabaseName is the name of your database
2) check the size for specific DB
select * from sys.databases where name = 'yourDatabaseName'
While working today , I got one error saying log file for my Database is full..
so for this i did some R&D and come with following queries
Hope they will help you all
1) How to check DB details
--check DB details
SELECT DB_NAME(database_id) AS DatabaseName,
Name AS Logical_Name,
Physical_Name, (size*8)/1024 SizeMB
FROM sys.master_files
WHERE DB_NAME(database_id) = 'yourDatabaseName'
--here yourDatabaseName is the name of your database
2) check the size for specific DB
select * from sys.databases where name = 'yourDatabaseName'
--here yourDatabaseName is the name of your database
3) shrink the file (any log or MDF)
DBCC SHRINKFILE(yourDatabaseLogFileName, 1)
--here yourDatabaseLogFileName is the name of log file of your database
4) Displaying log space information for all databases
DBCC SQLPERF(LOGSPACE);
5) Check the recovery model of the Database to full or simple
SELECT name, recovery_model_desc
FROM sys.databases
WHERE name = 'yourDatabaseName'
--here yourDatabaseName is the name of your database
6) change the recovery model of the Database to full or simple
GO
ALTER DATABASE yourDatabaseName
SET RECOVERY FULL
--here yourDatabaseName is the name of your database
ALSO below are some important links which helps me to find the solutions
http://blog.sqlauthority.com/2010/09/20/sql-server-how-to-stop-growing-log-file-too-big/
http://www.sqlskills.com/blogs/kimberly/8-steps-to-better-transaction-log-throughput/
http://mstech.inapp.com/?q=delete-sql-server-database-transaction-log-file
Hope it will help you and save your time ..
6) change the recovery model of the Database to full or simple
GO
ALTER DATABASE yourDatabaseName
SET RECOVERY FULL
--here yourDatabaseName is the name of your database
ALSO below are some important links which helps me to find the solutions
http://blog.sqlauthority.com/2010/09/20/sql-server-how-to-stop-growing-log-file-too-big/
http://www.sqlskills.com/blogs/kimberly/8-steps-to-better-transaction-log-throughput/
http://mstech.inapp.com/?q=delete-sql-server-database-transaction-log-file
Hope it will help you and save your time ..
No comments:
Post a Comment