Showing posts with label exists. Show all posts
Showing posts with label exists. Show all posts

Sunday, March 11, 2012

control the percentage of processor used by SQL server

exists a form to control the percentage of processor used by SQL
server? for example, not use more than 60% percent.
I don't think you can do that.You can tell the number of cpu's to use but but
not by
percent
"hongo32" wrote:

> exists a form to control the percentage of processor used by SQL
> server? for example, not use more than 60% percent.
>
|||"hongo32" <hongo32es@.yahoo.com> wrote in message
news:1131739796.126120.60050@.g44g2000cwa.googlegro ups.com...
> exists a form to control the percentage of processor used by SQL
> server? for example, not use more than 60% percent.
>
First off the basic best practice is to use dedicated SQL Server boxes.
What else do you think needs CPU.
But yes, there are two tools for allocating CPU resources to SQL Server
instances: SQL Server processor affinity and Windows System Resource
Manager.
CPU affinity is configured inside SQL Server and basically allows you to
prevent a SQL Server instance from using one or more of your processors.
Windows System Resource Manager is more sophisticated and allows realtime
allocation of CPU resources to processes based on policies and server load.
So SQL Server could be allowed to use 100% of a CPU when other processes
aren't using it, but restricted to 60% when there is contention.
http://www.microsoft.com/technet/dow...srvr/wsrm.mspx
On a multi-processor system you can set the processor affinity for SQL
Server to prevent it from using some of your CPU's.
David
|||If you're on Win2003 have a look at WSRM
http://www.microsoft.com/windowsserv...m/default.mspx
For Win2k you can use Aurema ArmTech
http://www.aurema.com/products/winsql.php
We've used both and they have worked well in our environment
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"hongo32" <hongo32es@.yahoo.com> wrote in message
news:1131739796.126120.60050@.g44g2000cwa.googlegro ups.com...
> exists a form to control the percentage of processor used by SQL
> server? for example, not use more than 60% percent.
>

control the percentage of processor used by SQL server

exists a form to control the percentage of processor used by SQL
server? for example, not use more than 60% percent.I don't think you can do that.You can tell the number of cpu's to use but bu
t
not by
percent
"hongo32" wrote:

> exists a form to control the percentage of processor used by SQL
> server? for example, not use more than 60% percent.
>|||"hongo32" <hongo32es@.yahoo.com> wrote in message
news:1131739796.126120.60050@.g44g2000cwa.googlegroups.com...
> exists a form to control the percentage of processor used by SQL
> server? for example, not use more than 60% percent.
>
First off the basic best practice is to use dedicated SQL Server boxes.
What else do you think needs CPU.
But yes, there are two tools for allocating CPU resources to SQL Server
instances: SQL Server processor affinity and Windows System Resource
Manager.
CPU affinity is configured inside SQL Server and basically allows you to
prevent a SQL Server instance from using one or more of your processors.
Windows System Resource Manager is more sophisticated and allows realtime
allocation of CPU resources to processes based on policies and server load.
So SQL Server could be allowed to use 100% of a CPU when other processes
aren't using it, but restricted to 60% when there is contention.
http://www.microsoft.com/technet/do...nsrvr/wsrm.mspx
On a multi-processor system you can set the processor affinity for SQL
Server to prevent it from using some of your CPU's.
David|||If you're on Win2003 have a look at WSRM
http://www.microsoft.com/windowsser...lt.ms
px
For Win2k you can use Aurema ArmTech
http://www.aurema.com/products/winsql.php
We've used both and they have worked well in our environment
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"hongo32" <hongo32es@.yahoo.com> wrote in message
news:1131739796.126120.60050@.g44g2000cwa.googlegroups.com...
> exists a form to control the percentage of processor used by SQL
> server? for example, not use more than 60% percent.
>

control the percentage of processor used by SQL server

exists a form to control the percentage of processor used by SQL
server? for example, not use more than 60% percent.I don't think you can do that.You can tell the number of cpu's to use but but
not by
percent
"hongo32" wrote:
> exists a form to control the percentage of processor used by SQL
> server? for example, not use more than 60% percent.
>|||"hongo32" <hongo32es@.yahoo.com> wrote in message
news:1131739796.126120.60050@.g44g2000cwa.googlegroups.com...
> exists a form to control the percentage of processor used by SQL
> server? for example, not use more than 60% percent.
>
First off the basic best practice is to use dedicated SQL Server boxes.
What else do you think needs CPU.
But yes, there are two tools for allocating CPU resources to SQL Server
instances: SQL Server processor affinity and Windows System Resource
Manager.
CPU affinity is configured inside SQL Server and basically allows you to
prevent a SQL Server instance from using one or more of your processors.
Windows System Resource Manager is more sophisticated and allows realtime
allocation of CPU resources to processes based on policies and server load.
So SQL Server could be allowed to use 100% of a CPU when other processes
aren't using it, but restricted to 60% when there is contention.
http://www.microsoft.com/technet/downloads/winsrvr/wsrm.mspx
On a multi-processor system you can set the processor affinity for SQL
Server to prevent it from using some of your CPU's.
David|||If you're on Win2003 have a look at WSRM
http://www.microsoft.com/windowsserver2003/technologies/management/wsrm/default.mspx
For Win2k you can use Aurema ArmTech
http://www.aurema.com/products/winsql.php
We've used both and they have worked well in our environment
--
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"hongo32" <hongo32es@.yahoo.com> wrote in message
news:1131739796.126120.60050@.g44g2000cwa.googlegroups.com...
> exists a form to control the percentage of processor used by SQL
> server? for example, not use more than 60% percent.
>

Thursday, March 8, 2012

Control if a SQL database exists before its creation or deletion

Hi,
I'm using SQL Server 2005, and I would like to understand how to create and to drop a database without errors:
Infact, if I try to create a database that already exists, SQL Server throws the error "Impossible to create the database because it already exists", and if I try to drop a database that doesn't exist, SQL Server throws the error "Impossible to drop the database because it doesn't esist".
Before creating or dropping a database, I should control if it exists or not...
Is there a method to do that?
I found that such control for a table is the following one (in this case, I drop the table only if it exists):

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Table1]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Table1]

I tried to adapt the statement to the database case, modifying it as follows:
if exists (select * from dbo.sysobjects where id = object_id(N'[Database1]') and OBJECTPROPERTY(id, N'IsDatabase') = 1)
drop database [Database1]

but it didn't function (it was a blind attempt).
Can you suggest me a statement to do that?
Thank you very much

You can try:

if db_id('myDb') is not null print 'DB exists'

Alter NULL, NOT NULL check as appropriate for what you want to check

/Kenneth

|||Ok it functions correctly, thank you KeWin