首页 > 学技术 > 技术网文 > Sybase > 正文

[精华] 如何知道自己所使用的license信息?


来源 chinaunix.net 酷勤网整理

查看了公司数据库服务器里sybase的SYSAM 2.0目录里的license文件夹,发现里面一堆license。我想知道sybase目前正在使用哪个license文件,通过什么方式可以知道该license的使用截止时间?



 hobbylu 回复于:2007-01-19 15:44:49

有一个license_enabled的函数,可以查询你的license信息
还有你可以从sysam中的log日志中,查看license信息


 echoaix 回复于:2007-01-23 09:07:48

(转的)一个很好的存储过程 sp_license 
set nocount on
go
set flushmessage on
go
use master
go
if charindex("sa_role", show_role()) = 0
or charindex("sso_role", show_role()) = 0
begin
   print ""
   print ""
   print "***************************************"
   print "***************************************"
   print " You need 'sa_role' and 'sso_role' "
   print " to run this script."
   print " Please retry with these roles enabled."
   print " Aborting..."
   print "***************************************"
   print "***************************************"
   print " "
   print " "
   print " "
   print ""
   set background on  -- terminate this script now
end
go

--
-- check we're at version 12.0 or later
--
if isnull(object_id("master.dbo.sysqueryplans"),99) >= 99
begin
   print ""
   print ""
   print "****************************************"
   print "****************************************"
   print " This script requires ASE 12.0 or later."
   print " Aborting..."
   print "****************************************"
   print "****************************************"
   print " "
   print " "
   print ""
   set background on  -- terminate this script now
end
go

------------------------------------------------------------------------------

use sybsystemprocs
go

print "Creating procedure 'sp_license'..."

if object_id("sp_license") <> NULL
begin
   drop proc sp_license
end
go

create proc sp_license
/* Copyright (c) 2004 Rob Verschoor/Sypron B.V. */
   @p_option varchar(20)=NULL
as
begin
    declare @cfgopt int, @cfgval int, @cfgval_fmt varchar(20), @cfgname varchar(40)
declare @v varchar(80), @c varchar(80)
declare @x1 int, @x2 int, @x3 int
    set nocount on

    select @p_option = ltrim(rtrim(upper(@p_option)))

select @x1 = charindex("/", substring(@@version,28,50))
select @x2 = charindex("/", substring(@@version,28+@x1,50))
select @x3 = charindex("/", substring(@@version,28+@x1+@x2,50))

select @v = "(" + substring(@@version,28,@x1+@x2+@x3) + ")"
select @c = " Current ASE server: " + @@servername + " " + @v
print @c

   create table #licensekeys (optname varchar(15), version varchar(12), description varchar(28), cfgopt int)
   insert #licensekeys values ('ASE_SERVER', "12.0+", "Enterprise Edition", 0)
   insert #licensekeys values ('ASE_SBE', "12.5.0.2+", "ASE Small Business Edition", 0)
   insert #licensekeys values ('ASE_DEV', "12.5.0.1+", "ASE Developer's Edition", 0)
   insert #licensekeys values ('ASE_HA', "12.0+", "High Availability", 378)
   insert #licensekeys values ('ASE_JAVA', "12.0+", "Java-in-ASE", 339)
   insert #licensekeys values ('ASE_ASM', "12.0+", "Advanced Security Mechanisms", 400)
   insert #licensekeys values ('ASE_DTM', "12.0+", "Distributed Transaction Mgt.", 381)
   insert #licensekeys values ('ASE_EJB', "12.5+", "Enterprise Java Beans", 392)
   insert #licensekeys values ('ASE_XFS', "12.5+", "External File Systems", 285)
   insert #licensekeys values ('ASE_EFTS', "12.5+", "Full text search", 287)
   insert #licensekeys values ('ASE_DIR', "pre-12.5.0.2", "LDAP", -1)
   insert #licensekeys values ('ASE_DIRS', "12.5.0.2+", "LDAP", 418)
   insert #licensekeys values ('ASE_XRAY', "12.5.0.3+", "DBXRay", -1)
   insert #licensekeys values ('ASE_XML', "12.5.1+", "Native XML in ASE", 419)
   insert #licensekeys values ('ASE_WEBSERVICES', "12.5.1+", "Webservices in ASE", 420)
   insert #licensekeys values ('ASE_MESSAGING', "12.5.2+", "Real-Time Database Services", 429)

   -- apply filter
   print ""
   select 
       l.optname "License Option", 
       l.description "Description",
       case license_enabled(l.optname) 
 when 1 then "Enabled" 
 when 0 then "Disabled" 
 else version + " only"
 end "Option Status",
 --right(space(14)+
 case c.value when 0 then 'Disabled (0)' when 1 then 'Enabled (1)' else '' end
 --,14) 
 "Cfg.Value(run)"
from master..syscurconfigs c, #licensekeys l
   where optname = isnull(@p_option, optname)
and c.config =* l.cfgopt

   if @@rowcount = 0
begin
   print " "
   print " No such license option: %1!", @p_option
return(0)
end

   if @p_option <> NULL
   begin
      select @cfgopt = cfgopt
      from #licensekeys
      where optname = @p_option

      if @cfgopt = 0
      begin
         print ""

 if @p_option = 'ASE_SERVER'
 begin
   print " In 12.5+, the ASE_SERVER option is needed to run the ASE Enterprise Edition"
   print " (no ASE-implied limits on the number of users or engines)."
   print " In 12.0, the ASE_SERVER option is needed to enable other license options."
 end

 if license_enabled(@p_option) = NULL 
 return(0)

 if @p_option = 'ASE_DEV'
 begin
   print " The free ASE Developer's edition automatically enables most other license "
   print " options, but limits the number of user connections to 25 (in 12.5.1, to 5)"
   print " and the number of engines to 1."
 end

 if @p_option = 'ASE_SBE'
 begin
   print " The ASE Small Business Edition limits the number of user connections to 256"
   print " and the number of engines to 4."
 end

         print ""
         print " The '%1!' option takes effect automatically during ASE startup.",  @p_option

         return(0)
      end

      if @cfgopt = -1
      begin
       if @p_option = 'ASE_DEV'
   begin
      print " The ASE "
   end
           return(0)
      end

      select @cfgname = name
      from master..sysconfigures 
      where config = @cfgopt

      select @cfgval = value
      from master..syscurconfigs 
      where config = @cfgopt

  select @cfgval_fmt = case @cfgval when 0 then '0 (=Disabled)' when 1 then '1 (=Enabled)' else '' end

      if license_enabled(@p_option) = NULL 
     return(0)

      -- note: we cannot call sp_configure here to display parameter info, since sp_configure 
      -- does not allow being called from another procedure
      print ""
      print " To enable the '%1!' option, the ASE configuration parameter", @p_option
      print " '%1!' must also be enabled. The current run value is %2!", @cfgname, @cfgval_fmt
   end
   return(0)
end
go

grant exec on sp_license to public
go

-- 
-- end of file
--

[ 本帖最后由 echoaix 于 2007-1-23 09:08 编辑 ]


 hobbylu 回复于:2007-01-23 14:37:57

好东西,顶




原文链接:http://bbs.chinaunix.net/viewthread.php?tid=888530
转载请注明作者名及原文出处



收藏本页到: