Ayuda con SQL Server - Sybase

16/01/2006 - 22:09 por Leonard | Informe spam
Buenas Tardes .

Tengo un pequeño problemilla, en mi antiguo trabajo se diseño un pequeño
monitor de procesos de la base de datos, pero ahi se trabajaba con Sybase
12.5 , ahora quiero implementar dicho monitoreo pero para un servidor de
SqlServer pero cuando lo compilo tengo errores en las tablas del sistema, si
alguien pudiera ayudar en la equivalenciade dichos campos del SYBASE en el
SQL Server.
el store es el sgte

drop proc sp_genwho
go

create proc sp_genwho ( @parametro int )
as

if @parametro = 0
BEGIN
select
ID_Ps = convert(varchar(3),master..sysprocesses.spid),
No_Pr = convert(varchar(3),master..sysprocesses.enginenum),
Comando = convert(varchar(30),master..sysprocesses.cmd),
Cpu = master..sysprocesses.cpu,
IO = master..sysprocesses.physical_io,
Objeto = object_name(master..sysprocesses.id),
Linea = master..sysprocesses.linenum,
Estado = master..sysprocesses.status,
Bqd = convert(varchar(5),master..sysprocesses.blocked),
Tim_Bqd = master..sysprocesses.time_blocked ,
Transac = convert(varchar(30),master..sysprocesses.tran_name),
Login = convert(varchar(12),suser_name(master..sysprocesses.suid)),
Nom_PC = convert(varchar(12),master..sysprocesses.hostname),
Usr_NT = convert(varchar(12),master..sysprocesses.clientname),
SisGen = convert(varchar(12),master..sysprocesses.clienthostname),
PgmSisGen = CASE WHEN master..sysprocesses.clientapplname = "" THEN '(SYB) '
+ convert(varchar(30),master..sysprocesses.program_name) ELSE '(PGM) ' +
convert(varchar(30),master..sysprocesses.clientapplname) END,
BaseDato = convert(varchar(12),db_name(master..sysprocesses.dbid)),
IdObjeto=master..sysprocesses.id
from master..sysprocesses
order by master..sysprocesses.fid, master..sysprocesses.spid
END

if @parametro = 1
BEGIN
select
ID_Ps = convert(varchar(3),master..sysprocesses.spid),
No_Pr = convert(varchar(3),master..sysprocesses.enginenum),
Comando = convert(varchar(30),master..sysprocesses.cmd),
Cpu = master..sysprocesses.cpu,
IO = master..sysprocesses.physical_io,
Objeto = object_name(master..sysprocesses.id),
Linea = master..sysprocesses.linenum,
Estado = master..sysprocesses.status,
Bqd = convert(varchar(5),master..sysprocesses.blocked),
Tim_Bqd = master..sysprocesses.time_blocked ,
Transac = convert(varchar(30),master..sysprocesses.tran_name),
Login = convert(varchar(12),suser_name(master..sysprocesses.suid)),
Nom_PC = convert(varchar(12),master..sysprocesses.hostname),
Usr_NT = convert(varchar(12),master..sysprocesses.clientname),
SisGen = convert(varchar(12),master..sysprocesses.clienthostname),
PgmSisGen = CASE WHEN master..sysprocesses.clientapplname = "" THEN '(SYB) '
+ convert(varchar(30),master..sysprocesses.program_name) ELSE '(PGM) ' +
convert(varchar(30),master..sysprocesses.clientapplname) END,
BaseDato = convert(varchar(12),db_name(master..sysprocesses.dbid)),
IdObjeto=master..sysprocesses.id
from master..sysprocesses
where cmd <> "AWAITING COMMAND"
order by master..sysprocesses.fid, master..sysprocesses.spid
END

if @parametro = 2
BEGIN
select
ID_Ps = convert(varchar(3),master..sysprocesses.spid),
No_Pr = convert(varchar(3),master..sysprocesses.enginenum),
Comando = convert(varchar(30),master..sysprocesses.cmd),
Cpu = master..sysprocesses.cpu,
IO = master..sysprocesses.physical_io,
Objeto = object_name(master..sysprocesses.id),
Linea = master..sysprocesses.linenum,
Estado = master..sysprocesses.status,
Bqd = convert(varchar(5),master..sysprocesses.blocked),
Tim_Bqd = master..sysprocesses.time_blocked ,
Transac = convert(varchar(30),master..sysprocesses.tran_name),
Login = convert(varchar(12),suser_name(master..sysprocesses.suid)),
Nom_PC = convert(varchar(12),master..sysprocesses.hostname),
Usr_NT = convert(varchar(12),master..sysprocesses.clientname),
SisGen = convert(varchar(12),master..sysprocesses.clienthostname),
PgmSisGen = CASE WHEN master..sysprocesses.clientapplname = "" THEN '(SYB) '
+ convert(varchar(30),master..sysprocesses.program_name) ELSE '(PGM) ' +
convert(varchar(30),master..sysprocesses.clientapplname) END,
BaseDato = convert(varchar(12),db_name(master..sysprocesses.dbid)),
IdObjeto=master..sysprocesses.id
from master..sysprocesses
where cmd <> "AWAITING COMMAND" and master..sysprocesses.suid > 0
order by master..sysprocesses.fid, master..sysprocesses.spid
END

Gracias de antemano a cualquier ayuda que reciba.



Manuel Aparcana Reyes
Analisista Programador
(511) 9503-4295

Preguntas similare

Leer las respuestas

#1 Isaias
17/01/2006 - 01:42 | Informe spam
Manuel

En SQL Server, existe PROFILER (Trazas) que hacen exactamente lo que esta
haciendo tu store.

Saludos
IIslas


"Leonard" escribió:

Buenas Tardes .

Tengo un pequeño problemilla, en mi antiguo trabajo se diseño un pequeño
monitor de procesos de la base de datos, pero ahi se trabajaba con Sybase
12.5 , ahora quiero implementar dicho monitoreo pero para un servidor de
SqlServer pero cuando lo compilo tengo errores en las tablas del sistema, si
alguien pudiera ayudar en la equivalenciade dichos campos del SYBASE en el
SQL Server.
el store es el sgte

drop proc sp_genwho
go

create proc sp_genwho ( @parametro int )
as

if @parametro = 0
BEGIN
select
ID_Ps = convert(varchar(3),master..sysprocesses.spid),
No_Pr = convert(varchar(3),master..sysprocesses.enginenum),
Comando = convert(varchar(30),master..sysprocesses.cmd),
Cpu = master..sysprocesses.cpu,
IO = master..sysprocesses.physical_io,
Objeto = object_name(master..sysprocesses.id),
Linea = master..sysprocesses.linenum,
Estado = master..sysprocesses.status,
Bqd = convert(varchar(5),master..sysprocesses.blocked),
Tim_Bqd = master..sysprocesses.time_blocked ,
Transac = convert(varchar(30),master..sysprocesses.tran_name),
Login = convert(varchar(12),suser_name(master..sysprocesses.suid)),
Nom_PC = convert(varchar(12),master..sysprocesses.hostname),
Usr_NT = convert(varchar(12),master..sysprocesses.clientname),
SisGen = convert(varchar(12),master..sysprocesses.clienthostname),
PgmSisGen = CASE WHEN master..sysprocesses.clientapplname = "" THEN '(SYB) '
+ convert(varchar(30),master..sysprocesses.program_name) ELSE '(PGM) ' +
convert(varchar(30),master..sysprocesses.clientapplname) END,
BaseDato = convert(varchar(12),db_name(master..sysprocesses.dbid)),
IdObjeto=master..sysprocesses.id
from master..sysprocesses
order by master..sysprocesses.fid, master..sysprocesses.spid
END

if @parametro = 1
BEGIN
select
ID_Ps = convert(varchar(3),master..sysprocesses.spid),
No_Pr = convert(varchar(3),master..sysprocesses.enginenum),
Comando = convert(varchar(30),master..sysprocesses.cmd),
Cpu = master..sysprocesses.cpu,
IO = master..sysprocesses.physical_io,
Objeto = object_name(master..sysprocesses.id),
Linea = master..sysprocesses.linenum,
Estado = master..sysprocesses.status,
Bqd = convert(varchar(5),master..sysprocesses.blocked),
Tim_Bqd = master..sysprocesses.time_blocked ,
Transac = convert(varchar(30),master..sysprocesses.tran_name),
Login = convert(varchar(12),suser_name(master..sysprocesses.suid)),
Nom_PC = convert(varchar(12),master..sysprocesses.hostname),
Usr_NT = convert(varchar(12),master..sysprocesses.clientname),
SisGen = convert(varchar(12),master..sysprocesses.clienthostname),
PgmSisGen = CASE WHEN master..sysprocesses.clientapplname = "" THEN '(SYB) '
+ convert(varchar(30),master..sysprocesses.program_name) ELSE '(PGM) ' +
convert(varchar(30),master..sysprocesses.clientapplname) END,
BaseDato = convert(varchar(12),db_name(master..sysprocesses.dbid)),
IdObjeto=master..sysprocesses.id
from master..sysprocesses
where cmd <> "AWAITING COMMAND"
order by master..sysprocesses.fid, master..sysprocesses.spid
END

if @parametro = 2
BEGIN
select
ID_Ps = convert(varchar(3),master..sysprocesses.spid),
No_Pr = convert(varchar(3),master..sysprocesses.enginenum),
Comando = convert(varchar(30),master..sysprocesses.cmd),
Cpu = master..sysprocesses.cpu,
IO = master..sysprocesses.physical_io,
Objeto = object_name(master..sysprocesses.id),
Linea = master..sysprocesses.linenum,
Estado = master..sysprocesses.status,
Bqd = convert(varchar(5),master..sysprocesses.blocked),
Tim_Bqd = master..sysprocesses.time_blocked ,
Transac = convert(varchar(30),master..sysprocesses.tran_name),
Login = convert(varchar(12),suser_name(master..sysprocesses.suid)),
Nom_PC = convert(varchar(12),master..sysprocesses.hostname),
Usr_NT = convert(varchar(12),master..sysprocesses.clientname),
SisGen = convert(varchar(12),master..sysprocesses.clienthostname),
PgmSisGen = CASE WHEN master..sysprocesses.clientapplname = "" THEN '(SYB) '
+ convert(varchar(30),master..sysprocesses.program_name) ELSE '(PGM) ' +
convert(varchar(30),master..sysprocesses.clientapplname) END,
BaseDato = convert(varchar(12),db_name(master..sysprocesses.dbid)),
IdObjeto=master..sysprocesses.id
from master..sysprocesses
where cmd <> "AWAITING COMMAND" and master..sysprocesses.suid > 0
order by master..sysprocesses.fid, master..sysprocesses.spid
END

Gracias de antemano a cualquier ayuda que reciba.



Manuel Aparcana Reyes
Analisista Programador
(511) 9503-4295



Respuesta Responder a este mensaje
#2 Leonard
17/01/2006 - 14:10 | Informe spam
se puede invocar los profiler desde VB para pder mostrarlos en un
programa???





Manuel Aparcana Reyes
Analisista Programador
(511) 9503-4295

"Isaias" escribió en el mensaje
news:
Manuel

En SQL Server, existe PROFILER (Trazas) que hacen exactamente lo que esta
haciendo tu store.

Saludos
IIslas


"Leonard" escribió:

> Buenas Tardes .
>
> Tengo un pequeño problemilla, en mi antiguo trabajo se diseño un pequeño
> monitor de procesos de la base de datos, pero ahi se trabajaba con


Sybase
> 12.5 , ahora quiero implementar dicho monitoreo pero para un servidor de
> SqlServer pero cuando lo compilo tengo errores en las tablas del


sistema, si
> alguien pudiera ayudar en la equivalenciade dichos campos del SYBASE en


el
> SQL Server.
> el store es el sgte
>
> drop proc sp_genwho
> go
>
> create proc sp_genwho ( @parametro int )
> as
>
> if @parametro = 0
> BEGIN
> select
> ID_Ps = convert(varchar(3),master..sysprocesses.spid),
> No_Pr = convert(varchar(3),master..sysprocesses.enginenum),
> Comando = convert(varchar(30),master..sysprocesses.cmd),
> Cpu = master..sysprocesses.cpu,
> IO = master..sysprocesses.physical_io,
> Objeto = object_name(master..sysprocesses.id),
> Linea = master..sysprocesses.linenum,
> Estado = master..sysprocesses.status,
> Bqd = convert(varchar(5),master..sysprocesses.blocked),
> Tim_Bqd = master..sysprocesses.time_blocked ,
> Transac = convert(varchar(30),master..sysprocesses.tran_name),
> Login = convert(varchar(12),suser_name(master..sysprocesses.suid)),
> Nom_PC = convert(varchar(12),master..sysprocesses.hostname),
> Usr_NT = convert(varchar(12),master..sysprocesses.clientname),
> SisGen = convert(varchar(12),master..sysprocesses.clienthostname),
> PgmSisGen = CASE WHEN master..sysprocesses.clientapplname = "" THEN


'(SYB) '
> + convert(varchar(30),master..sysprocesses.program_name) ELSE '(PGM) ' +
> convert(varchar(30),master..sysprocesses.clientapplname) END,
> BaseDato = convert(varchar(12),db_name(master..sysprocesses.dbid)),
> IdObjeto=master..sysprocesses.id
> from master..sysprocesses
> order by master..sysprocesses.fid, master..sysprocesses.spid
> END
>
> if @parametro = 1
> BEGIN
> select
> ID_Ps = convert(varchar(3),master..sysprocesses.spid),
> No_Pr = convert(varchar(3),master..sysprocesses.enginenum),
> Comando = convert(varchar(30),master..sysprocesses.cmd),
> Cpu = master..sysprocesses.cpu,
> IO = master..sysprocesses.physical_io,
> Objeto = object_name(master..sysprocesses.id),
> Linea = master..sysprocesses.linenum,
> Estado = master..sysprocesses.status,
> Bqd = convert(varchar(5),master..sysprocesses.blocked),
> Tim_Bqd = master..sysprocesses.time_blocked ,
> Transac = convert(varchar(30),master..sysprocesses.tran_name),
> Login = convert(varchar(12),suser_name(master..sysprocesses.suid)),
> Nom_PC = convert(varchar(12),master..sysprocesses.hostname),
> Usr_NT = convert(varchar(12),master..sysprocesses.clientname),
> SisGen = convert(varchar(12),master..sysprocesses.clienthostname),
> PgmSisGen = CASE WHEN master..sysprocesses.clientapplname = "" THEN


'(SYB) '
> + convert(varchar(30),master..sysprocesses.program_name) ELSE '(PGM) ' +
> convert(varchar(30),master..sysprocesses.clientapplname) END,
> BaseDato = convert(varchar(12),db_name(master..sysprocesses.dbid)),
> IdObjeto=master..sysprocesses.id
> from master..sysprocesses
> where cmd <> "AWAITING COMMAND"
> order by master..sysprocesses.fid, master..sysprocesses.spid
> END
>
> if @parametro = 2
> BEGIN
> select
> ID_Ps = convert(varchar(3),master..sysprocesses.spid),
> No_Pr = convert(varchar(3),master..sysprocesses.enginenum),
> Comando = convert(varchar(30),master..sysprocesses.cmd),
> Cpu = master..sysprocesses.cpu,
> IO = master..sysprocesses.physical_io,
> Objeto = object_name(master..sysprocesses.id),
> Linea = master..sysprocesses.linenum,
> Estado = master..sysprocesses.status,
> Bqd = convert(varchar(5),master..sysprocesses.blocked),
> Tim_Bqd = master..sysprocesses.time_blocked ,
> Transac = convert(varchar(30),master..sysprocesses.tran_name),
> Login = convert(varchar(12),suser_name(master..sysprocesses.suid)),
> Nom_PC = convert(varchar(12),master..sysprocesses.hostname),
> Usr_NT = convert(varchar(12),master..sysprocesses.clientname),
> SisGen = convert(varchar(12),master..sysprocesses.clienthostname),
> PgmSisGen = CASE WHEN master..sysprocesses.clientapplname = "" THEN


'(SYB) '
> + convert(varchar(30),master..sysprocesses.program_name) ELSE '(PGM) ' +
> convert(varchar(30),master..sysprocesses.clientapplname) END,
> BaseDato = convert(varchar(12),db_name(master..sysprocesses.dbid)),
> IdObjeto=master..sysprocesses.id
> from master..sysprocesses
> where cmd <> "AWAITING COMMAND" and master..sysprocesses.suid > 0
> order by master..sysprocesses.fid, master..sysprocesses.spid
> END
>
> Gracias de antemano a cualquier ayuda que reciba.
>
>
>
> Manuel Aparcana Reyes
> Analisista Programador
> (511) 9503-4295
>
>
>
email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida