Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 668
  • Last Modified:

Stop one database from SQL SERVER instance and memory allocation

Hi,

What is the proper way to only shutdown one database within SQL Server instance which contains other user databases?

Does alter database dbname offline considered as a (or the) way to shutdown a database?

Is there any way to allocate specific amount of memory by databases instead of sharing one big memory pool with other databases under the same instance?

Thanks,

0
mystudent
Asked:
mystudent
  • 3
  • 2
3 Solutions
 
Michael KnightCommented:
yes,

ALTER DATABASE database-name SET OFFLINE    (notice SET)    

will attempt to take the named database off-line immediately. If a user or a background process is currently connected to the database the command cannot be completed. In this situation, the ALTER DATABASE statement will be blocked and will wait until all connections are closed.

The ROLLBACK clause can be used to immediately disconnect users or can be provided with a number of seconds to pause before taking the database off-line. To force the immediate disconnection of general users and processes and the rolling back of their transactions, use the following command:

ALTER DATABASE database-name SET OFFLINE WITH ROLLBACK IMMEDIATE

------------------------

The Memory configuration is set at server level and it can only be set to a max value permitting other non-sql processes to run using a fixed amount of remaining RAM.
0
 
mystudentAuthor Commented:
Thanks.

Is there an option to abort the database with waiting for session rollback?

For the memory question, so if one database acts abnormally and consumes most of the memory, other database under the same instance will suffer in performance. To avoid this situation,   one should separate databases by using multiple name instances. Is it correct or are there better ways of handling it?
0
 
Daniel_PLDB Expert/ArchitectCommented:
You can use Resouce Governor if your edition is Enterprise.
http://www.sqlservercentral.com/articles/Resource+Governor/64034/
http://msdn.microsoft.com/en-us/library/bb933866%28v=SQL.100%29.aspx
http://blogs.technet.com/b/andrew/archive/2008/02/06/sql-server-2008-resource-governor-in-action.aspx
http://www.mssqltips.com/tip.asp?tip=1720
etc.
If you prefer to install another instance please note that you need to correctly set up instances because they will compete for resources.
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
mystudentAuthor Commented:
Thanks for the link on the resource Governor. They are very helpful.

My another previous question about shutdown database was to " Is there any way to abort the database WITHOUT waiting for session rollback, similar to what Oracle does "shutdown abort"?
0
 
Daniel_PLDB Expert/ArchitectCommented:
I don't see adequate option in SQL Server, only WITH ROLLBACK IMMEDIATE.
0
 
mystudentAuthor Commented:
Thanks all.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now