home *** CD-ROM | disk | FTP | other *** search
/ ftp.pasteur.org/FAQ/ / ftp-pasteur-org-FAQ.zip / FAQ / databases / sybase-faq / part10 < prev    next >
Encoding:
Internet Message Format  |  2004-04-21  |  12.0 KB

  1. Path: senator-bedfellow.mit.edu!dreaderd!not-for-mail
  2. Message-ID: <databases/sybase-faq/part10_1082468590@rtfm.mit.edu>
  3. Supersedes: <databases/sybase-faq/part10_1074677126@rtfm.mit.edu>
  4. Expires: 2 Aug 2004 13:43:10 GMT
  5. References: <databases/sybase-faq/part1_1082468590@rtfm.mit.edu>
  6. X-Last-Updated: 2003/03/02
  7. From: dowen@midsomer.org (David Owen)
  8. Newsgroups: comp.databases.sybase,comp.answers,news.answers
  9. Subject: Sybase FAQ: 10/19 - ASE Admin (7 of 7)
  10. Reply-To: dowen@midsomer.org (David Owen)
  11. Followup-To: comp.databases.sybase
  12. Distribution: world
  13. Organization: Midsomer Consultants Inc.
  14. Approved: news-answers-request@MIT.EDU
  15. Keywords: FAQ, DATABASES, SYBASE, ASA, ASE, REP
  16. Originator: faqserv@penguin-lust.MIT.EDU
  17. Date: 20 Apr 2004 13:45:07 GMT
  18. Lines: 291
  19. NNTP-Posting-Host: penguin-lust.mit.edu
  20. X-Trace: 1082468707 senator-bedfellow.mit.edu 568 18.181.0.29
  21. Xref: senator-bedfellow.mit.edu comp.databases.sybase:106208 comp.answers:56954 news.answers:270294
  22.  
  23. Archive-name: databases/sybase-faq/part10
  24. URL: http://www.isug.com/Sybase_FAQ
  25. Version: 1.7
  26. Maintainer: David Owen
  27. Last-modified: 2003/03/02
  28. Posting-Frequency: posted every 3rd month
  29.    A how-to-find-the-FAQ article is posted on the intervening months.
  30.  
  31. 1.5.9: You and showplan output
  32.  
  33. -------------------------------------------------------------------------------
  34.  
  35. As recently pointed out in the Sybase-L list, the showplan information that was
  36. here is terribly out of date. It was written back when the output from ASE and
  37. MS SQL Server were identical. (To see just how differenet they have become,
  38. have a look at the O'Reilly book "Transact-SQL Programming". It does a line for
  39. line comparison.) The write up in the Performance and Tuning Guide is
  40. excellent, and this section was doing nothing but causing problems.
  41.  
  42. If you do have a need for the original document, then it can be found here, but
  43. it will no longer be considered part of the official FAQ.
  44.  
  45. Back to top
  46.  
  47. -------------------------------------------------------------------------------
  48.  
  49. 1.5.10: Poor man's sp_sysmon
  50.  
  51. -------------------------------------------------------------------------------
  52.  
  53. This is needed for System 10 and Sybase 4.9.2 where there is no sp_sysmon
  54. command available.
  55.  
  56. Fine tune the waitfor for your application. You may need TS Role -- see Q3.1.
  57.  
  58. use master
  59. go
  60. dbcc traceon(3604)
  61. dbcc monitor ("clear", "all", "on")
  62. waitfor delay "00:01:00"
  63. dbcc monitor ("sample", "all", "on")
  64. dbcc monitor ("select", "all", "on")
  65. dbcc traceon(8399)
  66. select field_name, group_name, value
  67.   from sysmonitors
  68. dbcc traceoff(8399)
  69. go
  70. dbcc traceoff(3604)
  71. go
  72.  
  73. Back to top
  74.  
  75. -------------------------------------------------------------------------------
  76.  
  77. 1.5.11: View MRU-LRU procedure cache chain
  78.  
  79. -------------------------------------------------------------------------------
  80.  
  81. dbcc procbuf gives a listing of the current contents of the procedure cache. By
  82. repeating the process at intervals it is possible to watch procedures moving
  83. down the MRU-LRU chain, and so to see how long procedures remain in cache. The
  84. neat thing about this approach is that you can size your cache according to
  85. what is actually happening, rather than relying on estimates based on
  86. assumptions that may not hold on your site.
  87.  
  88. To run it:
  89.  
  90. dbcc traceon(3604)
  91. go
  92. dbcc procbuf
  93. go
  94.  
  95. If you use sqsh it's a bit easier to grok the output:
  96.  
  97. dbcc traceon(3604);
  98. dbcc procbuf;|fgrep <pbname> 
  99.  
  100. See Q1.5.7 regarding procedure cache sizing.
  101.  
  102. Back to top
  103.  
  104. -------------------------------------------------------------------------------
  105.  
  106. 1.5.12: Improving Text/Image Type Performance
  107.  
  108. -------------------------------------------------------------------------------
  109.  
  110. If you know that you are going to be using a text/insert column immediately,
  111. insert the row setting the column to a non-null value.
  112.  
  113. There's a noticeable performance gain.
  114.  
  115. Unfortunately, text and image datatypes cannot be passed as parameters to
  116. stored procedures. The address of the text or image location must be created
  117. and returned where it is then manipulated by the calling code. This means that
  118. transactions involving both text and image fields and stored procedures are not
  119. atomic. However, the datatypes can still be declared as not null in the table
  120. definition.
  121.  
  122. Given this example -
  123.  
  124.         create table key_n_text
  125.         (
  126.             key         int     not null,
  127.             notes       text    not null
  128.         )
  129.  
  130. This stored procedure can be used -
  131.  
  132.         create procedure sp_insert_key_n_text
  133.             @key        int,
  134.             @textptr    varbinary(16)   output
  135.         as
  136.  
  137.         /*
  138.         ** Generate a valid text pointer for WRITETEXT by inserting an
  139.         ** empty string in the text field.
  140.         */
  141.         insert key_n_text
  142.         (
  143.             key,
  144.             notes
  145.         )
  146.         values
  147.         (
  148.             @key,
  149.             ""
  150.         )
  151.  
  152.         select  @textptr = textptr(notes)
  153.         from    key_n_text
  154.         where   key      = @key
  155.  
  156.         return 0
  157.         go
  158.  
  159. The return parameter is then used by the calling code to update the text field,
  160. via the dbwritetext() function if using DB-Library for example.
  161.  
  162. Back to top
  163.  
  164. -------------------------------------------------------------------------------
  165.  
  166. Server Monitoring General Troubleshooting ASE FAQ
  167.  
  168.                                Server Monitoring                               
  169.                                                                                
  170.  
  171.  
  172.     1.6.1   What is Monitor Server and how do I configure it?
  173.     1.6.2   OK, that was easy, how do I configure a client?
  174.    
  175. Platform Specific Issues - Solaris Performance and Tuning ASE FAQ
  176.  
  177. -------------------------------------------------------------------------------
  178.  
  179. 1.6.1: How do I configure Monitor Server?
  180.  
  181. -------------------------------------------------------------------------------
  182.  
  183. Monitor Server is a separate server from the normal dataserver. Its purpose, as
  184. the name suggests, is to monitor ASE. It uses internal counters to determine
  185. what is happening. On its own, it does not actually do a lot. You need to hook
  186. up a client of some sort in order to be able to view the results.
  187.  
  188. Configuration is easy. The Sybase documentation is very good on this one for
  189. either Unix or NT. Rather than repeat myself, go to the Sybase web site and
  190. check out the Monitor Server User's Guide. Obviously the link should take you
  191. to the HTML edition of the book. There is also a PDF available. Look for
  192. "monbook.pdf". If Sybase has skipped to ASE 99.9 and this link no longer works,
  193. then you will have to go search the Sybase home pages.
  194.  
  195. Back to top
  196.  
  197. -------------------------------------------------------------------------------
  198.  
  199. 1.6.2: OK, that was easy, how do I configure a client?
  200.  
  201. -------------------------------------------------------------------------------
  202.  
  203. I see that you like a challenge! Syase offer a Java client to view the output
  204. from Monitor Server. It is accessible either standalone or via the Win32
  205. edition of Sybase Central.
  206.  
  207. Standalone on NT/2000
  208.  
  209. I could not find anything about setting up the clients in the standard
  210. documentation set. However, there is a small paper on it here (towards the
  211. bottom). It does miss out a couple of important details, but is helpful for all
  212. that.
  213.  
  214. I did not try too hard to get the 11.9.2 version running, since the 12.5
  215. version will monitor 11.9 servers.
  216.  
  217. I do not have a boxed release of ASE 12.5 for NT, just the developers release.
  218. This does not come with all of the necessary files. In order to run the Monitor
  219. Client, you will need the PC Client CD that came with the boxed release. If all
  220. you have is the developer's edition, you might be stuck. It would be worth
  221. getting in touch with Sybase to see if they could ship you one. There is
  222. probably a charge!
  223.  
  224. You will need to install the client software. If you have a release of ASE
  225. already installed and running you might want to install this into a separate
  226. area. I am not sure what files it includes and versions etc, but if you have
  227. the space I recommend saving yourself some hassle. If you have an older edition
  228. of ASE installed, the installation will ask if you want to overwrite two files,
  229. mclib.dll and mchelp.dll, both of which should reside in your winnt/system32
  230. directory. It is important that you accept both of the overwrites. The older
  231. versions of these files do not seem to work.
  232.  
  233. Once installed, you will also need to spend some time playing with environment
  234. variables. I have got 3 editions of ASE all running successfully on the one
  235. machine (see Q1.3.9). I chose to have one user for each ASE instance, each with
  236. their own local environment variables pointing to the relevant installation for
  237. them, plus a generic account for my main user that I configured to use the
  238. software installed from the client CD. I adjusted the variables so that each
  239. user had their own set of variables and all of the installations worked OK.
  240.  
  241. Next, you need a copy of Java 1.1.8 installed. The client CD has a copy of JDK
  242. 1.1.8 in the "ASEP_Win32" directory. This is the one to go for, as I am sure
  243. that it was the one that the Monitor Client was built with. I did try a version
  244. from Sun's Java archive, but it failed.
  245.  
  246. Next, set up the JAVA_HOME environment variable. If you installed the JDK into
  247. its default location, that will be C:\jdk1.1.8.
  248.  
  249. Check to ensure that your CLASSPATH is defined as (assuming that you installed
  250. the client into C:\Sybase_Client):
  251.  
  252. C:\Sybase_Client\ASEP_Win32\monclass.zip;C:\Sybase_Client\ASEP_Win32\3pclass.zip;%JAVA_HOME%\lib\rt.jar
  253.  
  254. You may want to check that the files mclib.dll and mchelp.dll exist in your
  255. winnt/system32 directory if you were not asked to replace them earlier. You may
  256. also want to check that the defauly Java command is correct with java -version.
  257. It should return
  258.  
  259. java version "1.1.8"
  260.  
  261. You should now be able to fire up the main window with:
  262.  
  263. java sybase.monclt.mcgui.procact.ProcActApp  12.5  sa "sa_password" en 0 sccsen.hlp
  264.  
  265. (The paper says that you should use "jre" and not "java". That gives me a
  266. cosistent "Class not found...". I do not know why.)
  267.  
  268. You should be presented with a screen like this, which will fill with process
  269. information after 10 seconds. Choose "File->Monitors >" to choose a monitoring
  270. graph. Here are a couple of screenshots from various monitors:
  271.  
  272.   * Performance Summary
  273.   * Performance Trends...
  274.   * Process Current SQL Statement
  275.   * Network Activity
  276.  
  277. Obviously, all of this can be set from the command line or via a batch script.
  278. Shove the following into a file called mon.bat and invoke using mon ASE_SERVER
  279. MON_SERVER PASSWORD
  280.  
  281.   SET JAVA_HOME=C:\JDK1.1.8
  282.   SET PATH=%JAVA_HOME%\bin;%PATH%
  283.   SET CLASSPATH=C:\SYBASE_CLIENT\ASEP_Win32\monclass.zip;C:\SYBASE_CLIENT\ASEP_Win32\3pclass.zip
  284.   java sybase.monclt.mcgui.procact.ProcActApp %1 12.5 %2 sa "%3" en 0 scssen.hlp
  285.  
  286. Obviously, you will need to replace "C:\SYBASE_CLIENT" with the correct string
  287. pointing to your Sybase ASE installation.
  288.  
  289. Via Sybase Central on NT/2000
  290.  
  291. You will need to have installed the version of the Java Development Kit that
  292. comes with your CD, as per standalone installation. Next, create a shortcut to
  293. the file %SYBASE%\Sybase Central 3.2\win32\scview.exe. This is the Win 32
  294. version of Sybase Central. Next, edit the shortcut's properties (right click on
  295. the shortcut and select "Properties"). Now, edit the "Start In" field to be "C:
  296. \jdk1.1.8\bin", assuming that you installed the JDK into its default location.
  297.  
  298. Now, assuming that both the ASE and Monitor servers are running, start up this
  299. version of Sybase Central. Unlike the Java edition, all of the Servers from the
  300. SQL.INI file are displayed at startup. Right click on the ASE server you wish
  301. to monitor and select "Properties". This brings up a triple tabbed screen.
  302. Select the "Monitor Server" tab and use the drop down to select the appropriate
  303. monitor server. Now, connect to the ASE server and you will see another level
  304. in the options tree called "Monitors". Click on it and you should see a
  305. complete list of the monitors you can choose from. Double clicking on one
  306. should display it. The output is exactly the same as for standalone operation.
  307.  
  308. Back to top
  309.  
  310. -------------------------------------------------------------------------------
  311.  
  312. Platform Specific Issues - Solaris Performance and Tuning ASE FAQ
  313.  
  314.