Showing posts with label process. Show all posts
Showing posts with label process. Show all posts

Monday, March 19, 2012

How to find table name by Table ID

waitresource
--
TAB: 12:600441263 []
I had blocking issue. I query sysproceses table and it shows me process are
waiting for "waitresource=TAB: 12:600441263 []"
TAB table
12 -- it is DB id...it is not problem to find dbname...sysdatabases
600441263 - table ID
How to find table name from Table ID '
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200608/1Switch to the proper DB and do:
SELECT OBJECT_NAME(600441263 )
RLF
"jkostic via droptable.com" <u11642@.uwe> wrote in message
news:64cf78c5f56a6@.uwe...
> waitresource
> --
> TAB: 12:600441263 []
> I had blocking issue. I query sysproceses table and it shows me process
> are
> waiting for "waitresource=TAB: 12:600441263 []"
> TAB table
> 12 -- it is DB id...it is not problem to find dbname...sysdatabases
> 600441263 - table ID
> How to find table name from Table ID '
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200608/1
>|||OBJECT_NAME() function will give you the table/any object name when you pass
the id.
in your case
Select OBJECT_NAME(600441263 )
will give you the table name.
There are otherways to do it.
Here is one more by using the system table
select name from sysobjects where id = 600441263
you have to run this comments on the particular database i.e the database id
12 you mentioned.
regards,
Saravanan
"jkostic via droptable.com" <u11642@.uwe> wrote in message
news:64cf78c5f56a6@.uwe...
> waitresource
> --
> TAB: 12:600441263 []
> I had blocking issue. I query sysproceses table and it shows me process
> are
> waiting for "waitresource=TAB: 12:600441263 []"
> TAB table
> 12 -- it is DB id...it is not problem to find dbname...sysdatabases
> 600441263 - table ID
> How to find table name from Table ID '
> --
> Message posted via droptable.com
> http://www.droptable.com/Uwe/Forum...server/200608/1
>

How to find table name by Table ID

waitresource
--
TAB: 12:600441263 []
I had blocking issue. I query sysproceses table and it shows me process are
waiting for "waitresource=TAB: 12:600441263 []"
TAB table
12 -- it is DB id...it is not problem to find dbname...sysdatabases
600441263 - table ID
How to find table name from Table ID '
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200608/1Switch to the proper DB and do:
SELECT OBJECT_NAME(600441263 )
RLF
"jkostic via SQLMonster.com" <u11642@.uwe> wrote in message
news:64cf78c5f56a6@.uwe...
> waitresource
> --
> TAB: 12:600441263 []
> I had blocking issue. I query sysproceses table and it shows me process
> are
> waiting for "waitresource=TAB: 12:600441263 []"
> TAB table
> 12 -- it is DB id...it is not problem to find dbname...sysdatabases
> 600441263 - table ID
> How to find table name from Table ID '
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200608/1
>|||OBJECT_NAME() function will give you the table/any object name when you pass
the id.
in your case
Select OBJECT_NAME(600441263 )
will give you the table name.
There are otherways to do it.
Here is one more by using the system table
select name from sysobjects where id = 600441263
you have to run this comments on the particular database i.e the database id
12 you mentioned.
regards,
Saravanan
"jkostic via SQLMonster.com" <u11642@.uwe> wrote in message
news:64cf78c5f56a6@.uwe...
> waitresource
> --
> TAB: 12:600441263 []
> I had blocking issue. I query sysproceses table and it shows me process
> are
> waiting for "waitresource=TAB: 12:600441263 []"
> TAB table
> 12 -- it is DB id...it is not problem to find dbname...sysdatabases
> 600441263 - table ID
> How to find table name from Table ID '
> --
> Message posted via SQLMonster.com
> http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200608/1
>

Monday, March 12, 2012

How to find out when a user last logged in

Hi There

I am in the process of cosolidating sql servers.

One of them literally has hundreds of sql logins, obviously i need to clean these up, however i a not sure how to determine when a user last logged in ?

How can i find out the last login date of a user ?

Thanx

Hi,

AFAIK this is not stored in tables in SQL Server, but it is either stored in

1. The event log if you turned on the Audit feature in the server properties.
2. In the c2 audit logs (if turned on)
3. In the profiler trace (if you are running one and are wathing the Audit events on the server)

HTH, jens Suessmeyer.

http://www.sqlserver2005.de

|||

Oh man that is bad news i guess, i could spend days sifting through the event logs, and even then i wont be sure a login is not used, for example if someone simply has not logged in this week.

Thanx Anyway

Friday, March 9, 2012

How to find out CPU utilization for individual sql processes?

Sometimes is my CPU utilization is about 90-100%. SQL server cause this high
utilization.
Is it possible to find out which process (task or query) in SQL server is
responsible for thist CPU utilization?
Alesmy SQL server is 2000
"Ales Baranek" <baranek@.extranet.cz> wrote in message
news:ev4dEsnWEHA.384@.TK2MSFTNGP10.phx.gbl...
> Sometimes is my CPU utilization is about 90-100%. SQL server cause this
high
> utilization.
> Is it possible to find out which process (task or query) in SQL server is
> responsible for thist CPU utilization?
> Ales
>|||Hi,
You can get the CPU time not CPU usage. But using below query you can get
the SQL process using high cpu time.
select spid,cpu from sysprocesses order by cpu desc
--
Thanks
Hari
MCDBA
"Ales Baranek" <baranek@.extranet.cz> wrote in message
news:#tHRj#nWEHA.3528@.TK2MSFTNGP10.phx.gbl...
> my SQL server is 2000
> "Ales Baranek" <baranek@.extranet.cz> wrote in message
> news:ev4dEsnWEHA.384@.TK2MSFTNGP10.phx.gbl...
> > Sometimes is my CPU utilization is about 90-100%. SQL server cause this
> high
> > utilization.
> > Is it possible to find out which process (task or query) in SQL server
is
> > responsible for thist CPU utilization?
> >
> > Ales
> >
> >
>|||You could run sp_who2 quickly twice, and look at the CPUTime column to see
which connection has the biggest increase. From there, you can then
retrieve the query either using DBCC INPUTBUFFER (pre-sp3) or the
::fn_get_sql function (sp3).
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backup files? Try MiniSQLBackup
"Ales Baranek" <baranek@.extranet.cz> wrote in message
news:ev4dEsnWEHA.384@.TK2MSFTNGP10.phx.gbl...
> Sometimes is my CPU utilization is about 90-100%. SQL server cause this
high
> utilization.
> Is it possible to find out which process (task or query) in SQL server is
> responsible for thist CPU utilization?
> Ales
>

How to find out CPU utilization for individual sql processes?

Sometimes is my CPU utilization is about 90-100%. SQL server cause this high
utilization.
Is it possible to find out which process (task or query) in SQL server is
responsible for thist CPU utilization?
Ales
my SQL server is 2000
"Ales Baranek" <baranek@.extranet.cz> wrote in message
news:ev4dEsnWEHA.384@.TK2MSFTNGP10.phx.gbl...
> Sometimes is my CPU utilization is about 90-100%. SQL server cause this
high
> utilization.
> Is it possible to find out which process (task or query) in SQL server is
> responsible for thist CPU utilization?
> Ales
>
|||Hi,
You can get the CPU time not CPU usage. But using below query you can get
the SQL process using high cpu time.
select spid,cpu from sysprocesses order by cpu desc
Thanks
Hari
MCDBA
"Ales Baranek" <baranek@.extranet.cz> wrote in message
news:#tHRj#nWEHA.3528@.TK2MSFTNGP10.phx.gbl...[vbcol=seagreen]
> my SQL server is 2000
> "Ales Baranek" <baranek@.extranet.cz> wrote in message
> news:ev4dEsnWEHA.384@.TK2MSFTNGP10.phx.gbl...
> high
is
>
|||You could run sp_who2 quickly twice, and look at the CPUTime column to see
which connection has the biggest increase. From there, you can then
retrieve the query either using DBCC INPUTBUFFER (pre-sp3) or the
::fn_get_sql function (sp3).
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backup files? Try MiniSQLBackup
"Ales Baranek" <baranek@.extranet.cz> wrote in message
news:ev4dEsnWEHA.384@.TK2MSFTNGP10.phx.gbl...
> Sometimes is my CPU utilization is about 90-100%. SQL server cause this
high
> utilization.
> Is it possible to find out which process (task or query) in SQL server is
> responsible for thist CPU utilization?
> Ales
>

How to find out CPU utilization for individual sql processes?

Sometimes is my CPU utilization is about 90-100%. SQL server cause this high
utilization.
Is it possible to find out which process (task or query) in SQL server is
responsible for thist CPU utilization?
Alesmy SQL server is 2000
"Ales Baranek" <baranek@.extranet.cz> wrote in message
news:ev4dEsnWEHA.384@.TK2MSFTNGP10.phx.gbl...
> Sometimes is my CPU utilization is about 90-100%. SQL server cause this
high
> utilization.
> Is it possible to find out which process (task or query) in SQL server is
> responsible for thist CPU utilization?
> Ales
>|||Hi,
You can get the CPU time not CPU usage. But using below query you can get
the SQL process using high cpu time.
select spid,cpu from sysprocesses order by cpu desc
Thanks
Hari
MCDBA
"Ales Baranek" <baranek@.extranet.cz> wrote in message
news:#tHRj#nWEHA.3528@.TK2MSFTNGP10.phx.gbl...
> my SQL server is 2000
> "Ales Baranek" <baranek@.extranet.cz> wrote in message
> news:ev4dEsnWEHA.384@.TK2MSFTNGP10.phx.gbl...
> high
is[vbcol=seagreen]
>|||You could run sp_who2 quickly twice, and look at the CPUTime column to see
which connection has the biggest increase. From there, you can then
retrieve the query either using DBCC INPUTBUFFER (pre-sp3) or the
::fn_get_sql function (sp3).
Peter Yeoh
http://www.yohz.com
Need smaller SQL2K backup files? Try MiniSQLBackup
"Ales Baranek" <baranek@.extranet.cz> wrote in message
news:ev4dEsnWEHA.384@.TK2MSFTNGP10.phx.gbl...
> Sometimes is my CPU utilization is about 90-100%. SQL server cause this
high
> utilization.
> Is it possible to find out which process (task or query) in SQL server is
> responsible for thist CPU utilization?
> Ales
>

Wednesday, March 7, 2012

How to find how a record was deleted

Is there a way to tell who or what process deleted a record in a SQL table.
I know you can setup triggers or Profiler - but is there a way to see how a
record was deleted if you DO NOT have a trigger or Profiler already running?
This is SQL 2000 Standard, sp3a with default options and configuration.

ThanksHi rdraider,
It may help your cause
Step 1 : Login as sa or user with sa rights
Step 2 : Run a trace with minimum TSQL (Statement Start , Statement
Complete)
If you wish to know from where(EM or SQL Query Analyzer) record is
deleted then the column Applicationname of Trace output will help you.

With warm regards
Jatinder|||If you have log backups, then there are several third-party tools which
can read them and recover information about when data was deleted. For
example:

http://www.lumigent.com/products/le_sql.html

Simon

How to find duplicates

Hi
I assume that some of you do this on a regular basis, so I hope you can
help.
We're currently in the process of merging 2 databases into 1. Therefore I
need to do some clean up of the data, and get rid of duplicate records in
some tables. It might be very simple to do this with some TSQL code, but I
just can't figure out to do it.
It will be fine just to test on one column in the table, and what I'd like
so get is some code that can show me all the records where there's more than
one record with the same value in that column in the table.
I hope that some of you can guide me in the right direction...
Regards
SteenThanks a lot David. That seems to be what I needed.
Regards
Steen
David Portas wrote:
> Here's an example from Pubs. Authors with duplicate last names:
> SELECT A. au_id, A.au_lname, A.au_fname
> FROM Authors AS A
> JOIN
> (SELECT au_lname
> FROM Authors
> GROUP BY au_lname
> HAVING COUNT(*)>1) AS B
> ON A.au_lname = B.au_lname
> --
> David Portas
> SQL Server MVP|||Here's an example from Pubs. Authors with duplicate last names:
SELECT A. au_id, A.au_lname, A.au_fname
FROM Authors AS A
JOIN
(SELECT au_lname
FROM Authors
GROUP BY au_lname
HAVING COUNT(*)>1) AS B
ON A.au_lname = B.au_lname
--
David Portas
SQL Server MVP
--

How to find duplicates

Hi
I assume that some of you do this on a regular basis, so I hope you can
help.
We're currently in the process of merging 2 databases into 1. Therefore I
need to do some clean up of the data, and get rid of duplicate records in
some tables. It might be very simple to do this with some TSQL code, but I
just can't figure out to do it.
It will be fine just to test on one column in the table, and what I'd like
so get is some code that can show me all the records where there's more than
one record with the same value in that column in the table.
I hope that some of you can guide me in the right direction...
Regards
Steen
Here's an example from Pubs. Authors with duplicate last names:
SELECT A. au_id, A.au_lname, A.au_fname
FROM Authors AS A
JOIN
(SELECT au_lname
FROM Authors
GROUP BY au_lname
HAVING COUNT(*)>1) AS B
ON A.au_lname = B.au_lname
David Portas
SQL Server MVP
|||Thanks a lot David. That seems to be what I needed.
Regards
Steen
David Portas wrote:
> Here's an example from Pubs. Authors with duplicate last names:
> SELECT A. au_id, A.au_lname, A.au_fname
> FROM Authors AS A
> JOIN
> (SELECT au_lname
> FROM Authors
> GROUP BY au_lname
> HAVING COUNT(*)>1) AS B
> ON A.au_lname = B.au_lname
> --
> David Portas
> SQL Server MVP