一、首先说一下SYBASE从12.x升级到15.x的问题。
原因为近期客户有从SYBASE 12.X升级到15.7的需求,所以为此专门做了测试。
1、SYBASE 12.5.4以下的版本需要先升级到SYBASE 12.5.4,SYBASE 12.5.4(包含)以上版本可以直接升级到SYBASE 15.7 SP122 (最新补丁)。
2、可以从 32 位版本升级到 64 位版本,但不能从 64 位升级到或移动到 32 位:
Adaptive Server 12.5.x – 
要从 Adaptive Server 12.5.4 或更低版本升级,请从数据库所处模式执行升级序列。
3、不能从以下版本升级到此版本的 Adaptive Server:
Adaptive Server 版本 12.5.3a Adaptive Server 12.0.x 版或更低版本– Sybase 建议您先升级到 12.5.4 版,然后再
升级到 15.7 版


分享一下
SQL监控语句:




1、CPU时间或逻辑I/O消耗量最大的进程
select SPID,Login = suser_name(ServerUserID),CPUTime,LogicalReads from master..monProcessActivity
order by CPUTime desc




2、物理I/O或逻辑I/O消耗量最大的进程
select SPID,Login = suser_name(ServerUserID),PhysicalReads,LogicalReads from master..monProcessActivity
order by PhysicalReads desc




3、瞬时监控数据
select s.SPID, s.CpuTime, s.LineNumber, t.SQLText
from master..monProcessStatement s, monProcessSQLText t
where s.SPID=t.SPID
and s.CpuTime = (select max(CpuTime) from master..monProcessStatement)






4、统计中心数据库慢速应用
select SPID,DBID,ProcedureID,CpuTime,WaitTime,MemUsageKB,PhysicalReads,NetworkPacketSize,DBName,StartTime from  master..monProcessStatement order by StartTime asc











5、查看所有可使用监控表
select TableName from master..monTables








6、若要列出特定监控表中的列
select ColumnName, TypeName, Length, Description
from master..monTableColumns
where TableName=”monProcessSQLText”




7、查看最消耗CPU并列出查询SQL
select s.SPID, s.CpuTime, t.LineNumber, t.SQLText
from master..monProcessStatement s, master..monProcessSQLText t
where s.SPID = t.SPID
order by s.CpuTime DESC








8、ASE生存周期内的过程高速缓存的命中率
select "Procedure Cache Hit Ratio" = (Requests-Loads)*100/Requests
from master..monProcedureCache








9、查询10分钟内高速缓存的命中率
select * into #moncache_prev
from master..monDataCache
waitfor delay "00:10:00"
select * into #moncache_cur
from master..monDataCache
select p.CacheName,
"Hit Ratio"=((c.LogicalReads-p.LogicalReads) - (c.PhysicalReads -
p.PhysicalReads))*100 / (c.LogicalReads - p.LogicalReads)
from #moncache_prev p, #moncache_cur c
where p.CacheName = c.CacheName




10、输出已执行的SQL以及当前执行存储过程的所有进程的反馈




create procedure sp_backtrace @spid int as
begin
select SQLText
from master..monProcessSQLText
where SPID=@spid
print "Stacktrace:"
select ContextID, DBName, OwnerName, ObjectName
from master..monProcessProcedures
where SPID=@spid
end




11、若要确定用于 dbid 为 5、对象 ID 为 1424005073 的数据库中的表的
任何索引
select DBID, ObjectID, LastUsedDate, UsedCount
from master..monOpenObjectActivity
where dbid=5 and ObjectID=1424005073 and IndexID > 1








12、若要确定您的应用程序是否未在数据库中使用任何索引,请执行:
select DB = convert(char(20), db_name()),
TableName = convert(char(20), object_name(i.id, db_id())),
IndexName = convert(char(20),i.name),
IndID = i.indid
from master..monOpenObjectActivity a,
sysindexes i
where a.ObjectID =* i.id
and a.IndexID =* i.indid
and (a.UsedCount = 0 or a.UsedCount is NULL)
and i.indid > 0
and i.id > 99 -- No system tables
order by 2, 4 asc



09-01 03:54