Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bring SQL Server database online

I executed the task Take offline of a SQL Server 2008 R2 database.

I cant bring it online!

I tried with

USE master;
GO

ALTER DATABASE [DBNAME] SET ONLINE

I get an error.

User does not have permission to alter database 'DBNAME', the database does not exist, or the database is not in a state that allows access checks.

I also tried using the task Bring online and I get the exact same error.

Can anyone help me asap?

like image 985
Tony Avatar asked Apr 17 '12 15:04

Tony


People also ask

How do I access SQL database online?

Start the SQL Server, in the dialog window for the Server name enters the name of the instance that you want to connect with. From the Authentication drop down box, select the SQL Server Authentication and for the field Login and the Password enter your credentials then click the Connect button.

How can I turn my database online?

Bringing Database Online Using SSMSLogin to SQL Server Management Studio. In the Object Explorer, right-click the offline database. In the right-click menu select Tasks >> Bring Online. On selecting Bring Online, a popup window will open and display the status of the action.

How can I get my database online from offline?

Steps to Bring MS SQL Database Online Once you are done with transferring the database files, you will require to bring the database online again. For that, again expand the Databases option and locate your offline database. Right click the database and select Tasks >> Bring Online.


1 Answers

I think you're going to need to login with the SA account, or some other account with sysadmin privileges, and then run your code to put it back online. While you're in there, add sysadmin to your account, too. If you don't own the database, you may need to talk to someone else to get the SA password, or ask them to do it for you. Unless you don't have the SA password or it's been dumbed down for security reasons.

like image 125
Russell Fox Avatar answered Sep 28 '22 22:09

Russell Fox