Showing posts with label gurus. Show all posts
Showing posts with label gurus. Show all posts

Wednesday, March 28, 2012

Poor performance

Hello Gurus,

SQL Server 2000
Windows 2003 Server, Standard Edition.

Firstly I'm not a SQL server DBA but have a little experience with
Oracle 9i and Oracle Rdb.

An application that I've inherited has started performing very very
slowly over the last few days, as far as I know there have been no
modifications or changes in the volume of data the db is holding. The
database is in simple logging mode and it's updated twice per day from
and Oracle Rdb database.

The SQL database is all in the primary filegroup and is sat on four
disks (RAID mirrored) which form one logical disk of 128gb. It
consists of approx 120 tables, each with a primary key and a number of
unique indicies per table.

Apart from a twice a day update in the small hours the only access to
this database is read only. Users are connecting via the web and
using predefined Crystal reports to retrieve data.

Questions then:

Should this db have more than one filegroup and should I put the
indicies in a different group? Is this relevant when the underlying
storage is RAID?

Should it be using mirrored RAID or should it be striped or should I
steer clear of RAID for a database?

The indicies have not been rebuilt for some time (probably one year).
Is this something I should be doing once per day/week as I do have the
downtime window?

Should I be doing a database/table reorg at fairly regular intervals?

I'm going to generate a workload file from SQL profiler and see what,
in conjunction with the Index tuning wizard it suggests.

Appreciate that poor performance & tuning is a huge subject and not an
exact science but any tips or comments would be gratefully received.

Regards
Dave.David Gray (police@.spamcop.net) writes:
> An application that I've inherited has started performing very very
> slowly over the last few days, as far as I know there have been no
> modifications or changes in the volume of data the db is holding. The
> database is in simple logging mode and it's updated twice per day from
> and Oracle Rdb database.

But as data is added to he database, statistics changes, and the
optimizer may come to different conclusions about query plans. Sometimes
to the worst.

> Should this db have more than one filegroup and should I put the
> indicies in a different group? Is this relevant when the underlying
> storage is RAID?
> Should it be using mirrored RAID or should it be striped or should I
> steer clear of RAID for a database?

Since it appears that the database performance has degraded so all at
once, I doubt that hardware configuration is the right medicine.

> The indicies have not been rebuilt for some time (probably one year).
> Is this something I should be doing once per day/week as I do have the
> downtime window?

Absolutely!

> Should I be doing a database/table reorg at fairly regular intervals?

That is actually the same thing as rebuilding indexes, at least as long
as you rebuild the clustered indexes.

Note that if you have tables without clustered indexes, they cannot
be rebuild by other means than creating a clustered index and then
dropping it. (Thus it's a good idea to have a clustered index on every
table.)

> I'm going to generate a workload file from SQL profiler and see what,
> in conjunction with the Index tuning wizard it suggests.

That may be a good idea anyway, because about every database has its
own set of poorly indexed queries. But I would expect a DBCC DBREINDEX
on all tables to have considerable effect.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Your indexes probably got a lot of fragmentations due to the twice daily
updates over time. You can use DBCC SHOWCONTIG to find out the degree of
fragmentation. I'd strongly suggest you to rebuild all the indexes if they
haven't been rebuilt for one year. Afterwards you should consider to
schedule periodical index reorg/defrag tasks to keep the fragmentation at a
low level.

--
Gang He
Software Design Engineer
Microsoft SQL Server Storage Engine

This posting is provided "AS IS" with no warranties, and confers no rights.
"David Gray" <police@.spamcop.net> wrote in message
news:1r6j319sk4nnfahn3dsbgs7la3d9q5hkcr@.4ax.com...
> Hello Gurus,
> SQL Server 2000
> Windows 2003 Server, Standard Edition.
> Firstly I'm not a SQL server DBA but have a little experience with
> Oracle 9i and Oracle Rdb.
> An application that I've inherited has started performing very very
> slowly over the last few days, as far as I know there have been no
> modifications or changes in the volume of data the db is holding. The
> database is in simple logging mode and it's updated twice per day from
> and Oracle Rdb database.
> The SQL database is all in the primary filegroup and is sat on four
> disks (RAID mirrored) which form one logical disk of 128gb. It
> consists of approx 120 tables, each with a primary key and a number of
> unique indicies per table.
> Apart from a twice a day update in the small hours the only access to
> this database is read only. Users are connecting via the web and
> using predefined Crystal reports to retrieve data.
> Questions then:
> Should this db have more than one filegroup and should I put the
> indicies in a different group? Is this relevant when the underlying
> storage is RAID?
> Should it be using mirrored RAID or should it be striped or should I
> steer clear of RAID for a database?
> The indicies have not been rebuilt for some time (probably one year).
> Is this something I should be doing once per day/week as I do have the
> downtime window?
> Should I be doing a database/table reorg at fairly regular intervals?
> I'm going to generate a workload file from SQL profiler and see what,
> in conjunction with the Index tuning wizard it suggests.
> Appreciate that poor performance & tuning is a huge subject and not an
> exact science but any tips or comments would be gratefully received.
> Regards
> Dave.
>

Tuesday, March 20, 2012

Pls-00378

Hello PL/SQL gurus,

I am facing a seemingly simple problem compiling a function.

When I try to compile the folllowing code...

CREATE OR REPLACE FUNCTION WDF_UNITS_SHIPPED_FN ( p_trf_number IN PLS_INTEGER ) RETURN NUMBER ;

I am getting.....

PLS-00378: invalid compilation unit for this release of PL/SQL

Any ideas?

Please helpOriginally posted by pusht
Hello PL/SQL gurus,

I am facing a seemingly simple problem compiling a function.

When I try to compile the folllowing code...

CREATE OR REPLACE FUNCTION WDF_UNITS_SHIPPED_FN ( p_trf_number IN PLS_INTEGER ) RETURN NUMBER ;

I am getting.....

PLS-00378: invalid compilation unit for this release of PL/SQL

Any ideas?

Please help
Your function definition is incomplete - it is just a specification, there is no body. This is correct in a package specification, but not for a stand alone function.

Saturday, February 25, 2012

PLEASE HELP: Force SQL Login only using SQL SERVER Autherntication.

Hi SQL Gurus,
I am still not a master in SQL Server.
How can we restrict user from login using "WINDOWS AUTHENTICATION".
We don't want anyone who has the server windows login to access SQL Server.
We have seen some users logged in to the database server, when they should
not have access.
Please help me how to restrict them accessing the server.
Thanks for any help or suggestion you can provide.
Mark.
> How can we restrict user from login using "WINDOWS AUTHENTICATION".
Well, you didn't bother to mention which version of SQL Server you are
using... if you are using SQL Server 2005, you could put the sa password in
a very, very, very safe place, and then create a LOGON TRIGGER, e.g.
USE master;
GO
CREATE TRIGGER BlockLogin
ON ALL SERVER
WITH EXECUTE AS 'sa'
FOR LOGON
AS
BEGIN
IF ORIGINAL_LOGIN() LIKE '%\%'
ROLLBACK
END
GO

> We have seen some users logged in to the database server, when they should
> not have access.
Do you mean logged onto the physical server (e.g. through terminal
services), or SQL Server itself? Where have you seen them?
The former, I assume, would be controlled through Active Directory etc., and
not by SQL Server.
A
|||We have deleted the login "BUILDIN\ADMINISTRATOR", and this seems to work
fine
Do you think there are any isses if I delete this login?
Thanks, Mark
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:OKzCy%23ZmIHA.5660@.TK2MSFTNGP02.phx.gbl...
> Hi
> If the users have not directly been granted a login, then they probably
> have been granted logins through a windows group. Make sure that they are
> not members of a group they should not be in or a group with a wide
> membership has been granted a login. You can use sp_denylogin to deny
> access to a given login.
> John
> "Mark" <Mark@.nospaml.com> wrote in message
> news:%236TpQHZmIHA.2268@.TK2MSFTNGP02.phx.gbl...
>
|||Mark,
The only issue is to make sure that someone still has administrator rights
so that it is still possible to administer the server. Getting
BUILTIN\ADMINISTRATOR out of your SQL Server is an excellent practice.
http://www.sqlservercentral.com/articles/Security/10securingyoursqlserver/701/
RLF
"Mark" <Mark@.nospaml.com> wrote in message
news:OerAowbmIHA.4712@.TK2MSFTNGP04.phx.gbl...
> We have deleted the login "BUILDIN\ADMINISTRATOR", and this seems to work
> fine
> Do you think there are any isses if I delete this login?
> Thanks, Mark
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:OKzCy%23ZmIHA.5660@.TK2MSFTNGP02.phx.gbl...
>
|||Thanks Guys.
I got the answer I was looking for.
Thanks again, Mike
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:uQR%23lUimIHA.944@.TK2MSFTNGP05.phx.gbl...
> "Mark" <Mark@.nospaml.com> wrote in message
> news:OerAowbmIHA.4712@.TK2MSFTNGP04.phx.gbl...
> Hi Mark
> I think the issue you should address is why these users are over
> privileged as Russell suggests. Removing anyone who does not need the
> local administrators privilege should be an urgent priority, in the worst
> case they will also be domain administrators.
> John
>

PLEASE HELP: Force SQL Login only using SQL SERVER Autherntication.

Hi SQL Gurus,
I am still not a master in SQL Server.
How can we restrict user from login using "WINDOWS AUTHENTICATION".
We don't want anyone who has the server windows login to access SQL Server.
We have seen some users logged in to the database server, when they should
not have access.
Please help me how to restrict them accessing the server.
Thanks for any help or suggestion you can provide.
Mark.Hi
If the users have not directly been granted a login, then they probably have
been granted logins through a windows group. Make sure that they are not
members of a group they should not be in or a group with a wide membership
has been granted a login. You can use sp_denylogin to deny access to a given
login.
John
"Mark" <Mark@.nospaml.com> wrote in message
news:%236TpQHZmIHA.2268@.TK2MSFTNGP02.phx.gbl...
> Hi SQL Gurus,
> I am still not a master in SQL Server.
> How can we restrict user from login using "WINDOWS AUTHENTICATION".
> We don't want anyone who has the server windows login to access SQL
> Server.
> We have seen some users logged in to the database server, when they should
> not have access.
> Please help me how to restrict them accessing the server.
> Thanks for any help or suggestion you can provide.
> Mark.
>|||> How can we restrict user from login using "WINDOWS AUTHENTICATION".
Well, you didn't bother to mention which version of SQL Server you are
using... if you are using SQL Server 2005, you could put the sa password in
a very, very, very safe place, and then create a LOGON TRIGGER, e.g.
USE master;
GO
CREATE TRIGGER BlockLogin
ON ALL SERVER
WITH EXECUTE AS 'sa'
FOR LOGON
AS
BEGIN
IF ORIGINAL_LOGIN() LIKE '%\%'
ROLLBACK
END
GO
> We have seen some users logged in to the database server, when they should
> not have access.
Do you mean logged onto the physical server (e.g. through terminal
services), or SQL Server itself? Where have you seen them?
The former, I assume, would be controlled through Active Directory etc., and
not by SQL Server.
A|||We have deleted the login "BUILDIN\ADMINISTRATOR", and this seems to work
fine
Do you think there are any isses if I delete this login?
Thanks, Mark
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:OKzCy%23ZmIHA.5660@.TK2MSFTNGP02.phx.gbl...
> Hi
> If the users have not directly been granted a login, then they probably
> have been granted logins through a windows group. Make sure that they are
> not members of a group they should not be in or a group with a wide
> membership has been granted a login. You can use sp_denylogin to deny
> access to a given login.
> John
> "Mark" <Mark@.nospaml.com> wrote in message
> news:%236TpQHZmIHA.2268@.TK2MSFTNGP02.phx.gbl...
>> Hi SQL Gurus,
>> I am still not a master in SQL Server.
>> How can we restrict user from login using "WINDOWS AUTHENTICATION".
>> We don't want anyone who has the server windows login to access SQL
>> Server.
>> We have seen some users logged in to the database server, when they
>> should not have access.
>> Please help me how to restrict them accessing the server.
>> Thanks for any help or suggestion you can provide.
>> Mark.
>|||Mark,
The only issue is to make sure that someone still has administrator rights
so that it is still possible to administer the server. Getting
BUILTIN\ADMINISTRATOR out of your SQL Server is an excellent practice.
http://www.sqlservercentral.com/articles/Security/10securingyoursqlserver/701/
RLF
"Mark" <Mark@.nospaml.com> wrote in message
news:OerAowbmIHA.4712@.TK2MSFTNGP04.phx.gbl...
> We have deleted the login "BUILDIN\ADMINISTRATOR", and this seems to work
> fine
> Do you think there are any isses if I delete this login?
> Thanks, Mark
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:OKzCy%23ZmIHA.5660@.TK2MSFTNGP02.phx.gbl...
>> Hi
>> If the users have not directly been granted a login, then they probably
>> have been granted logins through a windows group. Make sure that they are
>> not members of a group they should not be in or a group with a wide
>> membership has been granted a login. You can use sp_denylogin to deny
>> access to a given login.
>> John
>> "Mark" <Mark@.nospaml.com> wrote in message
>> news:%236TpQHZmIHA.2268@.TK2MSFTNGP02.phx.gbl...
>> Hi SQL Gurus,
>> I am still not a master in SQL Server.
>> How can we restrict user from login using "WINDOWS AUTHENTICATION".
>> We don't want anyone who has the server windows login to access SQL
>> Server.
>> We have seen some users logged in to the database server, when they
>> should not have access.
>> Please help me how to restrict them accessing the server.
>> Thanks for any help or suggestion you can provide.
>> Mark.
>>
>|||"Mark" <Mark@.nospaml.com> wrote in message
news:OerAowbmIHA.4712@.TK2MSFTNGP04.phx.gbl...
> We have deleted the login "BUILDIN\ADMINISTRATOR", and this seems to work
> fine
> Do you think there are any isses if I delete this login?
> Thanks, Mark
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:OKzCy%23ZmIHA.5660@.TK2MSFTNGP02.phx.gbl...
>> Hi
>> If the users have not directly been granted a login, then they probably
>> have been granted logins through a windows group. Make sure that they are
>> not members of a group they should not be in or a group with a wide
>> membership has been granted a login. You can use sp_denylogin to deny
>> access to a given login.
>> John
>> "Mark" <Mark@.nospaml.com> wrote in message
>> news:%236TpQHZmIHA.2268@.TK2MSFTNGP02.phx.gbl...
>> Hi SQL Gurus,
>> I am still not a master in SQL Server.
>> How can we restrict user from login using "WINDOWS AUTHENTICATION".
>> We don't want anyone who has the server windows login to access SQL
>> Server.
>> We have seen some users logged in to the database server, when they
>> should not have access.
>> Please help me how to restrict them accessing the server.
>> Thanks for any help or suggestion you can provide.
>> Mark.
Hi Mark
I think the issue you should address is why these users are over privileged
as Russell suggests. Removing anyone who does not need the local
administrators privilege should be an urgent priority, in the worst case
they will also be domain administrators.
John|||Thanks Guys.
I got the answer I was looking for.
Thanks again, Mike
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:uQR%23lUimIHA.944@.TK2MSFTNGP05.phx.gbl...
> "Mark" <Mark@.nospaml.com> wrote in message
> news:OerAowbmIHA.4712@.TK2MSFTNGP04.phx.gbl...
>> We have deleted the login "BUILDIN\ADMINISTRATOR", and this seems to work
>> fine
>> Do you think there are any isses if I delete this login?
>> Thanks, Mark
>>
>> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
>> news:OKzCy%23ZmIHA.5660@.TK2MSFTNGP02.phx.gbl...
>> Hi
>> If the users have not directly been granted a login, then they probably
>> have been granted logins through a windows group. Make sure that they
>> are not members of a group they should not be in or a group with a wide
>> membership has been granted a login. You can use sp_denylogin to deny
>> access to a given login.
>> John
>> "Mark" <Mark@.nospaml.com> wrote in message
>> news:%236TpQHZmIHA.2268@.TK2MSFTNGP02.phx.gbl...
>> Hi SQL Gurus,
>> I am still not a master in SQL Server.
>> How can we restrict user from login using "WINDOWS AUTHENTICATION".
>> We don't want anyone who has the server windows login to access SQL
>> Server.
>> We have seen some users logged in to the database server, when they
>> should not have access.
>> Please help me how to restrict them accessing the server.
>> Thanks for any help or suggestion you can provide.
>> Mark.
> Hi Mark
> I think the issue you should address is why these users are over
> privileged as Russell suggests. Removing anyone who does not need the
> local administrators privilege should be an urgent priority, in the worst
> case they will also be domain administrators.
> John
>

Please help: Create View

Hi Gurus,
I'm a beginner. Would you please tell me if it's possible to create a view
having a calcuated column based on the condition of the column on the sql
table.

create view vwImaging AS
select
EmpID, LastName, FirstName, EmpTag = 'Act' if

FROM tblPerPay
I have a table EMP:
SSN (char 9)

A view giving a formatted SSN (XXX-XX-XXXX,) a

--
Message posted via http://www.sqlmonster.comSorry, I press the "Post Message" by accident while editing the message.

Here is question again: Is it possible to create a view having a column
based on the value of a given column on the sql table.

create view LookUp AS
select
EmpID,
LastName,
FirstName,
EmpTag = 'Act' (if tblEmp.TermDate is Null)
EmpTag = 'Inact' (if tblEmp.TermDate not Null)
from tblEmp

I don't know the syntax of the last 2 columns. TermDate is the termination
date in tblEmp.

Any help will be greatly appreciated.
Thanks in advance
TTran

--
Message posted via http://www.sqlmonster.com|||"T Tran via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:c015ee60567f4767934b62908ec07144@.SQLMonster.c om...
> Sorry, I press the "Post Message" by accident while editing the message.
> Here is question again: Is it possible to create a view having a column
> based on the value of a given column on the sql table.
> create view LookUp AS
> select
> EmpID,
> LastName,
> FirstName,
> EmpTag = 'Act' (if tblEmp.TermDate is Null)
> EmpTag = 'Inact' (if tblEmp.TermDate not Null)
> from tblEmp
> I don't know the syntax of the last 2 columns. TermDate is the termination
> date in tblEmp.
> Any help will be greatly appreciated.
> Thanks in advance
> TTran
> --
> Message posted via http://www.sqlmonster.com

Check out CASE in Books Online. Do you need two EmpTag columns? If Act/Inact
is a flag, it may make more sense to use only one column:

create view LookUp AS
select
EmpID,
LastName,
FirstName,
EmpTag = case when TermDate is Null then 'Act' else 'Inact' end
from
tblEmp

But if you do need separate columns, then try this (it's usually not a good
idea to return multiple columns with the same name):

create view LookUp AS
select
EmpID,
LastName,
FirstName,
EmpTagAct = case when TermDate is null then 'Act' else '-' end,
EmpTagInact = case when TermDate is not null then 'Inact' else '-' end
from
tblEmp

Simon|||Since you are learning SQL, you might want to start by learning
ISO-11179 rules for names and the Standard SQL syntax for aliases. A
CASE expression will handle this:

CREATE VIEW PersonnelStatus (ssn, last_name, first_name,
employment_status)
AS
SELECT ssn, last_name, first_name,
CASE (WHEN term_date IS NULL
THEN 'inactive'
ELSE 'active ' END
FROM Personnel;

The equal sign is local dialect; the AS operator is Standard. Use
collective or plural nouns for table names; never put a prefix on a
data element to tell us how it is *physically* stored. This is really
silly in SQL, since there is only one data structure.

I have a book on SQL PROGRAMMING STYLE due out the middle of this year
that might be of some help to you.