Showing posts with label locating. Show all posts
Showing posts with label locating. Show all posts

Monday, March 19, 2012

Locating strange updates

Is there any simple way in EM to put an audit on a field to see when
and what is updating it ?
Thanks"Nucleo" <nucleo@.gmail.com> wrote in message
news:1135001926.638640.188450@.g49g2000cwa.googlegroups.com...
> Is there any simple way in EM to put an audit on a field to see when
> and what is updating it ?
> Thanks
>
Not in EM, but you can do it in SQL Profiler. Of course the profiler will
need to be constantly running to perform this action.
The only other way is to create an UPDATE trigger on the table and have it
spit out the data somewhere. You can gather information from the System
functions like SUSER_SNAME and so forth in the trigger.
Rick Sawtell
MCT, MCSD, MCDBA|||There is no simple Enterprise Manager feature that can give you desired
results within a few minutes.
This article descibes how to implement data auditing using triggers:
http://msdn.microsoft.com/msdnmag/i.../04/DataPoints/
The following describes how to use SQL Profiler auditing events.
http://msdn.microsoft.com/library/d...>
erf_86ib.asp
http://msdn.microsoft.com/library/d...>
erf_6koi.asp
http://msdn.microsoft.com/library/d...>
erf_6zg3.asp
"Nucleo" <nucleo@.gmail.com> wrote in message
news:1135001926.638640.188450@.g49g2000cwa.googlegroups.com...
> Is there any simple way in EM to put an audit on a field to see when
> and what is updating it ?
> Thanks
>

locating sqlexpress database

I have created my sqlexpress database in Visual Studio 2005. When i go to SQL Server Management Studio Express I cannot open my database. It is not listed automatically and I get an error 'There is no editor for 'database name' Make sure the application for file type (.mdf) if installed.'

Any help or suggestions will be appreciated.

Thanks

hmmmm.. When you open sql server management studio are you able to connect to your local sql express 05 instance? Can you see your system tables like Master etc.?

If so, is it possible that you just need to attach to the MDF by right clicking on the local server and selecting "Attach" and then pointing to this new database you have created?

|||

Databases that are created by Visual Studio reside in a per user location and are not attached to the main instance of SQL Express. VS uses a special kind of instance of SQL Express called a User Instance. VS provides a fairly complete set of database management tools built-in, so you should be able to do your management task from directly in VS.

There are a couple barriers if you want to open your database from VS in Management Studio:

VS database are created in a directory that SQL Express doesn't have permissions for, so the file can't be attached. You would need to grant the Network Service account permissions to the project directory where the database file exists.|||

Hey Mike,

Even after granting Network Service account full permissions to all directories, I still could not locate or attatch the dbase, it wouldnt see anything in the folder where it was at.

Regards

Tom

locating sqlexpress database

I have created my sqlexpress database in Visual Studio 2005. When i go to SQL Server Management Studio Express I cannot open my database. It is not listed automatically and I get an error 'There is no editor for 'database name' Make sure the application for file type (.mdf) if installed.'

Any help or suggestions will be appreciated.

Thanks

hmmmm.. When you open sql server management studio are you able to connect to your local sql express 05 instance? Can you see your system tables like Master etc.?

If so, is it possible that you just need to attach to the MDF by right clicking on the local server and selecting "Attach" and then pointing to this new database you have created?

|||

Databases that are created by Visual Studio reside in a per user location and are not attached to the main instance of SQL Express. VS uses a special kind of instance of SQL Express called a User Instance. VS provides a fairly complete set of database management tools built-in, so you should be able to do your management task from directly in VS.

There are a couple barriers if you want to open your database from VS in Management Studio:

VS database are created in a directory that SQL Express doesn't have permissions for, so the file can't be attached. You would need to grant the Network Service account permissions to the project directory where the database file exists.|||

Hey Mike,

Even after granting Network Service account full permissions to all directories, I still could not locate or attatch the dbase, it wouldnt see anything in the folder where it was at.

Regards

Tom

locating set of points close to one another (within a threshold)

Hi all

I have a large data set of points situated in 3d space. I have a simple
primary key and an x, y and z value.

What I would like is an efficient method for finding the group of
points within a threshold.

So far I have tested the following however it is very slow.

-----
select *
from locations a full outer join locations b
on a.ID < b.ID and a.X-b.X<2 and a.Y-b.Y<2 and a.Z-b.Z<2
where a.ID is not null and b.ID is not null
-----

If anyone knows of a more efficient method to arrive at this results it
would be most appreciated.

Thanks in advance
Bevan(bevanward@.gmail.com) writes:
> I have a large data set of points situated in 3d space. I have a simple
> primary key and an x, y and z value.

Why is (x, y, z) not the primary key? Or put differently: what does it
mean if you have to points with the same coordinates?

If nothing else, the ID column serves to make the rows wider, which
means fewer rows per pages, which means worse performance.

> What I would like is an efficient method for finding the group of
> points within a threshold.
> So far I have tested the following however it is very slow.
> -----
> select *
> from locations a full outer join locations b
> on a.ID < b.ID and a.X-b.X<2 and a.Y-b.Y<2 and a.Z-b.Z<2
> where a.ID is not null and b.ID is not null
> -----

Not that I think that it matters much for execution time, but FULL JOIN
seems flat wrong here, and with the conditions in the WHERE clause you
make it an inner join anyway. I would write the query as:

select *
from locations a
cross join locations b
WHERE a.X < b.X + 2 and a.Y < b.Y + 2 and a.Z < b.Z + 2

It's important to have one coordinate alone on operator, that increases
the chance for an index being used. You do have an index on (x, y, z),
don't you?

Still I am far from certain that SQL Server will use an index. It would be
interesting to see the query plan for this query.

This is quite a difficult problem for a relational engine, and it could
be a case where a cursor is the best. Add a clustered index on (x, y, z).
Iterate over the points ordered by X. If the current point and the
previous point are less than 2 from each other, save the combination
into a temp table. The tricky part is that if you are at point N, it
may proximite to more than point you've already passed over. So you can
keep data in varaiables. You could use a table variable, but I think
that it's better to use the table itself. This is where it is important
that you have a clustered index on X.

Normally cursors are a poor solution, but the point here is that you
would only need to make one iteration over the table.

Faster than a cursor though, would be to get all data to a client
program (or a .Net stored procedure if you are on SQL 2005), since
traditional languages have better structures for this sort of problem.

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

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Erland Sommarskog (esquel@.sommarskog.se) writes:
> This is quite a difficult problem for a relational engine, and it could
> be a case where a cursor is the best.

I should stress that this is just a wild idea. It may very well prove
that a cursor solution is horribly slow - as cursor solutions often are.

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

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Erland really appreciate the effort you've put into this message it has
helped alot.

The reason there is a key as well as the location data is that is the
number the samples are collected and tacked against. There can be
points with the same coordinates in real life however there is a
problem where the coordinate location is confirmed with a more precise
method and it is given a new name - ideally it would not be possible to
enter this into the database however since the planning phase is not
mandatory it has to have a merge character... I hope in the future the
work flow can develop to stop these types of things happening.

I wasn't able to get the query to use the index (I do have a clustered
index on x, y, z) with either the cross join restricting on the where
or the full outer restricted on the null key.

I've had to give up on it for now but have printed your message and
will try to get something effective working - I will test a cursor
later today and see how it will run.

Unfortunately this database is still in 2000 however once it moves to
2005 I can see as you state this problem can be solved in a more
conventional manner.

Thanks again for your effort and I hope to be able to post a method
back that runs more efficiently in the near futuer.

Cheers
Bevan|||Why would you have a NULL identifier? I guess that two things can have
the same location, otherwise (x,y,z) would be a key. And should your
query look like this, since you want to go in both directions.on an
axis? The OUTER JOIN makes no sense.

SELECT A.node_id, B.node_id
FROM Locations AS A, Locations AS b
WHERE A.node_id < B.node_id
AND ABS(A.x-B.x) <= 2
AND ABS(A.y-B.y) <= 2
AND ABS(A.z-B.z) <= 2

I did something like in 2-D for neighborhoods based on quadrants. If a
node was in one quadrant, I assumed that the nine adjacent quads
centered on his quad would have the nearest neighbor, so i only did a
distanve formula on popint in those quads. It meant carrying an extra
pair of quad co-ordinates, but it saved searching all the nodes -- 9
quads versus ~15,000 quads.|||(bevanward@.gmail.com) writes:
> I have a large data set of points situated in 3d space. I have a simple
> primary key and an x, y and z value.
> What I would like is an efficient method for finding the group of
> points within a threshold.
> So far I have tested the following however it is very slow.
> -----
> select *
> from locations a full outer join locations b
> on a.ID < b.ID and a.X-b.X<2 and a.Y-b.Y<2 and a.Z-b.Z<2
> where a.ID is not null and b.ID is not null
> -----

As indicated by Celko's posting there is most probably an error here:
you need abs(a.X - b.X) etc, else you will get far too many points.

Mathematically it would also make more sense to use

sqrt(square(a.X - b.X) + square(a.Y - b.Y) + square(a.Z - b.Z)) < cutoff

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

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||I haven't implemented this on a large scale, but I'll pass on
what I think is a good approach. I suggested it in a different
context in the thread found here:
http://groups.google.com/groups/sea...=exemplar+skass
Variations on this idea are used in GIS and other such systems.
Note that my comments aren't specific to your exact question,
but they should apply reasonably well.

Very briefly, the idea is to maintain a set of points *not*
in your set that are evenly scattered through space - the
lattice points of a coarse grid. These will serve as neighborhood
markers, and with each point, you will store its NeighborhoodID.
You can think of these as neighborhood post offices, for example.
The coarseness of the grid will be chosen depending on what kinds
of questions you ask, but typically the size of the neighborhoods
reflects the meaning of "close".

Points can only be close to each other if they live in neighborhoods
that are close to each other, or equivalently, if their neighborhood
post offices are close to each other.

For example, if your 3D coordinates range from 0 to 1000
each, you might slice up space every 100 units and use these
as lattice points: {i*100+50,j*100+50,k+100*50) for 0<=i,j,k<10.
So you have 1000 lattice points in this case. No point in
space is more than 100*SQRT(3) ~ 86.6 units from one of these 1000
points, so this will work if the "closeness" you need is on this
order ("close" should mean same or adjacent neighborhood).

No matter how many points you have here, you have
only 1K neighborhoods. If you had 10M points, you
now have 10K points/neighborhood on average.

Now the part that reduces the cost of querying: For many queries,
you can first search or look up pairs of post offices, not points,
that meet your requirement of close. (This could be "adjacent
pairs" in most cases, and post office adjacencies could be
maintained permanently). There is one Mega-pair of post offices
in this example, but 100 Tera-pairs of points
(in nanoseconds, this is 1 millisecond vs. 1 day).
Even if you still have to look at all pairs of points in
adjacent neighborhoods, you have made progress, but for many
problems, you might be able to narrow down the search further.

You might maintain various values in your tables: for points,
the distance to the neighborhood post office and the post
office ID, or the same for all adjacent neighborhood post
offices. For post offices, you might maintain the number of
points in the neighborhood. You might use a fixed rectangular
lattice with a canonical way of enumerating neighbors, so you
can pack things into arrays, or you might allow the lattice to
be dynamic, depending on where the points are. You might maintain
all inter-postoffice distances or just nearby ones. And you
might use triggers a lot if there are many updates and
inserts, but if the data is relatively static, you might
maintain larger and well-indexed collections of
relevant calculations. Depending on how real-time the
system is, you might treat parts of it like a warehousing
problem. And on and on (there are many books on the subject,
on subjects like "spatial databases" and geodatabases -
I haven't read whole books on it)

This is only a sketch, and it is not trivial (but not impossible)
to implement, but maybe it will help. The alternative is
probably to look for GIS-type third-party products that can
connect to SQL data. I'm sure there are some out there, but
they may not be cheap.

The shorter answer is that there is probably no single fast
query to do most things like this if none of this framework is
in place. At best, maybe you can generate a crude lattice on
the fly with derived tables from Numbers tables - but that is
basically putting some of this framework in place.

Steve Kass
Drew University

bevanward@.gmail.com wrote:

> Hi all
> I have a large data set of points situated in 3d space. I have a simple
> primary key and an x, y and z value.
> What I would like is an efficient method for finding the group of
> points within a threshold.
> So far I have tested the following however it is very slow.
> -----
> select *
> from locations a full outer join locations b
> on a.ID < b.ID and a.X-b.X<2 and a.Y-b.Y<2 and a.Z-b.Z<2
> where a.ID is not null and b.ID is not null
> -----
> If anyone knows of a more efficient method to arrive at this results it
> would be most appreciated.
> Thanks in advance
> Bevan|||Another MVP colleague pointed me to this link:

http://research.microsoft.com/resea...MSR-TR-2005-122

The link is for SQL 2005, but the algorithm as such might be applicable.

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

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Square both sides to avoid conversions to FLOAT that SQRT() will give
you.

POWER ((A.x - B.x), 2) + POWER ((A.y - B.y), 2)+ POWER ((A.z - B.z), 2)
< POWER(cutoff , 2)

Locating S

I recently uploaded my site to the internet. But now, when I try to to log in, I receive the following error message:

An error has occurred while establishing a connection tothe server. When connecting to SQL Server 2005, this failure may becaused by the fact that under the default settings SQL Server does notallow remote connections. (provider: SQL Network Interfaces, error: 26- Error Locating Server/Instance Specified)

How do I fix this?


I assumed you mean you get this error when you uploaded your site to your hosting service.

This error usually means that your ASP.NET application is trying to connect to a SQL Express database. In general, very few webhosting provider support SQL Express because it is not intended for production use. Does your host offer SQL 2005? If so, migrate your data to the SQL 2k5 database and update your application's connection string in the web.config (or in the code itself) to point to the SQL 2k5 database.

Hope this helps.

|||You're right. Thanks for the help. Fixed it now.

Locating recently edited tables

Hi
Pop quiz: Let's say a user types in "Pennsylvania Av." in his customer
application. This application keeps its data in a SQL 2000 database.
What would be the easiest way for me to figure out which table got updated
with the "Pennsylvania Av." string?`
I don't care whether the solution is to change some view settings in my SQL
GUI or if I can write some t-sql code and output the solution for me, I just
need to figure out where the application stores the darn addresses.
Thanks in advance for any input
IbUse Profiler. You can catch the SQL statements submitted by the app. You can even catch the
execution plan and from that determine what tables were hit (if that approach is better than working
with the SQL submitted).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Ib Schrader" <ibschrader@.gmail.com> wrote in message news:ez2gcoqHHHA.1248@.TK2MSFTNGP02.phx.gbl...
> Hi
> Pop quiz: Let's say a user types in "Pennsylvania Av." in his customer application. This
> application keeps its data in a SQL 2000 database.
> What would be the easiest way for me to figure out which table got updated with the "Pennsylvania
> Av." string?`
> I don't care whether the solution is to change some view settings in my SQL GUI or if I can write
> some t-sql code and output the solution for me, I just need to figure out where the application
> stores the darn addresses.
> Thanks in advance for any input
> Ib
>|||Ib
Do you store "Pennsylvania Av." value in many tables?
"Ib Schrader" <ibschrader@.gmail.com> wrote in message
news:ez2gcoqHHHA.1248@.TK2MSFTNGP02.phx.gbl...
> Hi
> Pop quiz: Let's say a user types in "Pennsylvania Av." in his customer
> application. This application keeps its data in a SQL 2000 database.
> What would be the easiest way for me to figure out which table got updated
> with the "Pennsylvania Av." string?`
> I don't care whether the solution is to change some view settings in my
> SQL GUI or if I can write some t-sql code and output the solution for me,
> I just need to figure out where the application stores the darn addresses.
> Thanks in advance for any input
> Ib
>|||"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uVUvutqHHHA.3676@.TK2MSFTNGP03.phx.gbl...
> Ib
> Do you store "Pennsylvania Av." value in many tables?
I don't know that. The exercise is to locate which tables got updated by the
application. I don't know how many that is, but I suspect it's just one
table that stores the data.
Thanks for the profiler idea..I'll look into that.
Ib|||The profiler helped me catch which table got updated.
Thank you very much.
Ib

Locating recently edited tables

Hi
Pop quiz: Let's say a user types in "Pennsylvania Av." in his customer
application. This application keeps its data in a SQL 2000 database.
What would be the easiest way for me to figure out which table got updated
with the "Pennsylvania Av." string?`
I don't care whether the solution is to change some view settings in my SQL
GUI or if I can write some t-sql code and output the solution for me, I just
need to figure out where the application stores the darn addresses.
Thanks in advance for any input
IbUse Profiler. You can catch the SQL statements submitted by the app. You can
even catch the
execution plan and from that determine what tables were hit (if that approac
h is better than working
with the SQL submitted).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Ib Schrader" <ibschrader@.gmail.com> wrote in message news:ez2gcoqHHHA.1248@.TK2MSFTNGP02.phx
.gbl...
> Hi
> Pop quiz: Let's say a user types in "Pennsylvania Av." in his customer app
lication. This
> application keeps its data in a SQL 2000 database.
> What would be the easiest way for me to figure out which table got updated
with the "Pennsylvania
> Av." string?`
> I don't care whether the solution is to change some view settings in my SQ
L GUI or if I can write
> some t-sql code and output the solution for me, I just need to figure out
where the application
> stores the darn addresses.
> Thanks in advance for any input
> Ib
>|||Ib
Do you store "Pennsylvania Av." value in many tables?
"Ib Schrader" <ibschrader@.gmail.com> wrote in message
news:ez2gcoqHHHA.1248@.TK2MSFTNGP02.phx.gbl...
> Hi
> Pop quiz: Let's say a user types in "Pennsylvania Av." in his customer
> application. This application keeps its data in a SQL 2000 database.
> What would be the easiest way for me to figure out which table got updated
> with the "Pennsylvania Av." string?`
> I don't care whether the solution is to change some view settings in my
> SQL GUI or if I can write some t-sql code and output the solution for me,
> I just need to figure out where the application stores the darn addresses.
> Thanks in advance for any input
> Ib
>|||"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:uVUvutqHHHA.3676@.TK2MSFTNGP03.phx.gbl...
> Ib
> Do you store "Pennsylvania Av." value in many tables?
I don't know that. The exercise is to locate which tables got updated by the
application. I don't know how many that is, but I suspect it's just one
table that stores the data.
Thanks for the profiler idea..I'll look into that.
Ib|||The profiler helped me catch which table got updated.
Thank you very much.
Ib

Locating idle sessions using dm_exec_... DMV''s

Hi

I have been looking at the new DMV's prefixed with dm_exec_....and found a limitation with them.

Books online says sysprocesses is replaced with sys.dm_exec_connections, sys.dm_exec_requests and sys.dm_exec_sessions. The problem I came accross is identifying any sessions connected to a specific database which were idle. This is the sort of thing you need to know if you tried to restore a database and it says the database is in use.

I wonder if this is a bug or by design?

you can find idle connections by determining which connections have no active requests.

select *

from sys.dm_exec_connections ec

left join sys.dm_exec_requests er

on ec.connection_id = er.connection_id

where er.connection_id is null

sys.dm_exec_connections, sys.dm_exec_sessions and sys.dm_exec_requests will actually give you a super-set of what sysprocesses used to. A bit more work to pull out some of the information we all know and love, but much more powerful.

-Jerome

|||

Jerome

Thanks for the reply but it still does not work for me. If I run:

select spid,db_name(dbid) from sysprocesses where spid>50

I get

spid

--

51 msdb

52 master

53 master

however If I run

select ec.session_id,db_name(database_id)

from sys.dm_exec_connections ec

left join sys.dm_exec_requests er

on ec.connection_id = er.connection_id

I get

session_id

-- --

51 NULL

52 NULL

53 master

|||

Sorry Steve,

missed your point about getting the dbname that the session had last used. One way is to add sys.dm_tran_locks and get the database that the session has a lock on

select db_name(isnull(resource_database_id,1)), ec.session_id

from sys.dm_exec_connections ec

left join sys.dm_exec_requests er

on ec.connection_id = er.connection_id

left join sys.dm_tran_locks tl on tl.request_session_id = ec.session_id and resource_type='DATABASE'

where er.connection_id is null

-Jerome

|||Thanks Jerome, that returned the answer I was looking for.|||

Hi

Please help me with this:

I am looking for the Login Name, Hostname, cpu time and the text( sql stmts executed)

Using the DMVs

I used this query:

select * from (

SELECT sys.dm_exec_sessions.login_time,

sys.dm_exec_sessions.host_name,

sys.dm_exec_sessions.program_name,

sys.dm_exec_sessions.login_name,

sys.dm_exec_sessions.nt_user_name,

sys.dm_exec_query_stats.total_worker_time,

sys.dm_exec_requests.plan_handle

FROM sys.dm_exec_sessions

INNER JOIN sys.dm_exec_requests

ON sys.dm_exec_sessions.session_id = sys.dm_exec_requests.session_id

INNER JOIN sys.dm_exec_query_stats

ON sys.dm_exec_requests.sql_handle = sys.dm_exec_query_stats.sql_handle

)temp cross apply sys.dm_exec_sql_text(plan_handle) as sql_text

but its giving me only the text for that session of the user(not all the text), actually i am looking for all the text( stmt executed) by the user, cpu time since its in the cache/since user logged in

i get all the text taking long time to run with this without userid:

select * from (

select TOP 1000

sum(qs.total_worker_time) as total_cpu_time,

sum(qs.execution_count) as cnt,

count(*) as number_of_statements,

qs.plan_handle

from

sys.dm_exec_query_stats qs

group by qs.plan_handle

order by sum(qs.total_worker_time) desc

) tmp

cross apply sys.dm_exec_sql_text(plan_handle) as sql_text

please help me

thanks

Locating idle sessions using dm_exec_... DMV's

Hi

I have been looking at the new DMV's prefixed with dm_exec_....and found a limitation with them.

Books online says sysprocesses is replaced with sys.dm_exec_connections, sys.dm_exec_requests and sys.dm_exec_sessions. The problem I came accross is identifying any sessions connected to a specific database which were idle. This is the sort of thing you need to know if you tried to restore a database and it says the database is in use.

I wonder if this is a bug or by design?

you can find idle connections by determining which connections have no active requests.

select *

from sys.dm_exec_connections ec

left join sys.dm_exec_requests er

on ec.connection_id = er.connection_id

where er.connection_id is null

sys.dm_exec_connections, sys.dm_exec_sessions and sys.dm_exec_requests will actually give you a super-set of what sysprocesses used to. A bit more work to pull out some of the information we all know and love, but much more powerful.

-Jerome

|||

Jerome

Thanks for the reply but it still does not work for me. If I run:

select spid,db_name(dbid) from sysprocesses where spid>50

I get

spid

--

51 msdb

52 master

53 master

however If I run

select ec.session_id,db_name(database_id)

from sys.dm_exec_connections ec

left join sys.dm_exec_requests er

on ec.connection_id = er.connection_id

I get

session_id

-- --

51 NULL

52 NULL

53 master

|||

Sorry Steve,

missed your point about getting the dbname that the session had last used. One way is to add sys.dm_tran_locks and get the database that the session has a lock on

select db_name(isnull(resource_database_id,1)), ec.session_id

from sys.dm_exec_connections ec

left join sys.dm_exec_requests er

on ec.connection_id = er.connection_id

left join sys.dm_tran_locks tl on tl.request_session_id = ec.session_id and resource_type='DATABASE'

where er.connection_id is null

-Jerome

|||Thanks Jerome, that returned the answer I was looking for.|||

Hi

Please help me with this:

I am looking for the Login Name, Hostname, cpu time and the text( sql stmts executed)

Using the DMVs

I used this query:

select * from (

SELECT sys.dm_exec_sessions.login_time,

sys.dm_exec_sessions.host_name,

sys.dm_exec_sessions.program_name,

sys.dm_exec_sessions.login_name,

sys.dm_exec_sessions.nt_user_name,

sys.dm_exec_query_stats.total_worker_time,

sys.dm_exec_requests.plan_handle

FROM sys.dm_exec_sessions

INNER JOIN sys.dm_exec_requests

ON sys.dm_exec_sessions.session_id = sys.dm_exec_requests.session_id

INNER JOIN sys.dm_exec_query_stats

ON sys.dm_exec_requests.sql_handle = sys.dm_exec_query_stats.sql_handle

)temp cross apply sys.dm_exec_sql_text(plan_handle) as sql_text

but its giving me only the text for that session of the user(not all the text), actually i am looking for all the text( stmt executed) by the user, cpu time since its in the cache/since user logged in

i get all the text taking long time to run with this without userid:

select * from (

select TOP 1000

sum(qs.total_worker_time) as total_cpu_time,

sum(qs.execution_count) as cnt,

count(*) as number_of_statements,

qs.plan_handle

from

sys.dm_exec_query_stats qs

group by qs.plan_handle

order by sum(qs.total_worker_time) desc

) tmp

cross apply sys.dm_exec_sql_text(plan_handle) as sql_text

please help me

thanks

Locating a table using index page

Hello,

I not exactly sure how to determine the table when given the following
information:

--
Could not find the index for RID '999999' in index page
('1:99999999'), index id ), database (whatever).
--

Can you someone tell how I use the system tables to determine what
table this index corresponds to? I'm assuming I used sysindexes and
sysobjects somehow.

Thanks in advance,

JGB_DBA"jgb_dba" <jgb_dba@.yahoo.com> wrote in message
news:ab559e7c.0407260912.1addc564@.posting.google.c om...
> Hello,
> I not exactly sure how to determine the table when given the following
> information:
> --
> Could not find the index for RID '999999' in index page
> ('1:99999999'), index id ), database (whatever).
> --
> Can you someone tell how I use the system tables to determine what
> table this index corresponds to? I'm assuming I used sysindexes and
> sysobjects somehow.
> Thanks in advance,
>
> JGB_DBA

It looks like you may a corrupt database - see "Error 644" in Books Online
for details on how to correct it. You didn't give any information about your
MSSQL version or when the error occurs, but if you're using 2000 without the
latest servicepack, then you might be seeing one of these issues:

http://support.microsoft.com/?kbid=834290
http://support.microsoft.com/?kbid=300194

Simon

locate static data in xml file vs db table

How do people see the security of locating static data (such as config
settings) in an XML file (a copy is located on each web-server, or a single
copy is located on a specific server) , versus locating this data inside the
db ?
An XML file that contains all app config settings is much easier to maintain
and track from the standpoint of source-code-control , and it is much easier
to apply changes to settings in production environments (just swap the XML
file and restart the web-servers).
The replication and other redudancy advantages accorded data inside SS are
not really necessary for static, load-on-app-start, config settings.
If not possible for data in an XML file to achieve the security of a data in
a db , one option would be to locate the XML file in a SS05 col of XML
datatype.
Anyone have real-world experience making this sort of trade-off decision ,
or any insights ?
Thanks.When did go through a similar exercise for our application. One of the
things that we considered was to look at configuration as something that is
"configurable". This means that the location of the configuration file
should be abstracted from your code so that you are free to move it around.
This is where the Configuration Application Block from Microsoft comes into
play:
http://msdn.microsoft.com/library/d...i
g.asp.
This block abstracts the ability to read and write from the configuration
file and from a deployment perspective, the configuration can be in XML or
in SQL Server. Maybe future editions of this block might put it in an SQL2K5
XML column, but the block would abstract it from you and you would always
have a consistent way of programming.
--
HTH,
SriSamp
Email: srisamp@.gmail.com
Blog: http://blogs.sqlxml.org/srinivassampath
URL: http://www32.brinkster.com/srisamp
"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:OnfTXLs0FHA.3812@.TK2MSFTNGP09.phx.gbl...
> How do people see the security of locating static data (such as config
> settings) in an XML file (a copy is located on each web-server, or a
> single copy is located on a specific server) , versus locating this data
> inside the db ?
> An XML file that contains all app config settings is much easier to
> maintain and track from the standpoint of source-code-control , and it is
> much easier to apply changes to settings in production environments (just
> swap the XML file and restart the web-servers).
> The replication and other redudancy advantages accorded data inside SS are
> not really necessary for static, load-on-app-start, config settings.
> If not possible for data in an XML file to achieve the security of a data
> in a db , one option would be to locate the XML file in a SS05 col of XML
> datatype.
> Anyone have real-world experience making this sort of trade-off decision ,
> or any insights ?
> Thanks.
>|||Problem I see with Configuration Application Block is that it assumes only
the simplest data structure is needed for config settings: discrete named
values.
To get around this, you can write your own transformers. But to leverage the
advantages that CAB offers, you should write them to work against multiple
data-providers/data-stores). This is quite a bit of work -- might be better
to spend that time writing an app-specific solution from scratch.
Also, I think it's not a good idea to avoid upfront analysis of the
app-specific trade-offs between different data-store solutions. CAB seems to
be saying "avoid the tough design decision" ... and, in the process,
sacrifice the advantages offered by a custom design.
But maybe I'm mistaken ...
"SriSamp" <ssampath@.sct.co.in> wrote in message
news:O4Ervev0FHA.460@.TK2MSFTNGP15.phx.gbl...
> When did go through a similar exercise for our application. One of the
> things that we considered was to look at configuration as something that
> is "configurable". This means that the location of the configuration file
> should be abstracted from your code so that you are free to move it
> around. This is where the Configuration Application Block from Microsoft
> comes into play:
> http://msdn.microsoft.com/library/d...br />
fig.asp.
> This block abstracts the ability to read and write from the configuration
> file and from a deployment perspective, the configuration can be in XML or
> in SQL Server. Maybe future editions of this block might put it in an
> SQL2K5 XML column, but the block would abstract it from you and you would
> always have a consistent way of programming.
> --
> HTH,
> SriSamp
> Email: srisamp@.gmail.com
> Blog: http://blogs.sqlxml.org/srinivassampath
> URL: http://www32.brinkster.com/srisamp
> "John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
> news:OnfTXLs0FHA.3812@.TK2MSFTNGP09.phx.gbl...
>|||You're right in saying that CAB out of the box is for simple named values.
We have not tried writing our own formatters, thus, I cannot comment on the
complexity of the same. We did do an anslysis of an application specific
version, but found that the time it takes to provide a UI for the
configuration (like what CAB has) and the simple model of exposing the
configuration as properties of a class for our application looked like a
re-invention of the wheel.
Did you try posting your question to the GOTDOTNET site for Enterprise
Library? It is usually manned by the architects of the library and you may
get more specific answers.
--
HTH,
SriSamp
Email: srisamp@.gmail.com
Blog: http://blogs.sqlxml.org/srinivassampath
URL: http://www32.brinkster.com/srisamp
"John Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:O71N%23oz0FHA.2132@.TK2MSFTNGP15.phx.gbl...
> Problem I see with Configuration Application Block is that it assumes only
> the simplest data structure is needed for config settings: discrete named
> values.
> To get around this, you can write your own transformers. But to leverage
> the advantages that CAB offers, you should write them to work against
> multiple data-providers/data-stores). This is quite a bit of work --
> might be better to spend that time writing an app-specific solution from
> scratch.
> Also, I think it's not a good idea to avoid upfront analysis of the
> app-specific trade-offs between different data-store solutions. CAB seems
> to be saying "avoid the tough design decision" ... and, in the process,
> sacrifice the advantages offered by a custom design.
> But maybe I'm mistaken ...
> "SriSamp" <ssampath@.sct.co.in> wrote in message
> news:O4Ervev0FHA.460@.TK2MSFTNGP15.phx.gbl...
>