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

  1. Path: senator-bedfellow.mit.edu!dreaderd!not-for-mail
  2. Message-ID: <databases/sybase-faq/part11_1082468590@rtfm.mit.edu>
  3. Supersedes: <databases/sybase-faq/part11_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: 11/19 - Issues, dbccs, isql, bcp
  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:10 GMT
  18. Lines: 1204
  19. NNTP-Posting-Host: penguin-lust.mit.edu
  20. X-Trace: 1082468710 senator-bedfellow.mit.edu 569 18.181.0.29
  21. Xref: senator-bedfellow.mit.edu comp.databases.sybase:106209 comp.answers:56955 news.answers:270295
  22.  
  23. Archive-name: databases/sybase-faq/part11
  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.                       Platform Specific Issues - Solaris                       
  32.                                                                                
  33.  
  34.  
  35.     2.1.1    Should I run 32 or 64 bit ASE with Solaris?
  36.     2.1.2    What is Intimate Shared Memory or ISM?
  37.    
  38. Platform Specific Issues - NT Performance and Tuning ASE FAQ
  39.  
  40. -------------------------------------------------------------------------------
  41.  
  42. 2.1.1: Should I run 32 or 64 bit ASE with Solaris?
  43.  
  44. -------------------------------------------------------------------------------
  45.  
  46. Sybase' first forray into 64-bit was with release 11.9.3. I do not know much
  47. about that release, but I seem to remember that it was always lagging behind
  48. its sister release of 11.9.2.
  49.  
  50. With ASE 12, Sybase have both 32-bit and 64-bit versions at the same release
  51. level. This is a big improvement, since it cuts out some concern that was
  52. prevelant with 11.9.3 as to why they were on different numbers. The releases
  53. are supposed to be identical in terms of functionality, save the fact that the
  54. 64-bit version can address more memory.
  55.  
  56. So, why not just be done with it and have just the one version? Firstly, I
  57. suppose that not everyone who can run Solaris has the capability to run the
  58. 64-bit version. There are still a lot of 32-bit Sparc chips around and a lot of
  59. people use them. It is also possible to run 32-bit Solaris on a 64-bit machine.
  60. In order to be able to run 64-bit Sybase you will have to be running 64-bit
  61. Solaris.
  62.  
  63. If you have a 64-bit environment, you still need to choose between which Sybase
  64. version to run. If you have more than 4G bytes of memory on your machine and
  65. you would like Sybase to take advantage of it, then the 64-bit version is for
  66. you. If not, then the word on the street, and from Sybase themselves, is that
  67. in identical environments, the 32-bit version runs slightly faster. I have
  68. heard a couple of explanations as to why this is so, but nothing that I find
  69. 100% convincing.
  70.  
  71. Back to top
  72.  
  73. -------------------------------------------------------------------------------
  74.  
  75. 2.1.2: What is Intimate Shared Memory or ISM?
  76.  
  77. -------------------------------------------------------------------------------
  78.  
  79. Intimate Shared Memory or ISM is a specific feature of Sun Solaris. The feature
  80. was developed so that when multiple processes (at OS level) try to access a
  81. shared memory region, they do not use multiple TLBs (Transalation Lookaside
  82. Buffers) at OS kernel level. This saves lot of kernel memory space.
  83.  
  84. I don't think that does a whole lot for Sybase, more for Oracle I suppose.
  85. However, there is a side effect that is useful. If there is engough memory
  86. available on the machine, typically Solaris will not swap out process memory
  87. marked as ISM if it can possibly help it.
  88.  
  89. Swapping in Solaris is done in three phases, reserved, allocated and used.
  90. Locking the shared memory has the advantage of increasing performance. Of
  91. course, if there are lot's of processes on the machine and if new processes
  92. starve for memory, there is a potential that ISM will get swapped.
  93.  
  94. For performance reasons, it is worth ensuring that Sybase can allocated its
  95. shared memory segment using ISM. ASE tries by default to use ISM and will
  96. display an error message during start up if this is not possible. It is
  97. probably worth starting Sybase soon after a machine is rebooted to give it the
  98. best possible chance of using ISM.
  99.  
  100. More details can be found on the Sunsolve web site. I don't have a URL, sorry.
  101. I am not even sure if this is a public site or not.
  102.  
  103. Back to top
  104.  
  105. -------------------------------------------------------------------------------
  106.  
  107. Platform Specific Issues - NT Performance and Tuning ASE FAQ
  108.  
  109.                       Platform Specific Issues - NT/2000                       
  110.                                                                                
  111.  
  112.  
  113.     2.2.1    How to Start ASE on Remote NT Servers
  114.     2.2.2    How to Configure More than 2G bytes of Memory for ASE on NT
  115.     2.2.3    Installation Issues
  116.    
  117. Platform Specific Issues - Linux Platform Specific Issues - Solaris ASE FAQ
  118.  
  119. -------------------------------------------------------------------------------
  120.  
  121. 2.2.1: How to Start ASE on Remote NT Servers
  122.  
  123. -------------------------------------------------------------------------------
  124.  
  125. Currently, there is no method of starting ASE on a remote NT server using
  126. Sybase Central.  So how do you get ASE running on an NT server located in one
  127. city when you are currently located in another.  OK, OK, so flying there is an
  128. option, but let's try to stay within the realms of practicality <g>.
  129.  
  130. One option is to buy a good telnet server and telnet onto the box and then
  131. start it using the "RUN_<server>.BAT" file.  This works, but depending on the
  132. telnet server can be a little troublesome.  NT does not have such a nice set of
  133. commands as Unix, so there is no "startserver" to run the server in the
  134. background.  This means that the telnet window that you use to start the server
  135. may have to stay open for the lifetime of the server.  This means that the
  136. health of ASE is now dependent upon two machines not crashing.  As I say, your
  137. mileage may vary, but I have certainly found this to be the case with at least
  138. one telnet server.
  139.  
  140. Another option is to use SRVMGR.EXE from the Windows NT resource kit.  Roughly
  141. you issue
  142.  
  143. srvmgr \\SERVER-TO-BE-MANAGED
  144.  
  145. (obviously replacing SERVER-TO-BE-MANAGED with the name of the server you wish
  146. to start ASE on!)
  147.  
  148. Select the "Services" option, and start ASE as if you were in the "Services"
  149. applet on a local NT server.
  150.  
  151. Yet another option is to install PC Anywhere or VNC on both machines and use
  152. one of these tools to remotely control the system.  (VNC is a very good version
  153. of PC Anywhere, except that the clients and servers run on NT, Unix, Linux; the
  154. source code is available and it is free (in both senses of the word)!)
  155.  
  156. If anyone knows of any better methods, please let me know and I will add them
  157. to this section.  Thanks.
  158.  
  159. Back to top
  160.  
  161. -------------------------------------------------------------------------------
  162.  
  163. 2.2.2: How to Configure More than 2G bytes of Memory for ASE on NT.
  164.  
  165. -------------------------------------------------------------------------------
  166.  
  167. The following was posted on news://forums.sybase.com/sybase.public.ase.nt ,
  168. taken directly from a Sybase SPS case notes.
  169.  
  170. (I read recently that this is not needed, that Sybase does all of this for you
  171. before it leaves the factory. If anyone knows the real answer, I would be
  172. grateful for an update.)
  173.  
  174. If you are using NT server enterprise, or Windows 2000 Advanced Server, you may
  175. be able to get up to 3gig:
  176.  
  177. Here is what you need to do in order to configure greater than 2GB memory for
  178. ASE on NT:
  179.  
  180. Step 1: Make a backup copy of sqlsrvr.exe in the sybase bin directory
  181.  
  182. Step 2: Verify the current settings of sqlsrvr.exe using imagecfg.exe:
  183.  
  184. imagecfg sqlsrvr.exe
  185. sqlsrvr.exe contains the following configuration information:
  186.    Subsystem Version of 4.0
  187.    Stack Reserve Size: 0x20000
  188.    Stack Commit Size: 0x4
  189.  
  190. Step 3: Use imagecfg to switch on large addressing using the -l (lowercase L)
  191. switch:
  192.  
  193. imagecfg -l sqlsrvr.exe
  194. sqlsrvr.exe contains the following configuration information:
  195.    Subsystem Version of 4.0
  196.    Stack Reserve Size: 0x20000
  197.    Stack Commit Size: 0x4
  198.  
  199. sqlsrvr.exe updated with the following configuration information:
  200.  
  201.    Subsystem Version of 4.0
  202.    Image can handle large (>2GB) addresses
  203.    Stack Reserve Size: 0x20000
  204.    Stack Commit Size: 0x4
  205.  
  206. Step 4: verify ASE is able to start
  207.  
  208. Step 5: The NT machine must be booted with the /3GB flag and must have
  209. sufficient paging file space (e.g., if you want ASE to access 3G of memory then
  210. the paging file must be at least that size)
  211.  
  212. Step 6: increase total memory to say 2.2 gb (anything > 2gb)
  213.  
  214. Step 7: increase starting virtual memory address to 23662592 decimal (which is
  215. 1691000 hex) as shown:
  216.  
  217. sp_configure 'shared memory starting address', 23662592
  218.  
  219. Step 8: restart server
  220.  
  221. Step 9: test to connect a lot of users (more than 240)
  222.  
  223. Back to top
  224.  
  225. -------------------------------------------------------------------------------
  226.  
  227. 2.2.3: Installation issues.
  228.  
  229. -------------------------------------------------------------------------------
  230.  
  231. This is a list of items to be aware of when installing ASE onto NT/2000.
  232.  
  233.   * Make sure that you install onto a local drive. This might not affect all
  234.     versions of ASE on NT/2000, but I could not get the software to install and
  235.     run from a network drive with the 12.5 developer edition. Try as I might,
  236.     it kept failing without really telling me why. I aborted the installation,
  237.     installed onto one of the local drives, and it worked a charm. My only NT/
  238.     2000 machine is my laptop with only one drive, so I do not know if this is
  239.     any drive other than "C" or whether it is just network mounted drives. Will
  240.     be happy to take advice and corrections from Sybase or anyone that can tell
  241.     me what I was doing wrong.
  242.  
  243. Back to top
  244.  
  245. -------------------------------------------------------------------------------
  246.  
  247. Platform Specific Issues - Linux Platform Specific Issues - Solaris ASE FAQ
  248.  
  249.                        Platform Specific Issues - Linux                        
  250.                                                                                
  251.  
  252.  
  253.     2.3.1    ASE on Linux FAQ
  254.    
  255. DBCCs Platform Specific Issues - NT ASE FAQ
  256.  
  257. -------------------------------------------------------------------------------
  258.  
  259. 2.3.1: ASE on Linux FAQ
  260.  
  261. -------------------------------------------------------------------------------
  262.  
  263. There is an FAQ covering ASE on Linux at Michael Peppler's site.
  264.  
  265. http://www.mbay.net/~mpeppler/Linux-ASE-FAQ.html
  266.  
  267. It contains a fair bit of information about running Sybase ASE on Linux and if
  268. you are interested in doing just that, then go read it. It certainly will
  269. answer your question about why, after a new install, you can connect from the
  270. server that ASE is installed on but no other client. (I am not going to tell
  271. you here, you will have to go and read it :-)
  272.  
  273. Back to top
  274.  
  275. -------------------------------------------------------------------------------
  276.  
  277. DBCCs Platform Specific Issues - NT ASE FAQ
  278.  
  279.                                     DBCC's                                     
  280.                                                                                
  281.  
  282.  
  283.     3.1    How do I set TS Role in order to run certain DBCCs...?
  284.     3.2    What are some of the hidden/trick DBCC commands?
  285.     3.3    Other sites with DBCC information.
  286.     3.4    Fixing a Munged Log
  287.    
  288.     Performing any of the above may corrupt your ASE installation. Please do 
  289.     not call Sybase Technical Support after screwing up ASE. Remember, always
  290.     take a dump of the master database and any other databases that are to be
  291.     affected.
  292.    
  293. isql Platform Specific Issues - Linux ASE FAQ Index
  294.  
  295. -------------------------------------------------------------------------------
  296.  
  297. 3.1: How to set TS Role
  298.  
  299. -------------------------------------------------------------------------------
  300.  
  301. Some DBCC commands require that you set TS Role in order to run them. Here's
  302. how to set it:
  303.  
  304. Login to Server as sa and perform the following:
  305.  
  306.     sp_role "grant", sybase_ts_role, sa
  307.     go
  308.     
  309.     set role "sybase_ts_role" on
  310.     go
  311.  
  312. Back to top
  313.  
  314. -------------------------------------------------------------------------------
  315.  
  316. 3.2: DBCC Command Reference
  317.  
  318. -------------------------------------------------------------------------------
  319.  
  320. Here is the list of DBCC commands that have been sent into the FAQ.  If you
  321. know of any more or have more information, then please send it in to 
  322. dowen@midsomer.org, this is, after all, a resource for us all.
  323.  
  324. As ASE develops, so some of the dbcc's change.  I have pointed out major
  325. changes from one release to another that I know about.  However, a couple of
  326. changes are so common that it will save a lot of space if I say it once.  Where
  327. there is an option to specify dbid or dbname, in previous releases only dbid
  328. would be accepted.
  329.  
  330. +--------------------------------------------------------------------------------------------------------------+
  331. |                  |                                                     |                          |Risk Level|
  332. |    DBCC Name     |                    Argument List                    |         Comments         |    /     |
  333. |                  |                                                     |                          |Supported?|
  334. |------------------+-----------------------------------------------------+--------------------------+----------|
  335. |allocdump         |( dbid | dbname, page )                              |                          |          |
  336. |------------------+-----------------------------------------------------+--------------------------+----------|
  337. |                  |( { print_bufs | no_print }, bucket_limit )          |Format prior to ASE 11.   |          |
  338. |                  |-----------------------------------------------------+--------------------------+----------|
  339. |bhash             |                                                     |Format prior to ASE 12.   |          |
  340. |                  |-----------------------------------------------------+--------------------------+----------|
  341. |                  |( cname [, clet_id [, { print_bufs | no_print        |Format ASE 12 and later.  |          |
  342. |                  |},bucket_limit]] )                                   |                          |          |
  343. |------------------+-----------------------------------------------------+--------------------------+----------|
  344. |                  |( [ dbid ][, objid ][, nbufs ], printopt = {0 | 1 |  |Format prior to ASE 11.   |          |
  345. |                  |2},buftype)                                          |                          |          |
  346. |                  |-----------------------------------------------------+--------------------------+----------|
  347. |                  |[ (dbid | dbname [, objid | objname [, nbufs [,      |                          |          |
  348. |                  |printopt = { 0 | 1 | 2 }                             |Format prior to ASE 12.   |          |
  349. |                  |[, buftype = { kept | hashed | nothashed | ioerr} [, |                          |          |
  350. |buffer            |cachename ] ] ] ] ] ) ]                              |                          |          |
  351. |                  |-----------------------------------------------------+--------------------------+----------|
  352. |                  |[ (dbid | dbname [, objid | objname [, nbufs [,      |                          |          |
  353. |                  |printopt = { 0 | 1 | 2 }                             |                          |          |
  354. |                  |[, buftype = { kept | hashed | nothashed | ioerr} [, |Format ASE 12 and later.  |          |
  355. |                  |cachename [, cachelet_id ]                           |                          |          |
  356. |                  |] ] ] ] ] ) ]                                        |                          |          |
  357. |------------------+-----------------------------------------------------+--------------------------+----------|
  358. |                  |( startaddress, length )                             |Format prior to ASE 12.   |          |
  359. |bytes             |-----------------------------------------------------+--------------------------+----------|
  360. |                  |(startaddress, length [, showlist | STRUCT_NAME])    |Format ASE 12 and later.  |          |
  361. |------------------+-----------------------------------------------------+--------------------------+----------|
  362. |                  |                                                     |Uninstall and Uncache     |          |
  363. |cacheremove       |(dbid|dbname, objid|objname)                         |descriptor for an object  |          |
  364. |                  |                                                     |from cache                |          |
  365. |------------------+-----------------------------------------------------+--------------------------+----------|
  366. |checkalloc        |[( dbname [, fix | nofix ] ) ]                       |                          |          |
  367. |------------------+-----------------------------------------------------+--------------------------+----------|
  368. |checkcatalog      |[( dbname )]                                         |                          |          |
  369. |------------------+-----------------------------------------------------+--------------------------+----------|
  370. |checkdb           |[( dbname [, skip_ncindex ] ) ]                      |                          |          |
  371. |------------------+-----------------------------------------------------+--------------------------+----------|
  372. |checktable        |( tablename | tabid [, skip_ncindex ] )              |                          |          |
  373. |------------------+-----------------------------------------------------+--------------------------+----------|
  374. |                  |                                                     |Error can take one of the |          |
  375. |                  |                                                     |following values:         |          |
  376. |                  |                                                     |                          |          |
  377. |                  |                                                     |  * 1133 error            |          |
  378. |                  |                                                     |    demonstrates that a   |          |
  379. |                  |                                                     |    page we think is an   |          |
  380. |                  |                                                     |    oam is not            |          |
  381. |                  |                                                     |  * 2502 error shows      |          |
  382. |                  |                                                     |    multiple references to|          |
  383. |                  |                                                     |    the same page         |          |
  384. |                  |                                                     |  * 2503 error shows a    |          |
  385. |                  |                                                     |    breakage in the page  |          |
  386. |                  |                                                     |    linkage               |          |
  387. |                  |                                                     |  * 2521 error shows that |          |
  388. |                  |                                                     |    the page is referenced|          |
  389. |                  |                                                     |    but is not allocated  |          |
  390. |                  |                                                     |    on the extent page    |          |
  391. |                  |                                                     |  * 2523 error shows that |          |
  392. |                  |                                                     |    the page number in the|          |
  393. |                  |                                                     |    page or catalog       |          |
  394. |                  |                                                     |    entries are           |          |
  395. |                  |                                                     |    out-of-range for the  |          |
  396. |                  |                                                     |    database              |          |
  397. |                  |                                                     |  * 2525 error shows that |          |
  398. |                  |                                                     |    an extent objid/indid |          |
  399. |                  |                                                     |    do not match what is  |          |
  400. |                  |                                                     |    on the page           |          |
  401. |                  |                                                     |  * 2529 error shows a    |          |
  402. |corrupt           |( tablename, indid, error )                          |    page number           |          |
  403. |                  |                                                     |    out-of-range for the  |          |
  404. |                  |                                                     |    database or a 605     |          |
  405. |                  |                                                     |    style scenario        |          |
  406. |                  |                                                     |  * 2540 error occurs when|          |
  407. |                  |                                                     |    a page is allocated on|          |
  408. |                  |                                                     |    an extent but the page|          |
  409. |                  |                                                     |    is not referenced in  |          |
  410. |                  |                                                     |    the page chain        |          |
  411. |                  |                                                     |  * 2546 error occurs when|          |
  412. |                  |                                                     |    an extent is found for|          |
  413. |                  |                                                     |    an object without an  |          |
  414. |                  |                                                     |    of its pages being    |          |
  415. |                  |                                                     |    referenced (a stranded|          |
  416. |                  |                                                     |    extent)               |          |
  417. |                  |                                                     |  * 7939 error occurs when|          |
  418. |                  |                                                     |    an allocation page    |          |
  419. |                  |                                                     |    which has extents for |          |
  420. |                  |                                                     |    an object are not     |          |
  421. |                  |                                                     |    reflected on the OAM  |          |
  422. |                  |                                                     |    page                  |          |
  423. |                  |                                                     |  * 7940 error occurs when|          |
  424. |                  |                                                     |    the total counts in   |          |
  425. |                  |                                                     |    the OAM page differ   |          |
  426. |                  |                                                     |    from the actual count |          |
  427. |                  |                                                     |    of pages in the chain |          |
  428. |                  |                                                     |  * 7949 error is similar |          |
  429. |                  |                                                     |    to a 7940 except that |          |
  430. |                  |                                                     |    the counts are on an  |          |
  431. |                  |                                                     |    allocation page basis |          |
  432. |------------------+-----------------------------------------------------+--------------------------+----------|
  433. |                  |                                                     |cursor_level - level of   |          |
  434. |cursorinfo        |(cursor_level, cursor_name)                          |nesting. -1 is all nesting|          |
  435. |                  |                                                     |levels                    |          |
  436. |------------------+-----------------------------------------------------+--------------------------+----------|
  437. |dbinfo            |( [ dbname ] )                                       |                          |          |
  438. |------------------+-----------------------------------------------------+--------------------------+----------|
  439. |dbrepair          |( dbid, option = { dropdb | fixindex | fixsysindex },|                          |          |
  440. |                  |table, indexid )                                     |                          |          |
  441. |------------------+-----------------------------------------------------+--------------------------+----------|
  442. |dbrepair          |( dbid, ltmignore)                                   |                          |          |
  443. |------------------+-----------------------------------------------------+--------------------------+----------|
  444. |dbtable           |( dbid )                                             |                          |          |
  445. |------------------+-----------------------------------------------------+--------------------------+----------|
  446. |delete_row        |( dbid, pageid, delete_by_row = { 1 | 0 }, rownum )  |                          |          |
  447. |------------------+-----------------------------------------------------+--------------------------+----------|
  448. |des               |( [ dbid ][, objid ] )                               |                          |          |
  449. |------------------+-----------------------------------------------------+--------------------------+----------|
  450. |                  |                                                     |eng func may be:          |          |
  451. |                  |                                                     |                          |          |
  452. |engine            |(eng_func)                                           |  * "online"              |          |
  453. |                  |                                                     |  * "offline", ["<engine  |          |
  454. |                  |                                                     |    number>"]             |          |
  455. |------------------+-----------------------------------------------------+--------------------------+----------|
  456. |extentcheck       |( dbid, objid, indexid, sort = {1|0} )               |                          |          |
  457. |------------------+-----------------------------------------------------+--------------------------+----------|
  458. |extentdump        |( dbid, page )                                       |                          |          |
  459. |------------------+-----------------------------------------------------+--------------------------+----------|
  460. |extentzap         |( dbid, objid, indexid, sort )                       |                          |          |
  461. |------------------+-----------------------------------------------------+--------------------------+----------|
  462. |findnotfullextents|( dbid, objid, indexid, sort = { 1 | 0 } )           |                          |          |
  463. |------------------+-----------------------------------------------------+--------------------------+----------|
  464. |fix_al            |( [ dbname ] )                                       |                          |          |
  465. |------------------+-----------------------------------------------------+--------------------------+----------|
  466. |help              |( dbcc_command )                                     |                          |          |
  467. |------------------+-----------------------------------------------------+--------------------------+----------|
  468. |ind               |( dbid, objid, printopt = { 0 | 1 | 2 } )            |                          |          |
  469. |------------------+-----------------------------------------------------+--------------------------+----------|
  470. |indexalloc        |(tablename|tabid, indid, [full | optimized | fast],  |                          |          |
  471. |                  |[fix | nofix])                                       |                          |          |
  472. |------------------+-----------------------------------------------------+--------------------------+----------|
  473. |listoam           |(dbid | dbname, tabid | tablename, indid)            |                          |          |
  474. |------------------+-----------------------------------------------------+--------------------------+----------|
  475. |locateindexpgs    |( dbid, objid, page, indexid, level )                |                          |          |
  476. |------------------+-----------------------------------------------------+--------------------------+----------|
  477. |lock              |                                                     |print out lock chains     |          |
  478. |------------------+-----------------------------------------------------+--------------------------+----------|
  479. |log               |( [dbid][,objid][,page][,row][,nrecords][,type=      |                          |          |
  480. |                  |{-1..36}],printopt={0|1} )                           |                          |          |
  481. |------------------+-----------------------------------------------------+--------------------------+----------|
  482. |memusage          |                                                     |                          |          |
  483. |------------------+-----------------------------------------------------+--------------------------+----------|
  484. |netmemshow        |( option = {1 | 2 | 3} )                             |                          |          |
  485. |------------------+-----------------------------------------------------+--------------------------+----------|
  486. |netmemusage       |                                                     |                          |          |
  487. |------------------+-----------------------------------------------------+--------------------------+----------|
  488. |newalloc          |( dbname, option = { 1 | 2 | 3 } )                   |                          |          |
  489. |------------------+-----------------------------------------------------+--------------------------+----------|
  490. |page              |( dbid, pagenum [, printopt={0|1|2} ][, cache={0|1} ]|                          |          |
  491. |                  |[, logical={1|0} ] )                                 |                          |          |
  492. |------------------+-----------------------------------------------------+--------------------------+----------|
  493. |pglinkage         |( dbid, start, number, printopt={0|1|2}, target,     |                          |          |
  494. |                  |order={1|0} )                                        |                          |          |
  495. |------------------+-----------------------------------------------------+--------------------------+----------|
  496. |pktmemshow        |( option = {spid} )                                  |                          |          |
  497. |------------------+-----------------------------------------------------+--------------------------+----------|
  498. |procbuf           |( dbid, objid, nbufs, printopt = { 0 | 1 } )         |                          |          |
  499. |------------------+-----------------------------------------------------+--------------------------+----------|
  500. |prtipage          |( dbid, objid, indexid, indexpage )                  |                          |          |
  501. |------------------+-----------------------------------------------------+--------------------------+----------|
  502. |pss               |( suid, spid, printopt = { 1 | 0 } )                 |                          |          |
  503. |------------------+-----------------------------------------------------+--------------------------+----------|
  504. |rebuildextents    |( dbid, objid, indexid )                             |                          |          |
  505. |------------------+-----------------------------------------------------+--------------------------+----------|
  506. |                  |                                                     |careful as this will cause|          |
  507. |rebuild_log       |( dbid, 1, 1)                                        |large jumps in your       |          |
  508. |                  |                                                     |timestamp values used by  |          |
  509. |                  |                                                     |log recovery.             |          |
  510. |------------------+-----------------------------------------------------+--------------------------+----------|
  511. |remap             |                                                     |Only available prior to   |          |
  512. |                  |                                                     |12.                       |          |
  513. |------------------+-----------------------------------------------------+--------------------------+----------|
  514. |resource          |                                                     |                          |          |
  515. |------------------+-----------------------------------------------------+--------------------------+----------|
  516. |setkeepalive      |(# minutes)                                          |for use on Novell with TCP|          |
  517. |                  |                                                     |/IP.                      |          |
  518. |------------------+-----------------------------------------------------+--------------------------+----------|
  519. |                  |                                                     |Not needed with more      |          |
  520. |                  |                                                     |recent versions of ASE,   |          |
  521. |                  |                                                     |use the supplied stored   |          |
  522. |                  |                                                     |procs.  On older versions |          |
  523. |settrunc          |('ltm','ignore')                                     |of ASE (pre-11?) this     |          |
  524. |                  |                                                     |command may be useful for |          |
  525. |                  |                                                     |a dba who is dumping and  |          |
  526. |                  |                                                     |loading a database that   |          |
  527. |                  |                                                     |has replication set on for|          |
  528. |                  |                                                     |the original db.          |          |
  529. |------------------+-----------------------------------------------------+--------------------------+----------|
  530. |                  |                                                     |Shows the sql that the    |          |
  531. |sqltext           |(spid)                                               |spid is currently         |          |
  532. |                  |                                                     |running.  Blank if idle.  |          |
  533. |------------------+-----------------------------------------------------+--------------------------+----------|
  534. |stacktrace        |(spid)                                               |Not Linux, yet :-)        |          |
  535. |------------------+-----------------------------------------------------+--------------------------+----------|
  536. |show_bucket       |( dbid, pageid, lookup_type )                        |                          |          |
  537. |------------------+-----------------------------------------------------+--------------------------+----------|
  538. |tab               |( dbid, objid, printopt = { 0 | 1 | 2 } )            |                          |          |
  539. |------------------+-----------------------------------------------------+--------------------------+----------|
  540. |tablealloc        |(tablename|tabid, [full | optimized | fast],[fix |   |                          |          |
  541. |                  |nofix])                                              |                          |          |
  542. |------------------+-----------------------------------------------------+--------------------------+----------|
  543. |traceoff          |( tracenum [, tracenum ... ] )                       |                          |          |
  544. |------------------+-----------------------------------------------------+--------------------------+----------|
  545. |traceon           |( tracenum [, tracenum ... ] )                       |                          |          |
  546. |------------------+-----------------------------------------------------+--------------------------+----------|
  547. |                  |                                                     |Used to switch on/off     |          |
  548. |                  |                                                     |certain options.  Some are|          |
  549. |                  |                                                     |supported and listed in   |          |
  550. |                  |                                                     |the docs, others          |          |
  551. |                  |                                                     |correspond to the         |          |
  552. |                  |                                                     |buildmaster -yall name    |          |
  553. |                  |                                                     |minus the c prefix.       |          |
  554. |                  |                                                     |                          |          |
  555. |                  |                                                     |Supported:                |          |
  556. |                  |                                                     |                          |          |
  557. |                  |                                                     |  * ascinserts ('value' is|          |
  558. |                  |                                                     |    again two values, 1|0 |          |
  559. |                  |                                                     |    for on or off and the |          |
  560. |                  |                                                     |    table name).          |          |
  561. |                  |                                                     |  * cpuaffinity           |          |
  562. |                  |                                                     |    ('value' in this case |          |
  563. |tune              |( option, value )                                    |    is two values, the    |          |
  564. |                  |                                                     |    starting cpu number   |          |
  565. |                  |                                                     |    and "on" or "off".)   |          |
  566. |                  |                                                     |  * maxwritedes           |          |
  567. |                  |                                                     |                          |          |
  568. |                  |                                                     |Unsupported:              |          |
  569. |                  |                                                     |                          |          |
  570. |                  |                                                     |  * indextrips            |          |
  571. |                  |                                                     |  * oamtrips              |          |
  572. |                  |                                                     |  * datatrips             |          |
  573. |                  |                                                     |  * schedspins            |          |
  574. |                  |                                                     |  * bufwashsize           |          |
  575. |                  |                                                     |  * sortbufsize           |          |
  576. |                  |                                                     |  * sortpgcount           |          |
  577. |                  |                                                     |  * maxscheds             |          |
  578. |                  |                                                     |  * max_retries           |          |
  579. |                  |                                                     |                          |          |
  580. |                  |                                                     |                          |          |
  581. |------------------+-----------------------------------------------------+--------------------------+----------|
  582. |undo              |( dbid, pageno, rowno )                              |                          |          |
  583. |------------------+-----------------------------------------------------+--------------------------+----------|
  584. |                  |( dbid|dbname, type = {0|1}, display_opts = {0|1} [, |If sp_helpdb is returning |          |
  585. |usedextents       |bypiece = {0|1}])                                    |negative free space, try: |          |
  586. |                  |                                                     |usedextents(dbid, 0, 1, 1)|          |
  587. +--------------------------------------------------------------------------------------------------------------+
  588.  
  589. Back to top
  590.  
  591. -------------------------------------------------------------------------------
  592.  
  593. 3.3: Other Sites with DBCC information
  594.  
  595. -------------------------------------------------------------------------------
  596.  
  597.   * http://user.icx.net/~huntley/dbccinfo.htm, Al Huntley's site contains a
  598.     comprehensive including discussion on some and example output.
  599.   * http://www.kaleidatech.com/dbcc1.htm, From KaleidaTech Associates, Inc. has
  600.     another fairly complete list.
  601.   * http://www.sypron.nl, as you would expect, Rob Verschoor has a list of
  602.     DBCC's in his ASE Quick Reference Supplement.
  603.  
  604. Back to top
  605.  
  606. -------------------------------------------------------------------------------
  607.  
  608. 3.4: Fixing a Munged Log
  609.  
  610. -------------------------------------------------------------------------------
  611.  
  612.    
  613.     Sybase Technical Support states that this is extremely dangerous as it
  614.     "jacks up the value of the timestamp" which is used for recovery purposes.
  615.     This may cause potential database corruption if the system fails while the
  616.     timestamp rolls over.
  617.    
  618.     In 4.9.2, you could only run the dbcc rebuild_log command once and after
  619.     that you would have to use bcp to rebuild the database
  620.    
  621.     In System 10, you can run this command about 10 times.
  622.    
  623.     In System 11 I (Pablo, previous editor) tried it about 20 times and no
  624.     problem.
  625.    
  626. 1> use master
  627. 2> go
  628. 1> select count(*) from your_database..syslogs
  629. 2> go
  630.  
  631.  -----------
  632.  some number
  633.  
  634. 1> sp_configure "allow updates",1
  635. 2> go
  636. 1> reconfigure with override  /* for system 10 and below only*/
  637. 2> go
  638.  
  639. 1> begin tran
  640. 2> go
  641.  
  642. /* Save the following status to be used later... */
  643. 1> select saved_status=status from sysdatabases where name = "your_database"
  644. 2> go
  645. 1> update sysdatabases set status = -32768 where name = "your_database"
  646. 2> go
  647. 1> commit tran
  648. 2> go
  649. 1> shutdown
  650. 2> go
  651.  
  652. 1> dbcc rebuild_log (your_database, 0, 0)
  653. 2> go
  654. DB-LIBRARY error (severity 9):
  655.    Unexpected EOF from SQL Server.
  656.  
  657. 1> dbcc rebuild_log (your_database, 1, 1)
  658. 2> go
  659. DBCC execution completed. If DBCC printed error messages, see your System
  660. Administrator.
  661.  
  662.  
  663. 1> use your_database
  664. 2> go
  665. 1> select count(*) from syslogs
  666. 2> go
  667.  
  668.  -----------
  669.            1
  670.  
  671. 1> begin tran
  672. 2> go
  673. 1> update sysdatabases set status = saved_status where name = "your_database"
  674. 2> go
  675. (1 row affected)
  676. 1> commit tran
  677. 2> go
  678. 1> shutdown
  679. 2> go
  680.  
  681. Back to top
  682.  
  683. -------------------------------------------------------------------------------
  684.  
  685. isql Platform Specific Issues - Linux ASE FAQ Index
  686.  
  687.                                      isql                                      
  688.                                                                                
  689.  
  690.  
  691.     4.1    How do I hide my password using isql?
  692.     4.2    How do I remove row affected and/or dashes when using isql?
  693.     4.3    How do I pipe the output of one isql to another?
  694.     4.4    What alternatives to isql exist?
  695.     4.5    How can I make isql secure?
  696.    
  697. bcp DBCCs ASE FAQ
  698.  
  699. -------------------------------------------------------------------------------
  700.  
  701. 4.1: Hiding your password to isql
  702.  
  703. -------------------------------------------------------------------------------
  704.  
  705. Here are a menagerie (I've always wanted to use that word) of different methods
  706. to hide your password. Pick and choose whichever fits your environment best:
  707.  
  708. Single ASE on host
  709.  
  710. Script #1
  711.  
  712. Assuming that you are using bourne shell sh(1) as your scripting language you
  713. can put the password in a file and substitute the file where the password is
  714. needed.
  715.  
  716. #!/bin/sh
  717.  
  718. # invoke say ISQL or something...
  719. (cat $HOME/dba/password_file
  720.  cat << EOD
  721. dbcc ...
  722. go
  723. EOD ) | $SYBASE/bin/isql -Usa -w1000
  724.  
  725. Script #2
  726.  
  727. #!/bin/sh
  728. umask 077
  729. cat <<-endOfCat | isql -Umyuserid -Smyserver
  730.         mypassword
  731.         use mydb
  732.         go
  733.         sp_who
  734.         go
  735.         endOfCat
  736.  
  737. Script #3
  738.  
  739. #!/bin/sh
  740. umask 077
  741. cat <<-endOfCat | isql -Umyuserid -Smyserver
  742.         `myScriptForGeneratingPasswords myServer`
  743.         use mydb
  744.         go
  745.         sp_who
  746.         go
  747.         endOfCat
  748.  
  749. Script #3
  750.  
  751.  
  752. #!/bin/sh
  753. umask 077
  754. isql -Umyuserid -Smyserver <<-endOfIsql
  755.         mypassword
  756.         use mydb
  757.         go
  758.         sp_who
  759.         go
  760.         endOfIsql
  761.  
  762. Script #4
  763.  
  764.  
  765. #!/bin/sh
  766. umask 077
  767. isql -Umyuserid -Smyserver <<-endOfIsql
  768.         `myScriptForGeneratingPasswords myServer`
  769.         use mydb
  770.         go
  771.         sp_who
  772.         go
  773.         endOfIsql
  774.  
  775. Script #5
  776.  
  777.  
  778. #!/bin/sh
  779. echo 'mypassword
  780. use mydb
  781. go
  782. sp_who
  783. go' | isql -Umyuserid -Smyserver
  784.  
  785. Script #6
  786.  
  787.  
  788. #!/bin/sh
  789. echo "`myScriptForGeneratingPasswords myServer`
  790. use mydb
  791. go
  792. sp_who
  793. go" | isql -Umyuserid -Smyserver
  794.  
  795. Script #7
  796.  
  797. #!/bin/sh
  798. echo "Password :\c "
  799. stty -echo
  800. read PASSWD
  801. stty echo
  802.  
  803. echo "$PASSWD
  804. waitfor delay '0:1:00'
  805. go
  806. " | $SYBASE/bin/isql -Usa -S${DSQUERY}
  807.  
  808. Multiple ASEs on host
  809.  
  810. Again, assuming that you are using bourne shell as your scripting language, you
  811. can do the following:
  812.  
  813.  1. Create a global file. This file will contain passwords, generic functions,
  814.     master device for the respective DSQUERY.
  815.  2. In the actual scripts, source in the global file.
  816.  
  817. Global File
  818.  
  819. SYBASE=/usr/sybase
  820.  
  821. my_password()
  822. {
  823.    case $1 in
  824.       SERVER_1)  PASSWD="this";;
  825.       SERVER_2)  PASSWD="is";;
  826.       SERVER_3)  PASSWD="bogus;;
  827.       *) return 1;;
  828.    esac
  829.  
  830.    return 0
  831. }
  832.  
  833. Generic Script
  834.  
  835. #!/bin/sh -a
  836.  
  837. #
  838. # Use "-a" for auto-export of variables
  839. #
  840.  
  841. # "dot" the file - equivalent to csh() "source" command
  842. . $HOME/dba/global_file
  843.  
  844. DSQUERY=$1
  845.  
  846. # Determine the password:  sets PASSWD
  847. my_password $DSQUERY
  848. if [ $? -ne 0 ] ; then # error!
  849.    echo "<do some error catching>"
  850.    exit 1
  851. fi
  852.  
  853. # invoke say ISQL or something...
  854. echo "$PASSWD
  855. dbcc ...
  856. go" | $SYBASE/bin/isql -U sa -S $DSQUERY -w1000
  857.  
  858. Back to top
  859.  
  860. -------------------------------------------------------------------------------
  861.  
  862. 4.2: How to remove row affected and dashes
  863.  
  864. -------------------------------------------------------------------------------
  865.  
  866. If you pipe the output of isql then you can use sed(1) to remove this
  867. extraneous output:
  868.  
  869. echo "$PASSWD
  870.       sp_who
  871.       go" | isql -U sa -S MY_SERVER | sed -e '/affected/d'
  872. -e '/---/d'
  873.  
  874. If you simply wish to eliminate the row affected line use the set nocount on
  875. switch.
  876.  
  877. Back to top
  878.  
  879. -------------------------------------------------------------------------------
  880.  
  881. 4.3: How do I pipe the output of one isql to another?
  882.  
  883. -------------------------------------------------------------------------------
  884.  
  885. The following example queries sysdatabases and takes each database name and
  886. creates a string of the sort sp_helpdb dbname and sends the results to another
  887. isql. This is accomplished using bourne shell sh(1) and sed(1) to strip
  888. unwanted output (see Q4.2):
  889.  
  890. #!/bin/sh
  891.  
  892. PASSWD=yuk
  893. DSQUERY=GNARLY_HAIRBALL
  894.  
  895. echo "$PASSWD print \"$PASSWD\"
  896.       go
  897.       select 'sp_helpdb ' + name + char(10) + 'go'
  898.         from sysdatabases
  899.       go" | isql -U sa -S $DSQUERY -w 1000 | \
  900. sed -e '/affected/d' -e '/---/d' -e '/Password:/d' | \
  901. isql -U sa -S $DSQUERY -w 1000 
  902.  
  903. To help you understand this you may wish to comment out any series of pipes and
  904. see what output is being generated.
  905.  
  906. Back to top
  907.  
  908. -------------------------------------------------------------------------------
  909.  
  910. 4.4: Are there any alternatives to isql?
  911.  
  912. -------------------------------------------------------------------------------
  913.  
  914. sqsh
  915.  
  916. In my opinion, and that of quite a lot of others, this is the most useful
  917. (direct) replacement for isql that exists. It combines the usefulness of a good
  918. shell with database interaction. Looking for the ability to page the output of
  919. a long command? Look no further. Need to search a result set using a regular
  920. expression? This is the tool for you.
  921.  
  922. Like isql, sqsh is a command line tool. It supports all of the features and
  923. switches of isql with myriad of its own. There is one feature that isql has the
  924. sqsh does not, and that is the ability to read the password as the first line
  925. of an input file. If you look at a lot of the examples above, the password is
  926. piped in, sqsh does not support this with the latest release. I am not sure if
  927. this is a deliberate feature or not.
  928.  
  929. A quick summary of its features:
  930.  
  931.  1. command line editing;
  932.  2. command history;
  933.  3. ability to pipe to standard filters;
  934.  4. ability to redirect output to X window;
  935.  5. shell variables
  936.  6. background execution;
  937.  
  938. Like all good modern shells, sqsh supports command line editing. You need to
  939. have the GNU readline library available on your machine, but that is now
  940. becoming common. If you have the bash shell, you have it by default I believe.
  941.  
  942. Sqsh behaves very well if run in an X Windows environment. There is the direct
  943. support by way of an output switch to go that sends the results to an X Window,
  944. but it is much better than that. If you resize the screen sqsh also resizes its
  945. internal width to take advantage of the new size, just like any well behave X
  946. application. Doesn't sound like a lot, but when you want to see the results
  947. from a query and understand the output easily, much better if the columns all
  948. line up and don't wrap. With isql you would have to exit the program, run it
  949. again with an adjust '-w' flag and rerun the query.
  950.  
  951. Enough said. You need to try it! You can grab it from the official SQSH website
  952. http://www.sqsh.org.
  953.  
  954. There are a host of others that I have heard about, but can no longer get to.
  955. Some are mentioned in various sites, mainly the sqsh site. If any of them are
  956. important, still being maintained, are actively supported, and are available
  957. somewhere, then let me know and I will update this list.
  958.  
  959.   * dsql
  960.   * asql
  961.   * ctsql
  962.   * qisql
  963.  
  964. However, I suspect that provided we have sqsh, no other command line version is
  965. needed!!
  966.  
  967. SQL Advantage
  968.  
  969. This was Sybase's second attempt at a true GUI based SQL editor. It was only
  970. available for W86 platforms. Quite a lot of people liked it, it came free with
  971. Sybase and did just about the minimum necessary for an SQL Editor. Sadly, I
  972. cannot find my copy any more, since 12.5 for NT no longer has it. I have heard
  973. several unofficial channels say that Sybase will let you have a copy if you
  974. ask. I do not know since I have not asked.
  975.  
  976. Not having a copy, and having a bad memory, I cannot tell you all of its
  977. features. I cannot remember syntax highlighting or anything fancy like that,
  978. but that does not mean that it was not there. I know that there are some true
  979. devotees and if one of you cares to send me some words, I will slap them in
  980. here.
  981.  
  982. There was a GUI before SQL Advantage, but it is/was too dire to mention.
  983.  
  984. jisql
  985.  
  986. This is the latest release from Sybase for the desktop interactive shell. It
  987. uses Java, but you probably guessed that from the name. It works fine and is a
  988. little like SQL Advantage (which was a little like Data Work Bench, which was a
  989. ...), from what I remember of that tool. Correct me if I am wrong Anthony!!
  990.  
  991. The best thing about it is that it is available for all platforms that support
  992. Java.
  993.  
  994. The worst thing about it, and this is not so much a fault of jisql as a fault
  995. of Java in general, is that it is unable to use the interfaces file. I know
  996. that Java is intended to be truly multi-platform and that your average
  997. photocopier does not have access to environment variables, but how many
  998. photocopiers run Sybase? In most installations I can find my way totally
  999. painlessly from ASE server to ASE server, not worrying about ports etc. If you
  1000. start using jisql regularly you will soon know the port numbers, since it is
  1001. the only way that you can connect. Personally, until this is solved, I will not
  1002. use the bloody tool.
  1003.  
  1004. tsql
  1005.  
  1006. This is the command line client that comes with FreeTDS. It comes with the
  1007. FreeTDS client (http://www.freetds.org). It is a very simple client, but it
  1008. works.
  1009.  
  1010. ASSE
  1011.  
  1012. Developed by Manish I Shah to be a direct replacement for Data Workbench, but
  1013. in Java. It is still in alpha, I believe, at Sourceforge. Suffers the same pros
  1014. and cons as jisql simply because of its Java heritage.
  1015.  
  1016. wisqlite
  1017.  
  1018. This is similar to jisql in its functionality, but is written in Tcl/Tk. I am
  1019. not 100% sure of the status, but will update this paragraph when I am. Try Tom
  1020. Poindexter's site for a starting point.
  1021.  
  1022. ntquery
  1023.  
  1024. This is a very lightweight SQL Editor that is someway between Sybase's original
  1025. offering (whose name I have had cleaned from my brain using hypnosis) and SQL
  1026. Advantage. I am not sure who wrote it but it is free, runs on W86 platforms
  1027. only and is available from ftp://ftp.midsomer.org/pub/ntquery.zip
  1028.  
  1029. DWB
  1030.  
  1031. The father of them all. I am not sure if this is officially allowed to
  1032. circulate, but I know some people that still use it and like it. I am
  1033. petitioning Sybase to allow me to make it available. It is only available for
  1034. Sun, or at least the version that I have is Sun only, but it is quite a nice
  1035. tool all the same.
  1036.  
  1037. Back to top
  1038.  
  1039. -------------------------------------------------------------------------------
  1040.  
  1041. 4.4: How do I make isql secure?
  1042.  
  1043. -------------------------------------------------------------------------------
  1044.  
  1045. Isql uses the open/client libraries, which have no built in means of securing
  1046. the packets that I know of. However, it is possible to use ssh to do all of the
  1047. work for you. It is really quite straightforward. I saw this first published on
  1048. the Sybase-L list by Tim Ellis, so all of the credit gos to him.
  1049.  
  1050.  1. You will need a server running sshd that you have access to, which also has
  1051.     access to the ASE server.
  1052.  2. Choose a port that you are going to make your secure connection from. Just
  1053.     like all ASE port selections it is totally arbitrary, but you if you were
  1054.     setting up a number of these, then you might want to think about a
  1055.     strategy. Regular server + 100 or something. Just make sure that it does
  1056.     not, and will not, clash with any of your regular servers.
  1057.  3. Edit the interfaces file on the client side and set up a new server with an
  1058.     IP address of localhost and the port number you chose in the previous
  1059.     point. You might want to call it SERVER_SSH just to make sure that you know
  1060.     that it is the secure one.
  1061.  4. Run the following ssh command:
  1062.     ssh -2 -N -f -L port_chosen_above:remote_server:remote_port
  1063.     user@ssh.server.com
  1064.  5. Connect to the server using isql -Uuser -SSERVER_SSH
  1065.  
  1066. In the ssh line, the -2 means use that version of the protocol (obviously it
  1067. must be supported by your client and server). -f forces the ssh into the
  1068. background. Not supported by version 1 only clients. -N means do not prompt for
  1069. input. Again, this is not supported by version 1 clients.
  1070.  
  1071. The user@ssh.server.com refers to the sshd server that you have access to.
  1072.  
  1073. Let us look at an example. You have a server running ASE on port 4100. (Make
  1074. sure that this port is *not* visible from the outside world, otherwise it is
  1075. wide open to people attacking it directly.) I have not tried all of the ins and
  1076. outs of this, I am happy to take advice, but on this same machine you have a
  1077. copy of sshd running that you can see from the outside world.
  1078.  
  1079. Choose another port that you are going to have as your secure port. Let's call
  1080. it 5100 for the sake of argument. Edit the interfaces file on the client
  1081. machine (which is presumably somewhere in untrusted land, say a client site)
  1082. and add a new server, lets call it MYSERVER_SSH and have it listen on
  1083. localhost,5100.
  1084.  
  1085. Now execute the ssh magic, again from the client machine:
  1086.  
  1087.   ssh -2 -N -f -L 5100:myserver.com:4100 sybase@myserver.com
  1088.  
  1089. Now connect to it using
  1090.  
  1091.   isql -Usa -SMYSERVER_SSH
  1092.  
  1093. and you should get the familiar 1> prompt. All traffic to and from the server
  1094. is going via an SSH tunnel, and so can be considered relatively secure.
  1095.  
  1096. Back to top
  1097.  
  1098. -------------------------------------------------------------------------------
  1099.  
  1100. bcp DBCCs ASE FAQ
  1101.  
  1102.                                       bcp                                      
  1103.                                                                                
  1104.  
  1105.  
  1106.     5.1    How do I bcp null dates?
  1107.     5.2    Can I use a named pipe to bcp/dump data out or in?
  1108.     5.3    How do I exclude a column?
  1109.    
  1110. next prev ASE FAQ
  1111.  
  1112. -------------------------------------------------------------------------------
  1113.  
  1114. 5.1: How do I bcp null dates?
  1115.  
  1116. -------------------------------------------------------------------------------
  1117.  
  1118. As long as there is nothing between the field delimiters in your data, a null
  1119. will be entered. If there's a space, the value will be Jan 1, 1900.
  1120.  
  1121. You can use sed(1) to squeeze blanks out of fields:
  1122.  
  1123. sed -e 's/|[ ]*|/||/g' old_file > new_file 
  1124.  
  1125. Back to top
  1126.  
  1127. -------------------------------------------------------------------------------
  1128.  
  1129. 5.2: Can I use a named pipe to bcp/dump data out or in?
  1130.  
  1131. -------------------------------------------------------------------------------
  1132.  
  1133. System 10 and above.
  1134.  
  1135. If you would like to bcp copy from one table to a named pipe and compress:
  1136.  
  1137.  1. %mknod bcp.pipe p
  1138.  2. %compress sysobjects.Z &
  1139.  3. %bcp master..sysobjects out bcp.pipe -c -U .. > bcp.pipe
  1140.  4. Use ps(1) to determine when the compress finishes.
  1141.  
  1142. To bcp from my1db..dummy_table_1 to my2db..dummy_table_2:
  1143.  
  1144.  1. %mknod bcp.pipe p
  1145.  2. %bcp my2db..dummy_table_2 in bcp.pipe -c -U .. &
  1146.    
  1147.        
  1148.         To avoid confusion between the above bcp and the next, you may choose
  1149.         to either use a separate window or redirect the output to a file.
  1150.        
  1151.  3. %bcp my1db..dummy_table_1 out bcp.pipe -c -U ..
  1152.  
  1153. Back to top
  1154.  
  1155. -------------------------------------------------------------------------------
  1156.  
  1157. 5.3: How do I exclude a column?
  1158.  
  1159. -------------------------------------------------------------------------------
  1160.  
  1161. Open/Client 11.1.1
  1162.  
  1163. Create a view based on the table that you want to exclude a column from and
  1164. then bcp out from the view.
  1165.  
  1166. Open/Client Versions Older Than 11.1.1
  1167.  
  1168. The documentation Utility programs for Unix describes the use of format files,
  1169. including the field Server Column Order. Server Column Order must equal the
  1170. colid of the column, or 0 if the host file field will not be loaded into any
  1171. table column.
  1172.  
  1173. I don't know if anyone has got this feature to work. So, here is another way of
  1174. removing the column. In your example, you want to remove the last column. I am
  1175. going to include another example to remove the second column and include a
  1176. fourth column. Why? Because it is harder. First example will deal with removing
  1177. the last column.
  1178.  
  1179. Removing the Last Column
  1180.  
  1181. Edit your bcpout.fmt file and look for the changes I made below. Using the
  1182. following bcpout.fmt file to dump the data:
  1183.  
  1184. --- bcpout.fmt
  1185. 10.0
  1186. 2 <------------------ Changed number of columns to BCP to two
  1187. 1 SYBINT4 0 4 "<**>" 1 counter
  1188. 2 SYBCHAR 1 512 "\n" 2 text1 <--- Replaced <**> with \n
  1189. 3 SYBCHAR 1 512 "\n" 3 text2 <--- DELETE THIS LINE
  1190.  
  1191. Now recreate the table with the last column removed and use the same bcpout.fmt
  1192. file to BCP back in the data.
  1193.  
  1194. Now let's try removing the second column out four columns on a table.
  1195.  
  1196. Removing the Second out of Four Columns
  1197.  
  1198. Edit the bcpout.fmt file and look for the changes I made below. Using the
  1199. following bcpout.fmt file to dump the data:
  1200.  
  1201. --- bcpout.fmt
  1202. 10.0
  1203. 3 <------------------ Changed number of columns to BCP to three
  1204. 1 SYBINT4 0 4   "<**>" 1 counter
  1205. 2 SYBCHAR 1 512 "<**>" 2 text1 <--- DELETE THIS LINE
  1206. 2 SYBCHAR 1 512 "<**>" 3 text2 <--- Changed number items to 2
  1207. 3 SYBCHAR 1 512 "\n"   4 text3 <--- Changed number items to 3
  1208.  
  1209. Including the Fourth Column
  1210.  
  1211. Now copy the bcpout.fmt to bcpin.fmt, recreate table with col 2 removed, and
  1212. edit bcpin.fmt file:
  1213.  
  1214. --- bcpin.fmt
  1215. 10.0
  1216. 3
  1217. 1 SYBINT4 0 4   "<**>" 1 counter
  1218. 2 SYBCHAR 1 512 "<**>" 2 text2 <-- Changed column id to 2
  1219. 3 SYBCHAR 1 512 "\n"   3 text3 <-- Changed column id to 3
  1220.  
  1221. -------------------------------------------------------------------------------
  1222.  
  1223. Back to top
  1224.  
  1225. next prev ASE FAQ
  1226.  
  1227.