Showing posts with label determine. Show all posts
Showing posts with label determine. Show all posts

Tuesday, March 27, 2012

Cleanup of unused database objects

Hi,
I've inherited a database with lots of unused objects (tables and
SPs). What I want to do is determine wich objects have not been used
for the last 30 days and remove them from the database.
Is there a way to determine the last time a table was accessed or a
Stored Procedure was run. I've looked at the system tables but haven't
seen anything that indicates this. I can put a trace on, but that
would consume too many cycles of the machine.
Any ideas or help would be greatly appreciated.
EdThe way I have handled this is to run a trace (SQL Profiler) to see which
objects are accessed.
Store the Object_id's ... you can store the trace in a table if you want and
select them later ... this will give you a list of objects that are being
used.
-Lars
"Edward Roepe" <edward@.roepe.com> wrote in message
news:d383b36b.0401271358.3ac36806@.posting.google.com...
quote:

> Hi,
> I've inherited a database with lots of unused objects (tables and
> SPs). What I want to do is determine wich objects have not been used
> for the last 30 days and remove them from the database.
> Is there a way to determine the last time a table was accessed or a
> Stored Procedure was run. I've looked at the system tables but haven't
> seen anything that indicates this. I can put a trace on, but that
> would consume too many cycles of the machine.
> Any ideas or help would be greatly appreciated.
> Ed

Cleanup of unused database objects

Hi,
I've inherited a database with lots of unused objects (tables and
SPs). What I want to do is determine wich objects have not been used
for the last 30 days and remove them from the database.
Is there a way to determine the last time a table was accessed or a
Stored Procedure was run. I've looked at the system tables but haven't
seen anything that indicates this. I can put a trace on, but that
would consume too many cycles of the machine.
Any ideas or help would be greatly appreciated.
EdThe way I have handled this is to run a trace (SQL Profiler) to see which
objects are accessed.
Store the Object_id's ... you can store the trace in a table if you want and
select them later ... this will give you a list of objects that are being
used.
-Lars
"Edward Roepe" <edward@.roepe.com> wrote in message
news:d383b36b.0401271358.3ac36806@.posting.google.com...
> Hi,
> I've inherited a database with lots of unused objects (tables and
> SPs). What I want to do is determine wich objects have not been used
> for the last 30 days and remove them from the database.
> Is there a way to determine the last time a table was accessed or a
> Stored Procedure was run. I've looked at the system tables but haven't
> seen anything that indicates this. I can put a trace on, but that
> would consume too many cycles of the machine.
> Any ideas or help would be greatly appreciated.
> Ed

Tuesday, March 20, 2012

cidr, inet, and mac data types

I've tried searching around and haven't been able to determine if SQL Server 2005 supports cidr, inet, or mac address data types. I have a database in PostgreSQL that I'm working on moving to SQL Server 2005 due to business requirements and it uses these data types.

No. There isn't a native data for cidr. However, you can just use one of the native datatypes.

http://sqlserver2000.databases.aspfaq.com/how-should-i-store-an-ip-address-in-sql-server.html

Wednesday, March 7, 2012

CheckQueryProcessorAlive

Please help me determine what could cause the SQL Server 2000 Cluster error
listed below. This is a server with SQL Server 2000 Enterprise Edition as an
Active/Active Cluster and Windows 2003 Server.
Please help me with this error.
Thanks,
00000780.0000149c::2005/01/05-18:22:53.035 INFO [API] User denied access
using default cluster SD. GetLastError() = 0x00000005; dwStatus = 0x00000000.
000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] printODBCError: sqlstate = 01000; native error = 2746;
message = [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionWrite
(send()).
000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] printODBCError: sqlstate = 08S01; native error = b;
message = [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]General network
error. Check your network documentation.
000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] OnlineThread: QP is not online.
000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] printODBCError: sqlstate = 08S01; native error = 0;
message = [Microsoft][ODBC SQL Server Driver]Communication link failure
000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] printODBCError: sqlstate = 08S01; native error = 0;
message = [Microsoft][ODBC SQL Server Driver]Communication link failure
000008ec.000007e4::2005/01/05-18:23:17.973 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
000008ec.000007e4::2005/01/05-18:23:17.973 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] printODBCError: sqlstate = 08S01; native error = 0;
message = [Microsoft][ODBC SQL Server Driver]Communication link failure
000008ec.000007e4::2005/01/05-18:23:17.973 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
000008ec.000007e4::2005/01/05-18:23:17.973 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] printODBCError: sqlstate = 08S01; native error = 0;
message = [Microsoft][ODBC SQL Server Driver]Communication link failure
000008ec.000007e4::2005/01/05-18:23:17.973 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
000008ec.000007e4::2005/01/05-18:23:17.973 ERR SQL Server <SQL Server
(OLTP)>: [sqsrvres] printODBCError: sqlstate = 08S01; native error = 0;
message = [Microsoft][ODBC SQL Server Driver]Communication link failure
00000780.00000e6c::2005/01/05-18:23:22.676 INFO [CP] CppRegNotifyThread
checkpointing key Software\Microsoft\Microsoft SQL Server\OLTP\MSSQLSERVER to
id 4 due to timer
00000780.00000e6c::2005/01/05-18:23:22.676 INFO [Qfs] QfsGetTempFileName
C:\Temp\, CLS, 41268 => C:\Temp\CLSA164.tmp, status 0
00000780.00000e6c::2005/01/05-18:23:22.676 INFO [Qfs] QfsDeleteFile
C:\Temp\CLSA164.tmp, status 0
00000780.00000e6c::2005/01/05-18:23:22.707 INFO [Qfs] QfsRegSaveKey
C:\Temp\CLSA164.tmp, status 0
The cluster is not running with the required access. Pls check the access by
giving the correct user / pass
Regards
Nirvan
"Joe P." wrote:

> Please help me determine what could cause the SQL Server 2000 Cluster error
> listed below. This is a server with SQL Server 2000 Enterprise Edition as an
> Active/Active Cluster and Windows 2003 Server.
> Please help me with this error.
> Thanks,
>
> 00000780.0000149c::2005/01/05-18:22:53.035 INFO [API] User denied access
> using default cluster SD. GetLastError() = 0x00000005; dwStatus = 0x00000000.
> 000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
> 000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] printODBCError: sqlstate = 01000; native error = 2746;
> message = [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionWrite
> (send()).
> 000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] printODBCError: sqlstate = 08S01; native error = b;
> message = [Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]General network
> error. Check your network documentation.
> 000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] OnlineThread: QP is not online.
> 000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
> 000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] printODBCError: sqlstate = 08S01; native error = 0;
> message = [Microsoft][ODBC SQL Server Driver]Communication link failure
> 000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
> 000008ec.000007e4::2005/01/05-18:23:17.957 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] printODBCError: sqlstate = 08S01; native error = 0;
> message = [Microsoft][ODBC SQL Server Driver]Communication link failure
> 000008ec.000007e4::2005/01/05-18:23:17.973 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
> 000008ec.000007e4::2005/01/05-18:23:17.973 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] printODBCError: sqlstate = 08S01; native error = 0;
> message = [Microsoft][ODBC SQL Server Driver]Communication link failure
> 000008ec.000007e4::2005/01/05-18:23:17.973 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
> 000008ec.000007e4::2005/01/05-18:23:17.973 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] printODBCError: sqlstate = 08S01; native error = 0;
> message = [Microsoft][ODBC SQL Server Driver]Communication link failure
> 000008ec.000007e4::2005/01/05-18:23:17.973 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] CheckQueryProcessorAlive: sqlexecdirect failed
> 000008ec.000007e4::2005/01/05-18:23:17.973 ERR SQL Server <SQL Server
> (OLTP)>: [sqsrvres] printODBCError: sqlstate = 08S01; native error = 0;
> message = [Microsoft][ODBC SQL Server Driver]Communication link failure
> 00000780.00000e6c::2005/01/05-18:23:22.676 INFO [CP] CppRegNotifyThread
> checkpointing key Software\Microsoft\Microsoft SQL Server\OLTP\MSSQLSERVER to
> id 4 due to timer
> 00000780.00000e6c::2005/01/05-18:23:22.676 INFO [Qfs] QfsGetTempFileName
> C:\Temp\, CLS, 41268 => C:\Temp\CLSA164.tmp, status 0
> 00000780.00000e6c::2005/01/05-18:23:22.676 INFO [Qfs] QfsDeleteFile
> C:\Temp\CLSA164.tmp, status 0
> 00000780.00000e6c::2005/01/05-18:23:22.707 INFO [Qfs] QfsRegSaveKey
> C:\Temp\CLSA164.tmp, status 0
>
|||This might help explain...
http://support.microsoft.com/default...b;en-us;291255
jg
[quote]Originally posted by Joe P.
[b]Please help me determine what could cause the SQL Server 2000 Cluster error
listed below. This is a server with SQL Server 2000 Enterprise Edition as an
Active/Active Cluster and Windows 2003 Server.
Please help me with this error.
Thanks,|||The service account that MSCS is running under connects to the SQL
instance every 60 seconds by default (configurable in advanced tab of
the SQL Server resource in cluster administrator) and runs
select @.@.server
using its trusted connection. If it's capable of doing that then it's
happy that the SQL instance is alive. It also does a looks alive poll
every 5 seconds (by default) but I'm not sure what it does for a looks
alive poll (probably just a quick check of the status of the MSSQLServer
service on the owner node).
Basically, make sure the cluster service account has a trusted
connection to the SQL server. All it needs is to be a member of the
public role in the master DB (which every login has anyway) so just add
a trusted login for it if it doesn't already exist.
*mike hodgson* |/ database administrator/ | mallesons stephen jaques
*T* +61 (2) 9296 3668 |* F* +61 (2) 9296 3885 |* M* +61 (408) 675 907
*E* mailto:mike.hodgson@.mallesons.nospam.com |* W* http://www.mallesons.com
Nirvan Biswas wrote:
[vbcol=seagreen]
>The cluster is not running with the required access. Pls check the access by
>giving the correct user / pass
>Regards
>Nirvan
>"Joe P." wrote:
>

Friday, February 24, 2012

Checking The Users Server Role

I would like to determine if a particular user has sysadmin server
role. Is there a way to do this via the connection string? Currently
our code checks if a login is valid using SQLDriverConnect, however we
need to be certain that the user can login and modify the schema.

Is it possible to fetch a user's server role to determine if it has a
sysadmin server role?Look for the IS_SRVROLEMEMBER function in Books Online.

Razvan|||Thanks.

Thursday, February 16, 2012

checking for range

hey all,
what's the best way to express this in a query?
for each employee
take the salary and determine which range the particular salary falls in.
for instance:
40k
falls between 35-40k so the category is 1
number of categories are 1-12
thanks,
rodcharSELECT Employee,
CASE
WHEN Salary BETWEEN 35000 AND 40000 THEN 1
WHEN Salary BETWEEN 40001 AND 45000 THEN 2
.
.
.
END AS "Category"
FROM [Your Table]
Or, you could have a table that stores that salary categories, and JOIN to i
t
SELECT e.Employee, c.Category
FROM [Your Table] e INNER JOIN [Salary Categories] c
ON e.Salary BETWEEN c.StartingSalary and c.EndingSalary
"rodchar" wrote:

> hey all,
> what's the best way to express this in a query?
> for each employee
> take the salary and determine which range the particular salary falls in.
> for instance:
> 40k
> falls between 35-40k so the category is 1
> number of categories are 1-12
> thanks,
> rodchar|||select case when salary < 40 and salary > 35 then 1
when salary >= 40 and salary < x then 2
when salary >= x and salary < y then 3
..
when salary > z then 12
end as 'category'|||Besides the CASE examples posted, consider a table of categories with
their ranges, and JOIN to it with the range test:
FROM Employees JOIN Ranges
ON Employees.salary >= Ranges.RangeMin
AND Employees.salary < Ranges.RangeMax
Roy
On Thu, 18 May 2006 14:35:01 -0700, rodchar
<rodchar@.discussions.microsoft.com> wrote:

>hey all,
>what's the best way to express this in a query?
>for each employee
>take the salary and determine which range the particular salary falls in.
>for instance:
>40k
>falls between 35-40k so the category is 1
>number of categories are 1-12
>thanks,
>rodchar|||thanks everyone for the help. i appreciate it a lot.
"rodchar" wrote:

> hey all,
> what's the best way to express this in a query?
> for each employee
> take the salary and determine which range the particular salary falls in.
> for instance:
> 40k
> falls between 35-40k so the category is 1
> number of categories are 1-12
> thanks,
> rodchar|||nice clean solution!! thanks.

Friday, February 10, 2012

Check Temp table size?

I have a tempdb which fills up the disk frequently. I want to determine the
size of each object in the tempdb.
I used EXEC sp_spaceused '#temptablename'. I got the "#temptablename" does
not exist error. I got the temp table names from INFORMATION_SCHEMA.TABLES.
Since the temp tables only valid for their own session, how can I check its
size of temp tables through Query Analyzer?
Another question is how to analyze the log file space usage? The log file
for my TempDB grows dramatically fast too. I need understand the reason.
Thanks a lot,
FL
EXEC tempdb..spaceused '#temptablename'
http://www.aspfaq.com/
(Reverse address to reply.)
"FLX" <nospam@.hotmail.com> wrote in message
news:e$uxjy91EHA.3368@.TK2MSFTNGP10.phx.gbl...
> I have a tempdb which fills up the disk frequently. I want to determine
the
> size of each object in the tempdb.
> I used EXEC sp_spaceused '#temptablename'. I got the "#temptablename" does
> not exist error. I got the temp table names from
INFORMATION_SCHEMA.TABLES.
> Since the temp tables only valid for their own session, how can I check
its
> size of temp tables through Query Analyzer?
> Another question is how to analyze the log file space usage? The log file
> for my TempDB grows dramatically fast too. I need understand the reason.
> Thanks a lot,
> FL
>
>
>
>
|||Thanks.
It did not solve my problem. Maybe my question was not clear. The
#temptablename was created in the stored procedure. Since it is a local temp
table, I can not access it from the Query Analyzer. What is the workaround?
I know if it is a global temp table I can access it.
FL
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:%23sIQO391EHA.1396@.tk2msftngp13.phx.gbl...[vbcol=seagreen]
> EXEC tempdb..spaceused '#temptablename'
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "FLX" <nospam@.hotmail.com> wrote in message
> news:e$uxjy91EHA.3368@.TK2MSFTNGP10.phx.gbl...
> the
does[vbcol=seagreen]
> INFORMATION_SCHEMA.TABLES.
> its
file
>
|||You want to check the size of a temp table created in a stored procedure,
from query analyzer OUTSIDE the scope of the stored procedure?
I don't think this is possible, unless you manually inspect
tempdb..sysobjects and guess which table is from the specific stored
procedure scope you are interested in. What do you expect will happen when
the stored procedure is being executed by 12 different people
simultaneously? Since the temp table only lives for the scope of the stored
procedure, why do you care aout its size OUTSIDE of that scope?
http://www.aspfaq.com/
(Reverse address to reply.)
"FLX" <nospam@.hotmail.com> wrote in message
news:u46sZM$1EHA.4004@.tk2msftngp13.phx.gbl...
> Thanks.
> It did not solve my problem. Maybe my question was not clear. The
> #temptablename was created in the stored procedure. Since it is a local
temp
> table, I can not access it from the Query Analyzer. What is the
workaround?[vbcol=seagreen]
> I know if it is a global temp table I can access it.
> FL
>
>
>
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:%23sIQO391EHA.1396@.tk2msftngp13.phx.gbl...
determine[vbcol=seagreen]
> does
check[vbcol=seagreen]
> file
reason.
>
|||> I don't think this is possible, unless you manually inspect
> tempdb..sysobjects and guess which table is from the specific stored
> procedure scope you are interested in.
This is unfortunate.

>What do you expect will happen when
> the stored procedure is being executed by 12 different people
> simultaneously?
I expect 12 temp tables with unique Table Names stored in the database.
Let's say there is a temp table "#tempTable" is created in the stored
procedure. Two people simultaneously execute the stored procedure. When I
ran the following query,
use tempdb
go
select *
FROM INFORMATION_SCHEMA.TABLES
In the tablename column, I saw:
#tempTable________________________________________ __________________________
_________________________________________000000058 617
#tempTable________________________________________ __________________________
_________________________________________000000058 628
Please notice the appendix are different.

>Since the temp table only lives for the scope of the stored
> procedure, why do you care aout its size OUTSIDE of that scope?
My tempdb is too large and I want to figure out the cause. One obvious
reason is that we used too many temp tables created in the stored
procedures. I know theoritically the temp table will be automatically
dropped when the stored procedure exits. However, I don't why my tempdb size
keeps growing and can not be shrinked.
Thanks a lot.
|||>
#tempTable________________________________________ __________________________
> _________________________________________000000058 617
>
#tempTable________________________________________ __________________________
> _________________________________________000000058 628
> Please notice the appendix are different.
Yes, those suffixes are generated by SQL Server internally to track #temp
tables from different sessions. Again, you would have to guess which one is
which.

> However, I don't why my tempdb size
> keeps growing and can not be shrinked.
http://www.aspfaq.com/2446
http://www.aspfaq.com/2471
|||> > However, I don't why my tempdb size
> http://www.aspfaq.com/2446
> http://www.aspfaq.com/2471
>
Very helpful link. However, when I ran the following query:
USE tempdb
GO
EXEC sp_spaceused @.updateusage = 'TRUE'
I got the result like:
database_name
database_size unallocated space
--- --
-- --
tempdb
4425.94 MB 4140.27 MB
reserved data index_size unused
-- -- -- --
624 KB 216 KB 320 KB 88 KB
My questions are:
1. What does the unallocated space mean? Free space? Unused space? Why I can
not reclaim the such space by shrinking db?
2.The data and index add up together are only 216 + 320 = 536 KB. It is less
than 1 MB. Why my tempdb is so large (> 4GB)? Any hint?
Thanks
|||The possible reasons for tempdb growth are listed in that article. Why is
your tempdb so large? I have no idea. Probably one or more of those
reasons. Why can't you shrink it? I have no idea. What else is going on
in the system? What command are you using to shrink the database? Does it
complete successfully, or do you get an error? If you get an error, what is
it?
http://www.aspfaq.com/
(Reverse address to reply.)
"FLX" <nospam@.hotmail.com> wrote in message
news:uDHsq7H2EHA.936@.TK2MSFTNGP12.phx.gbl...
> Very helpful link. However, when I ran the following query:
> USE tempdb
> GO
> EXEC sp_spaceused @.updateusage = 'TRUE'
> I got the result like:
> database_name
> database_size unallocated space
> --- --
--
> -- --
> tempdb
> 4425.94 MB 4140.27 MB
>
> reserved data index_size unused
> -- -- -- --
> 624 KB 216 KB 320 KB 88 KB
>
> My questions are:
> 1. What does the unallocated space mean? Free space? Unused space? Why I
can
> not reclaim the such space by shrinking db?
> 2.The data and index add up together are only 216 + 320 = 536 KB. It is
less
> than 1 MB. Why my tempdb is so large (> 4GB)? Any hint?
> Thanks
>
>
>

Check Temp table size?

I have a tempdb which fills up the disk frequently. I want to determine the
size of each object in the tempdb.
I used EXEC sp_spaceused '#temptablename'. I got the "#temptablename" does
not exist error. I got the temp table names from INFORMATION_SCHEMA.TABLES.
Since the temp tables only valid for their own session, how can I check its
size of temp tables through Query Analyzer?
Another question is how to analyze the log file space usage? The log file
for my TempDB grows dramatically fast too. I need understand the reason.
Thanks a lot,
FLEXEC tempdb..spaceused '#temptablename'
--
http://www.aspfaq.com/
(Reverse address to reply.)
"FLX" <nospam@.hotmail.com> wrote in message
news:e$uxjy91EHA.3368@.TK2MSFTNGP10.phx.gbl...
> I have a tempdb which fills up the disk frequently. I want to determine
the
> size of each object in the tempdb.
> I used EXEC sp_spaceused '#temptablename'. I got the "#temptablename" does
> not exist error. I got the temp table names from
INFORMATION_SCHEMA.TABLES.
> Since the temp tables only valid for their own session, how can I check
its
> size of temp tables through Query Analyzer?
> Another question is how to analyze the log file space usage? The log file
> for my TempDB grows dramatically fast too. I need understand the reason.
> Thanks a lot,
> FL
>
>
>
>|||Thanks.
It did not solve my problem. Maybe my question was not clear. The
#temptablename was created in the stored procedure. Since it is a local temp
table, I can not access it from the Query Analyzer. What is the workaround?
I know if it is a global temp table I can access it.
FL
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:%23sIQO391EHA.1396@.tk2msftngp13.phx.gbl...
> EXEC tempdb..spaceused '#temptablename'
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "FLX" <nospam@.hotmail.com> wrote in message
> news:e$uxjy91EHA.3368@.TK2MSFTNGP10.phx.gbl...
> > I have a tempdb which fills up the disk frequently. I want to determine
> the
> > size of each object in the tempdb.
> >
> > I used EXEC sp_spaceused '#temptablename'. I got the "#temptablename"
does
> > not exist error. I got the temp table names from
> INFORMATION_SCHEMA.TABLES.
> > Since the temp tables only valid for their own session, how can I check
> its
> > size of temp tables through Query Analyzer?
> >
> > Another question is how to analyze the log file space usage? The log
file
> > for my TempDB grows dramatically fast too. I need understand the reason.
> >
> > Thanks a lot,
> > FL
> >
> >
> >
> >
> >
> >
> >
>|||You want to check the size of a temp table created in a stored procedure,
from query analyzer OUTSIDE the scope of the stored procedure?
I don't think this is possible, unless you manually inspect
tempdb..sysobjects and guess which table is from the specific stored
procedure scope you are interested in. What do you expect will happen when
the stored procedure is being executed by 12 different people
simultaneously? Since the temp table only lives for the scope of the stored
procedure, why do you care aout its size OUTSIDE of that scope?
--
http://www.aspfaq.com/
(Reverse address to reply.)
"FLX" <nospam@.hotmail.com> wrote in message
news:u46sZM$1EHA.4004@.tk2msftngp13.phx.gbl...
> Thanks.
> It did not solve my problem. Maybe my question was not clear. The
> #temptablename was created in the stored procedure. Since it is a local
temp
> table, I can not access it from the Query Analyzer. What is the
workaround?
> I know if it is a global temp table I can access it.
> FL
>
>
>
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:%23sIQO391EHA.1396@.tk2msftngp13.phx.gbl...
> > EXEC tempdb..spaceused '#temptablename'
> >
> > --
> > http://www.aspfaq.com/
> > (Reverse address to reply.)
> >
> >
> >
> >
> > "FLX" <nospam@.hotmail.com> wrote in message
> > news:e$uxjy91EHA.3368@.TK2MSFTNGP10.phx.gbl...
> > > I have a tempdb which fills up the disk frequently. I want to
determine
> > the
> > > size of each object in the tempdb.
> > >
> > > I used EXEC sp_spaceused '#temptablename'. I got the "#temptablename"
> does
> > > not exist error. I got the temp table names from
> > INFORMATION_SCHEMA.TABLES.
> > > Since the temp tables only valid for their own session, how can I
check
> > its
> > > size of temp tables through Query Analyzer?
> > >
> > > Another question is how to analyze the log file space usage? The log
> file
> > > for my TempDB grows dramatically fast too. I need understand the
reason.
> > >
> > > Thanks a lot,
> > > FL
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>|||> I don't think this is possible, unless you manually inspect
> tempdb..sysobjects and guess which table is from the specific stored
> procedure scope you are interested in.
This is unfortunate.
>What do you expect will happen when
> the stored procedure is being executed by 12 different people
> simultaneously?
I expect 12 temp tables with unique Table Names stored in the database.
Let's say there is a temp table "#tempTable" is created in the stored
procedure. Two people simultaneously execute the stored procedure. When I
ran the following query,
use tempdb
go
select *
FROM INFORMATION_SCHEMA.TABLES
In the tablename column, I saw:
#tempTable__________________________________________________________________
_________________________________________000000058617
#tempTable__________________________________________________________________
_________________________________________000000058628
Please notice the appendix are different.
>Since the temp table only lives for the scope of the stored
> procedure, why do you care aout its size OUTSIDE of that scope?
My tempdb is too large and I want to figure out the cause. One obvious
reason is that we used too many temp tables created in the stored
procedures. I know theoritically the temp table will be automatically
dropped when the stored procedure exits. However, I don't why my tempdb size
keeps growing and can not be shrinked.
Thanks a lot.|||>
#tempTable__________________________________________________________________
> _________________________________________000000058617
>
#tempTable__________________________________________________________________
> _________________________________________000000058628
> Please notice the appendix are different.
Yes, those suffixes are generated by SQL Server internally to track #temp
tables from different sessions. Again, you would have to guess which one is
which.
> However, I don't why my tempdb size
> keeps growing and can not be shrinked.
http://www.aspfaq.com/2446
http://www.aspfaq.com/2471|||> > However, I don't why my tempdb size
> > keeps growing and can not be shrinked.
> http://www.aspfaq.com/2446
> http://www.aspfaq.com/2471
>
Very helpful link. However, when I ran the following query:
USE tempdb
GO
EXEC sp_spaceused @.updateusage = 'TRUE'
I got the result like:
database_name
database_size unallocated space
--- --
-- --
tempdb
4425.94 MB 4140.27 MB
reserved data index_size unused
-- -- -- --
624 KB 216 KB 320 KB 88 KB
My questions are:
1. What does the unallocated space mean? Free space? Unused space? Why I can
not reclaim the such space by shrinking db?
2.The data and index add up together are only 216 + 320 = 536 KB. It is less
than 1 MB. Why my tempdb is so large (> 4GB)? Any hint?
Thanks|||The possible reasons for tempdb growth are listed in that article. Why is
your tempdb so large? I have no idea. Probably one or more of those
reasons. Why can't you shrink it? I have no idea. What else is going on
in the system? What command are you using to shrink the database? Does it
complete successfully, or do you get an error? If you get an error, what is
it?
--
http://www.aspfaq.com/
(Reverse address to reply.)
"FLX" <nospam@.hotmail.com> wrote in message
news:uDHsq7H2EHA.936@.TK2MSFTNGP12.phx.gbl...
> > > However, I don't why my tempdb size
> > > keeps growing and can not be shrinked.
> >
> > http://www.aspfaq.com/2446
> > http://www.aspfaq.com/2471
> >
> Very helpful link. However, when I ran the following query:
> USE tempdb
> GO
> EXEC sp_spaceused @.updateusage = 'TRUE'
> I got the result like:
> database_name
> database_size unallocated space
> --- --
--
> -- --
> tempdb
> 4425.94 MB 4140.27 MB
>
> reserved data index_size unused
> -- -- -- --
> 624 KB 216 KB 320 KB 88 KB
>
> My questions are:
> 1. What does the unallocated space mean? Free space? Unused space? Why I
can
> not reclaim the such space by shrinking db?
> 2.The data and index add up together are only 216 + 320 = 536 KB. It is
less
> than 1 MB. Why my tempdb is so large (> 4GB)? Any hint?
> Thanks
>
>
>

Check Temp table size?

I have a tempdb which fills up the disk frequently. I want to determine the
size of each object in the tempdb.
I used EXEC sp_spaceused '#temptablename'. I got the "#temptablename" does
not exist error. I got the temp table names from INFORMATION_SCHEMA.TABLES.
Since the temp tables only valid for their own session, how can I check its
size of temp tables through Query Analyzer?
Another question is how to analyze the log file space usage? The log file
for my TempDB grows dramatically fast too. I need understand the reason.
Thanks a lot,
FLEXEC tempdb..spaceused '#temptablename'
http://www.aspfaq.com/
(Reverse address to reply.)
"FLX" <nospam@.hotmail.com> wrote in message
news:e$uxjy91EHA.3368@.TK2MSFTNGP10.phx.gbl...
> I have a tempdb which fills up the disk frequently. I want to determine
the
> size of each object in the tempdb.
> I used EXEC sp_spaceused '#temptablename'. I got the "#temptablename" does
> not exist error. I got the temp table names from
INFORMATION_SCHEMA.TABLES.
> Since the temp tables only valid for their own session, how can I check
its
> size of temp tables through Query Analyzer?
> Another question is how to analyze the log file space usage? The log file
> for my TempDB grows dramatically fast too. I need understand the reason.
> Thanks a lot,
> FL
>
>
>
>|||Thanks.
It did not solve my problem. Maybe my question was not clear. The
#temptablename was created in the stored procedure. Since it is a local temp
table, I can not access it from the Query Analyzer. What is the workaround?
I know if it is a global temp table I can access it.
FL
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:%23sIQO391EHA.1396@.tk2msftngp13.phx.gbl...
> EXEC tempdb..spaceused '#temptablename'
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "FLX" <nospam@.hotmail.com> wrote in message
> news:e$uxjy91EHA.3368@.TK2MSFTNGP10.phx.gbl...
> the
does[vbcol=seagreen]
> INFORMATION_SCHEMA.TABLES.
> its
file[vbcol=seagreen]
>|||You want to check the size of a temp table created in a stored procedure,
from query analyzer OUTSIDE the scope of the stored procedure?
I don't think this is possible, unless you manually inspect
tempdb..sysobjects and guess which table is from the specific stored
procedure scope you are interested in. What do you expect will happen when
the stored procedure is being executed by 12 different people
simultaneously? Since the temp table only lives for the scope of the stored
procedure, why do you care aout its size OUTSIDE of that scope?
http://www.aspfaq.com/
(Reverse address to reply.)
"FLX" <nospam@.hotmail.com> wrote in message
news:u46sZM$1EHA.4004@.tk2msftngp13.phx.gbl...
> Thanks.
> It did not solve my problem. Maybe my question was not clear. The
> #temptablename was created in the stored procedure. Since it is a local
temp
> table, I can not access it from the Query Analyzer. What is the
workaround?
> I know if it is a global temp table I can access it.
> FL
>
>
>
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:%23sIQO391EHA.1396@.tk2msftngp13.phx.gbl...
determine[vbcol=seagreen]
> does
check[vbcol=seagreen]
> file
reason.[vbcol=seagreen]
>|||> I don't think this is possible, unless you manually inspect
> tempdb..sysobjects and guess which table is from the specific stored
> procedure scope you are interested in.
This is unfortunate.

>What do you expect will happen when
> the stored procedure is being executed by 12 different people
> simultaneously?
I expect 12 temp tables with unique Table Names stored in the database.
Let's say there is a temp table "#tempTable" is created in the stored
procedure. Two people simultaneously execute the stored procedure. When I
ran the following query,
use tempdb
go
select *
FROM INFORMATION_SCHEMA.TABLES
In the tablename column, I saw:
#tempTable______________________________
____________________________________
________________________________________
_000000058617
#tempTable______________________________
____________________________________
________________________________________
_000000058628
Please notice the appendix are different.

>Since the temp table only lives for the scope of the stored
> procedure, why do you care aout its size OUTSIDE of that scope?
My tempdb is too large and I want to figure out the cause. One obvious
reason is that we used too many temp tables created in the stored
procedures. I know theoritically the temp table will be automatically
dropped when the stored procedure exits. However, I don't why my tempdb size
keeps growing and can not be shrinked.
Thanks a lot.|||>
#tempTable______________________________
____________________________________[vbc
ol=seagreen]
> ________________________________________
_000000058617
>[/vbcol]
#tempTable______________________________
____________________________________[vbc
ol=seagreen]
> ________________________________________
_000000058628
> Please notice the appendix are different.[/vbcol]
Yes, those suffixes are generated by SQL Server internally to track #temp
tables from different sessions. Again, you would have to guess which one is
which.

> However, I don't why my tempdb size
> keeps growing and can not be shrinked.
http://www.aspfaq.com/2446
http://www.aspfaq.com/2471|||> > However, I don't why my tempdb size
> http://www.aspfaq.com/2446
> http://www.aspfaq.com/2471
>
Very helpful link. However, when I ran the following query:
USE tempdb
GO
EXEC sp_spaceused @.updateusage = 'TRUE'
I got the result like:
database_name
database_size unallocated space
--- --
-- --
tempdb
4425.94 MB 4140.27 MB
reserved data index_size unused
-- -- -- --
624 KB 216 KB 320 KB 88 KB
My questions are:
1. What does the unallocated space mean? Free space? Unused space? Why I can
not reclaim the such space by shrinking db?
2.The data and index add up together are only 216 + 320 = 536 KB. It is less
than 1 MB. Why my tempdb is so large (> 4GB)? Any hint?
Thanks|||The possible reasons for tempdb growth are listed in that article. Why is
your tempdb so large? I have no idea. Probably one or more of those
reasons. Why can't you shrink it? I have no idea. What else is going on
in the system? What command are you using to shrink the database? Does it
complete successfully, or do you get an error? If you get an error, what is
it?
http://www.aspfaq.com/
(Reverse address to reply.)
"FLX" <nospam@.hotmail.com> wrote in message
news:uDHsq7H2EHA.936@.TK2MSFTNGP12.phx.gbl...
> Very helpful link. However, when I ran the following query:
> USE tempdb
> GO
> EXEC sp_spaceused @.updateusage = 'TRUE'
> I got the result like:
> database_name
> database_size unallocated space
> --- --
--
> -- --
> tempdb
> 4425.94 MB 4140.27 MB
>
> reserved data index_size unused
> -- -- -- --
> 624 KB 216 KB 320 KB 88 KB
>
> My questions are:
> 1. What does the unallocated space mean? Free space? Unused space? Why I
can
> not reclaim the such space by shrinking db?
> 2.The data and index add up together are only 216 + 320 = 536 KB. It is
less
> than 1 MB. Why my tempdb is so large (> 4GB)? Any hint?
> Thanks
>
>
>

Check Server Disk Space Daily

I know can execute perfmon program to determine disk space on the server.
I would like a simple SQL Server job (SQL Server 2000) I can set up to run
once a day. Check all drives on the server if unused disk space is less than
10% then send alert message.
Please help me with this task.
See if this helps.
Using xp_fixeddrives to Monitor Free Space
http://www.databasejournal.com/features/mssql/article.php/3080501
AMB
"Joe K." wrote:

> I know can execute perfmon program to determine disk space on the server.
> I would like a simple SQL Server job (SQL Server 2000) I can set up to run
> once a day. Check all drives on the server if unused disk space is less than
> 10% then send alert message.
> Please help me with this task.
|||Grab sp_diskspace from here http://www.sqldbatips.com/showcode.asp?ID=4 and
simply insert results into a table and run your check against it.
HTH,
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
"Joe K." <JoeK@.discussions.microsoft.com> wrote in message
news:1C11A458-4317-40F0-A4E5-0C07520C88D5@.microsoft.com...
> I know can execute perfmon program to determine disk space on the server.
> I would like a simple SQL Server job (SQL Server 2000) I can set up to run
> once a day. Check all drives on the server if unused disk space is less
> than
> 10% then send alert message.
> Please help me with this task.

Check Server Disk Space Daily

I know can execute perfmon program to determine disk space on the server.
I would like a simple SQL Server job (SQL Server 2000) I can set up to run
once a day. Check all drives on the server if unused disk space is less than
10% then send alert message.
Please help me with this task.Grab sp_diskspace from here http://www.sqldbatips.com/showcode.asp?ID=4 and
simply insert results into a table and run your check against it.
--
HTH,
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
"Joe K." <JoeK@.discussions.microsoft.com> wrote in message
news:1C11A458-4317-40F0-A4E5-0C07520C88D5@.microsoft.com...
> I know can execute perfmon program to determine disk space on the server.
> I would like a simple SQL Server job (SQL Server 2000) I can set up to run
> once a day. Check all drives on the server if unused disk space is less
> than
> 10% then send alert message.
> Please help me with this task.

Check Server Disk Space Daily

I know can execute perfmon program to determine disk space on the server.
I would like a simple SQL Server job (SQL Server 2000) I can set up to run
once a day. Check all drives on the server if unused disk space is less tha
n
10% then send alert message.
Please help me with this task.See if this helps.
Using xp_fixeddrives to Monitor Free Space
http://www.databasejournal.com/feat...cle.php/3080501
AMB
"Joe K." wrote:

> I know can execute perfmon program to determine disk space on the server.
> I would like a simple SQL Server job (SQL Server 2000) I can set up to run
> once a day. Check all drives on the server if unused disk space is less t
han
> 10% then send alert message.
> Please help me with this task.|||Grab sp_diskspace from here http://www.sqldbatips.com/showcode.asp?ID=4 and
simply insert results into a table and run your check against it.
HTH,
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
"Joe K." <JoeK@.discussions.microsoft.com> wrote in message
news:1C11A458-4317-40F0-A4E5-0C07520C88D5@.microsoft.com...
> I know can execute perfmon program to determine disk space on the server.
> I would like a simple SQL Server job (SQL Server 2000) I can set up to run
> once a day. Check all drives on the server if unused disk space is less
> than
> 10% then send alert message.
> Please help me with this task.