Posts

Showing posts with the label SQL

SQL daily backup

Image
 https://solutioncenter.apexsql.com/create-daily-database-backups-with-unique-names-in-sql-server/ Create daily database backups with unique names in SQL Server I found this post and tested work for me. Introduction When working with a large number of databases on multiple SQL Servers, creating a foolproof disaster recovery plan can be challenging. Well organized backup and restore strategies will definitely help with this. In order to successfully implement these strategies in a larger environment, configuring automated backup and restore processes is a must. Some database administrators use the batch or power shell scripts for automation, while others prefer to use various 3 rd  party solutions. In both cases, it is necessary to format database backup names properly. Properly formatted backup names make the job of organizing and maintaining the backup sets much easier. Old backup files are usually obsolete, and they can be easily identified and deleted from the drive either ...

Getting the Database Out of Restoring Mode

Getting the Database Out of Restoring Mode https://documentation.commvault.com/commvault/v11/article?p=105030.htm   Solution Open SQL Management Studio. Check the Commvault databases to see if any of it is stuck in the  Restoring...  mode. If a database is stuck, then use the following query to reset the database: RESTORE DATABASE [DVSB] WITH RECOVERY The above query will not work if the database is locked by another user. Perform the following steps when the database is locked by another user: Flush off all other users and get exclusive access to the database using the following query: USE master GO ALTER DATABASE [DVSB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE Re-run the following query: RESTORE DATABASE [DVSB] WITH RECOVERY Set the database back to multi-user mode using the following query: ALTER DATABASE [DVSB] SET MULTI_USER WITH ROLLBACK IMMEDIATE

SQL SERVER – Database Stuck in Restoring State

  SQL SERVER – Database Stuck in Restoring State https://blog.sqlauthority.com/2014/10/24/sql-server-database-stuck-in-restoring-state/ Here is one of the very common questions I keep on getting via email. “I just restored all the backup files of my database, however, my database is still stuck in restoring state. How do I fix it?” Well, if you have already restored all the databases, you can execute the following code and it will bring your database from recovery to an operational state. RESTORE DATABASE  NameofDatabase WITH  RECOVERY If due to any reason, the above query returns an error about restoring log files or any other file and you do not have that file in your hand, you can run the following command. Remember above command will roll forward your database and you will be not able to restore any other database after that. RESTORE DATABASE  NameofDatabase WITH  RECOVERY , REPLACE If you are not sure what to do, leave a comment and I will help you out with...

Resolve SQL Database Stuck in Restoring State Issue

Image
  Resolve SQL Database Stuck in Restoring State Issue https://www.sqlmvp.org/fix-sql-database-stuck-in-restoring-state/ SQL is a famous database management system used over the globe. Even though it’s a developed application, SQLs data should be upheld up every now and then. SQL administrators create the backup of the databases to avoid data loss situations. But sometimes the SQL administrators have to face the SQL database stuck in Restoring state issues. Due to this, the database is not accessible to users. Therefore, in this blog, we will discuss the reasons behind the issue SQL Database stuck in restoring state and the best possible solution to fix this issue. Before proceeding further let us have a look at reasons first.   Reason Behind SQL Database Stuck in Restoring State The Restoring state in SQL Server states that the user has started the database restore process with RESTORE COMMAND or LOG T SQL Command. It means the SQL database is not available for the end-user un...

Fix Recovery Pending State in SQL Server Database

Fix Recovery Pending State in SQL Server Database https://mstechtalk.com/fix-recovery-pending-state-sql-server/ ALTER DATABASE [DVSB] SET EMERGENCY; GO ALTER DATABASE [DVSB] set single_user GO DBCC CHECKDB ([DVSB], REPAIR_ALLOW_DATA_LOSS) WITH ALL_ERRORMSGS; GO ALTER DATABASE [DVSB] set multi_user GO