JohnPhan 发表于 2008-6-24 09:54:35

转帖 一个工具 sp_license

Use Examples
1> sp_license
2> go
Current ASE server: TEST1252 (12.5.2/EBF 11948 ESD#1/P/)

License OptionDescription                  Option Status   Cfg.Value(run)
--------------- ---------------------------- ----------------- --------------
ASE_SERVER      Enterprise Edition         Disabled
ASE_SBE         ASE Small Business Edition   Disabled
ASE_DEV         ASE Developer's Edition      Enabled
ASE_HA          High Availability            Enabled         Disabled (0)
ASE_JAVA      Java-in-ASE                  Enabled         Enabled (1)
ASE_ASM         Advanced Security Mechanisms Enabled         Disabled (0)
ASE_DTM         Distributed Transaction Mgt. Enabled         Disabled (0)
ASE_EJB         Enterprise Java Beans      Enabled         Disabled (0)
ASE_XFS         External File Systems      Enabled         Disabled (0)
ASE_EFTS      Full text search             Disabled          Disabled (0)
ASE_DIR         LDAP                         pre-12.5.0.2 only
ASE_DIRS      LDAP                         Enabled         Enabled (1)
ASE_XRAY      DBXRay                     Disabled
ASE_XML         Native XML in ASE            Enabled         Disabled (0)
ASE_WEBSERVICES Webservices in ASE         Enabled         Disabled (0)
ASE_MESSAGING   Real-Time Database ServicesEnabled         Enabled (1)

(return status = 0)



1> sp_license ASE_XML
2> go
Current ASE server: TEST1252 (12.5.2/EBF 11948 ESD#1/P/)

License OptionDescription                  Option Status   Cfg.Value(run)
--------------- ---------------------------- ----------------- --------------
ASE_XML         Native XML in ASE            Enabled         Disabled (0)

To enable the 'ASE_XML' option, the ASE configuration parameter
'enable xml' must also be enabled. The current run value is 0 (=Disabled)

(return status = 0)

JohnPhan 发表于 2008-6-24 09:56:50

/*
* SP_LICENSE.SQL - displays ASE license options information
*
* Description
* ===========
* This file creates 'sp_license', a stored procedure displaying information
* about license options in Sybase ASE 12.0+.
* This file can be downloaded from www.sypron.nl/license.html .
*   
*   
* Usage
* =====
*   sp_license [ license_option ]
*
*   Without parameters, displays the status of all known license options
*   in the current ASE server.
*   With a license option as parameter (e.g. ASE_XML), displays only
*   that option, as well as the associated configuration parameter (if any).
*   
*   
* Notes
* =====
*
* - None.
*
*
* Requirements
* ============
* This procedure requires ASE version 12.0 or later.
*
*
* Installation
* ============
* Execute this script using "isql", using a login having "sa_role".
* The stored procedure will be created in the sybsystemprocs database.
*
*
* Revision History
* ================
* Version 1.031-Aug-2004Version 1.0
*
*
* Copyright Note & Disclaimer :
* =============================
* This software is provided "as is"; there is no warranty of any kind.
* While this software is believed to work accurately, it may not work
* correctly and/or reliably in a production environment. In no event shall
* Rob Verschoor and/or Sypron B.V. be liable for any damages resulting
* from the use of this software.
* You are allowed to use this software free of charge for your own
* professional, non-commercial purposes.
* You are not allowed to sell or bundle this software or use it for any
* other commercial purpose without prior written permission from
* Rob Verschoor/Sypron B.V.
* You may (re)distribute only unaltered copies of this software, which
* must include this copyright note, as well as the copyright note in
* the header of each stored procedure.
*
* Note: All trademarks are acknowledged.
*
* Please send any comments, bugs, suggestions etc. to the below email
* address.
*
* (c) 2004 Copyright Rob Verschoor/Sypron B.V.
*                  P.O.Box 10695
*                  2501 HR Den Haag
*                  The Netherlands
*
*                  Email: rob@sypron.nl
*                  WWW: http://www.sypron.nl/
*----------------------------------------------------------------------------
*/

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
--
页: [1]
查看完整版本: 转帖 一个工具 sp_license

免责声明:
本站所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:Admin@SybaseBbs.com