Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

The best way to disbale the database

Posted on 2011-03-17
9
Medium Priority
?
222 Views
Last Modified: 2012-05-11
What's the best way to disable the database so that it is still available to manually run querries on but so that if it is not used it does not consume server resources?
0
Comment
Question by:YZlat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35156709
you can change the database to be READ_ONLY:
http://msdn.microsoft.com/en-us/library/aa275464%28v=sql.80%29.aspx
ALTER DATABASE your_db SET READ_ONLY

Open in new window


however, it will nevertheless need resources to run those queries, and the data queries will stay for some time in the cache.
0
 
LVL 35

Author Comment

by:YZlat
ID: 35156944
any other ways? I need to make sure that no scheduled tasks for that database run. I disabled them but it still shows that the database takes up resources
0
 
LVL 14

Expert Comment

by:Daniel_PL
ID: 35156977
ALTER DATABASE <dbname> SET OFFLINE
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 14

Expert Comment

by:Daniel_PL
ID: 35156990
With forcing rollback:
ALTER DATABASE <dbname> SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE <dbname> SET OFFLINE WITH ROLLBACK IMMEDIATE
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1000 total points
ID: 35157023
you can indeed put the database offline, but then you cannot query "manually" unless you put it back online.

> but it still shows that the database takes up resources
how do you see that?

indeed, scheduled tasks are not "aware" of the source database being "offline", so they will still run (unless disabled), and run into error.

0
 
LVL 35

Author Comment

by:YZlat
ID: 35158505
@angelIII what I meant by "scheduled tasks" is scheduled jobs

@Daniel_PL what exactly will set offline do for the database?
0
 
LVL 14

Expert Comment

by:Daniel_PL
ID: 35159533
Database in oofline state is not available to any query against it - except of system views.
What do you mean by consume server resources?
0
 
LVL 35

Author Comment

by:YZlat
ID: 35164804
meaning some programs (old ones that people didn't uninstall for some reason) are still running queries against that database. I would like to disable that but allow myself to run queriees occasionally using Management studio
0
 
LVL 14

Assisted Solution

by:Daniel_PL
Daniel_PL earned 1000 total points
ID: 35165046
Ok, I see, you have these options:

ALTER DATABASE your_db SET READ_ONLY  --database can be queried by all users, no changes are available

ALTER DATABASE <dbname> SET RESTRICTED_USER --database is available only to sysadmin or dbcreator server roles, or users with the db_owner database role in that db

ALTER DATABASE <dbname> SET SINGLE_USER --only one single connection can be established
0

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question