Tuesday, 31 December 2013

How to recover a Database when the below issues occurs.

In this Scenario, the database will be unavailable  and not in suspect mode

1) when the log file is full and log file drive does not have any free space
2) No option to expand the existing storage
3) No impact on Data loss
4)Log file is not corrupted
 

Solution

1) Change the database Status to Emergency State

ALTER DATABASE [DBName]SET EMERGENCY ;

2)In this Mode , you will able to truncate database by changing the  recovery model to Simple.

In order to enable recovery you need to put the Database in Single User mode

3) ALTER DATABASE [DBName]SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

4)DBCC CHECKDB (DBName, REPAIR_ALLOW_DATA_LOSS);

Once DBCC CheckDb completed , Database will be online and accessible in single user mode.


5)ALTER DATABASE [DBName] SET  MULTI_USER;

Now Database will be online and accessible for further operation. 
So you can shrink the log file and release the space to system.

Hope this works.



 to enable recovery you need to put the database into SINGLE_USER
mode as well. To do so, execute - See more at: http://solutioncenter.apexsql.com/recover-data-from-detached-corrupt-sql-server-database/#sthash.Czk29S3a.dpuf

In order to enable recovery you need to put the database into SINGLE_USER
mode as well. To do so, execute - See more at: http://solutioncenter.apexsql.com/recover-data-from-detached-corrupt-sql-server-database/#sthash.Czk29S3a.dpuf


In 

Sunday, 29 December 2013

WELCOME TO SQL SERVER MANTRA

This Blog is Fully dedicated for SQL SERVER to create ,share and explore the  ideas about the SQL Server in the relational database management system world.