October 28, 2009 at 4:54 am
Hi ,
Is there a Way to shutdown and startup a single Database (like Oracle) in sqlserver.
I know that there is a T-sql command which can be executed on SSMS.
i.e SHUTDOWN
and SHUTDOWN NOWAIT
But does a bounce of the Whole instance and not indiviudually.
Any help appericiated..
Thanks,
Gagan
October 28, 2009 at 6:51 am
you don't really shut down a database, but you can kick everyone off so you have exclusive access; you might do that so you can restore the database, or detach it for example:
USE [master]
GO
ALTER DATABASE [YOURDATABASENAME] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
I've seen examples that immediately rename the database after the above command so if anyone tries to reconnect right after that command, it's not there.
Lowell
October 28, 2009 at 7:06 am
You can take the database offline as follows:-
ALTER DATABASE [dbname] SET OFFLINE
October 28, 2009 at 7:12 am
ahh good point Ian; forgot about that one;
i just tested, and if anyone is connected, you need to kick them off with Ians command as well:
ALTER DATABASE [SandBox2000] SET OFFLINE WITH ROLLBACK IMMEDIATE
knocks em out.
Lowell
October 28, 2009 at 7:17 am
Offline works great if you don't need to access the instance. I like that.
But if you want to kick everyone out, Lowell's first command is what I thought of.
why do you need to do this? Is there something that you want to do with the database?
October 28, 2009 at 10:18 am
Thanks Lowell,Ian for the quick response..
Steve,
I sometimes have questions asked to bounce a single db by Application team(rather the whole instance) as that is possible in Oracle. and also sounds correct as other db might have some transactions going around and might disturb if i have to bounce a Instance.
And BTW do we have a T SQL command to startup a single user Database.
Thanks in Advance,
Gagan
October 28, 2009 at 10:22 am
Why bounce the instance? What do they think that does? If you bounce a db, you aren't necessarily doing anything to the server. I'm not even sure if the cache clears. That would be interesting to find out, but that doesn't help performance or necessarily clear the server.
Instead you might want to kill offending SPIDs
October 28, 2009 at 10:26 am
Sorry Guys ..I am trying to compare SQL Server to Oracle..
But Would like to understand if i can have a bounce of a particular User DB.
Thanks,
Gagan
October 28, 2009 at 11:58 am
gaganks (10/28/2009)
I am trying to compare SQL Server to Oracle..
Happens that at this level SQL Server and Oracle are really different.
On the Oracle side an "instance" is actually a database so saying that you shutdown/startup an "instance" is the same as saying you shutdown/startup a "database".
On the SQL Server side -by design an "instance" runs several "databases" therefore terms are not interchangeable.
Whish this helps.
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.October 28, 2009 at 12:00 pm
I don't think you accomplish anything with the bounce. The "rollback immediate" will kill sessions.
If you bounce the instance, then memory, cache, etc. reset.
October 28, 2009 at 12:06 pm
Steve Jones - Editor (10/28/2009)
If you bounce the instance, then memory, cache, etc. reset.
Exactly!
That's the difference in non-RAC Oracle you get a one-to-one relationship in between instance and database while in SQL Server you get a one-to-many relationship.
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.December 31, 2009 at 4:13 am
This site Really nice for me....There are many information available here.........
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply