When restoring a backup, how do I disconnect all active connections?

You want to set your db to single user mode, do the restore, then set it back to multiuser: ALTER DATABASE YourDB SET SINGLE_USER WITH ROLLBACK AFTER 60 –this will give your current connections 60 seconds to complete –Do Actual Restore RESTORE DATABASE YourDB FROM DISK = ‘D:\BackUp\YourBaackUpFile.bak’ WITH MOVE ‘YourMDFLogicalName’ TO ‘D:\Data\YourMDFFile.mdf’, MOVE ‘YourLDFLogicalName’ … Read more

What is the `git restore` command and what is the difference between `git restore` and `git reset`?

I have presented git restore (which is still marked as “experimental”) in “How to reset all files from working directory but not from staging area?”, with the recent Git 2.23 (August 2019). It helps separate git checkout into two commands: one for files (git restore), which can cover git reset cases. one for branches (git … Read more

How to restore to a different database in SQL Server?

You can create a new db then use the “Restore Wizard” enabling the Overwrite option or: View the contents of the backup file: RESTORE FILELISTONLY FROM DISK=’c:\your.bak’ note the logical names of the .mdf & .ldf from the results, then: RESTORE DATABASE MyTempCopy FROM DISK=’c:\your.bak’ WITH MOVE ‘LogicalNameForTheMDF’ TO ‘c:\MyTempCopy.mdf’, MOVE ‘LogicalNameForTheLDF’ TO ‘c:\MyTempCopy_log.ldf’ This … Read more

How to take backup of a single table in a MySQL database?

Dump and restore a single table from .sql Dump mysqldump db_name table_name > table_name.sql Dumping from a remote database mysqldump -u <db_username> -h <db_host> -p db_name table_name > table_name.sql For further reference: http://www.abbeyworkshop.com/howto/lamp/MySQL_Export_Backup/index.html Restore mysql -u <user_name> -p db_name mysql> source <full_path>/table_name.sql or in one line mysql -u username -p db_name < /path/to/table_name.sql Dump and … Read more

SQL Server: Database stuck in “Restoring” state

I had this situation restoring a database to an SQL Server 2005 Standard Edition instance using Symantec Backup Exec 11d. After the restore job completed the database remained in a “Restoring” state. I had no disk space issues– the database simply didn’t come out of the “Restoring” state. I ran the following query against the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)