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

  1. Path: senator-bedfellow.mit.edu!dreaderd!not-for-mail
  2. Message-ID: <databases/sybase-faq/part4_1082468590@rtfm.mit.edu>
  3. Supersedes: <databases/sybase-faq/part4_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: 4/19 - ASE Admin (1 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:03 GMT
  18. Lines: 1476
  19. NNTP-Posting-Host: penguin-lust.mit.edu
  20. X-Trace: 1082468703 senator-bedfellow.mit.edu 562 18.181.0.29
  21. Xref: senator-bedfellow.mit.edu comp.databases.sybase:106202 comp.answers:56948 news.answers:270288
  22.  
  23. Archive-name: databases/sybase-faq/part4
  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.                        Sybase Frequently Asked Questions                       
  31.  
  32.                                                                                
  33. Sybase FAQ Home PageAdaptive Server Enterprise FAQAdaptive Server Anywhere FAQ 
  34.                           Repserver FAQSearch the FAQ                          
  35.                                      [bar]                                     
  36.  
  37.                           Adaptive Server Enterprise                           
  38.                                                                                
  39.  
  40.  
  41.         0.    What's in a name?
  42.         1.    ASE Administration
  43.                1.1    Basic Administration
  44.                1.2    User Database Administration
  45.                1.3    Advanced Administration
  46.                1.4    General Troubleshooting
  47.                1.5    Performance and Tuning
  48.                1.6    Server Monitoring
  49.         2.    Platform Specific Issues
  50.                2.1    Solaris
  51.                2.2    NT
  52.                2.3    Linux
  53.         3.    DBCC's
  54.         4.    isql
  55.         5.    bcp
  56.         6.    SQL Development
  57.                6.1    SQL Fundamentals
  58.                6.2    SQL Advanced
  59.                6.3    Useful SQL Tricks
  60.         7.    Open Client
  61.         9.    Freeware
  62.         10.  Sybase Technical News
  63.         11.  Additional Information
  64.         12.  Miscellany
  65.        
  66.  
  67.  
  68. -------------------------------------------------------------------------------
  69.  
  70.                                What's in a name?                               
  71.                                                                                
  72. Throughout this FAQ you will find references to SQL Server and, starting with
  73. this release, ASE or Adaptive Server Enterprise to give it its full name.  You
  74. might also be a little further confused, since Microsoft also seem to have a
  75. product called SQL Server. 
  76.  
  77. Well, back at about release 4.2 of Sybase SQL Server, the products were exactly
  78. the same.  Microsoft were to do the port to NT.  Well, it is pretty well
  79. documented, but there was a falling out.  Both companies kept the same name for
  80. their data servers and confusion began to reign.  In an attempt to try and sort
  81. this out, Sybase renamed their product Adaptive Server Enterprise (ASE)
  82. starting with version 11.5.
  83.  
  84. I found this quote in a Sybase manual the other day:
  85.  
  86. Since changing the name of Sybase SQL Server to Adaptive Server Enterprise,
  87. Sybase uses the names Adaptive Server and Adaptive Server Enterprise to refer
  88. collectively to all supported versions of the Sybase SQL Server and Adaptive
  89. Server Enterprise. Version-specific references to Adaptive Server or SQL Server
  90. include version numbers.
  91.  
  92. I will endeavour to try and do the same within the FAQ, but the job is far from
  93. complete!
  94.  
  95. Back to Top
  96.  
  97.                            Basic ASE Administration                            
  98.                                                                                
  99.  
  100.  
  101.     1.1.1    What is SQL Server and ASE anyway?
  102.     1.1.2    How do I start/stop ASE when the CPU reboots?
  103.     1.1.3    How do I move tempdb off of the master device?
  104.     1.1.4    How do I correct timeslice -201?
  105.     1.1.5    The how's and why's on becoming Certified.
  106.     1.1.6    RAID and Sybase
  107.     1.1.7    How to swap a db device with another
  108.     1.1.8    Server naming and renaming
  109.     1.1.9    How do I interpret the tli strings in the interface file?
  110.     1.1.10  How can I tell the datetime my Server started?
  111.     1.1.11  Raw partitions or regular files?
  112.     1.1.12  Is Sybase Y2K (Y2000) compliant?
  113.     1.1.13  How can I run the ASE upgrade manually?
  114.     1.1.14  We have lost the sa password, what can we do?
  115.     1.1.15  How do I set a password to be null?
  116.     1.1.16  Does Sybase support Row Level Locking?
  117.     1.1.17  What platforms does ASE run on?
  118.     1.1.18  How do I backup databases > 64G on ASE prior to 12.x?
  119.    
  120. User Database Administration # ASE FAQ
  121.  
  122. -------------------------------------------------------------------------------
  123.  
  124. 1.1.1: What is SQL Server and ASE?
  125.  
  126. -------------------------------------------------------------------------------
  127.  
  128. Overview
  129.  
  130. Before Sybase System 10 (as they call it) we had Sybase 4.x. Sybase System 10
  131. has some significant improvements over Sybase 4.x product line. Namely:
  132.  
  133.   * the ability to allocate more memory to the dataserver without degrading its
  134.     performance.
  135.   * the ability to have more than one database engine to take advantage of
  136.     multi-processor cpu machines.
  137.   * a minimally intrusive process to perform database and transaction dumps.
  138.  
  139. Background and More Terminology
  140.  
  141. A ASE (SQL Server) is simply a Unix process. It is also known as the database
  142. engine. It has multiple threads to handle asynchronous I/O and other tasks. The
  143. number of threads spawned is the number of engines (more on this in a second)
  144. times five. This is the current implementation of Sybase System 10, 10.0.1 and
  145. 10.0.2 on IRIX 5.3.
  146.  
  147. Each ASE allocates the following resources from a host machine:
  148.  
  149.   * memory and
  150.   * raw partition space.
  151.  
  152. Each ASE can have up to 255 databases. In most implementations the number of
  153. databases is limited to what seems reasonable based on the load on the ASE.
  154. That is, it would be impractical to house all of a large company's databases
  155. under one ASE because the ASE (a Unix process) will become overloaded.
  156.  
  157. That's where the DBAs experience comes in with interrogation of the user
  158. community to determine how much activity is going to result on a given database
  159. or databases and from that we determine whether to create a new ASE or to house
  160. the new database under an existing ASE. We do make mistakes (and businesses
  161. grow) and have to move databases from one ASE to another. At times ASEs need to
  162. move from one CPU server to another.
  163.  
  164. With Sybase System 10, each ASE can be configured to have more than one engine
  165. (each engine is again a Unix process). There's one primary engine that is the
  166. master engine and the rest of the engines are subordinates. They are assigned
  167. tasks by the master.
  168.  
  169. Interprocess communication among all these engines is accomplished with shared
  170. memory.
  171.  
  172.     Some times when a DBA issues a Unix kill command to extinguish a maverick
  173.     ASE, the subordinate engines are forgotten. This leaves the shared memory
  174.     allocated and eventually we may get in to situations where swapping occurs
  175.     because this memory is locked. To find engines that belong to no master
  176.     ASE, simple look for engines owned by /etc/init (process id 1). These
  177.     engines can be killed -- this is just FYI and is a DBA duty.
  178.    
  179. Before presenting an example of a ASE, some other topics should be covered.
  180.  
  181. Connections
  182.  
  183. An ASE has connections to it. A connection can be viewed as a user login but
  184. it's not necessarily so. That is, a client (a user) can spark up multiple
  185. instances of their application and each client establishes its own connection
  186. to the ASE. Some clients may require two or more per invocation. So typically
  187. DBA's are only concerned with the number of connections because the number of
  188. users typically does not provide sufficient information for us to do our job.
  189.  
  190.     Connections take up ASE resources, namely memory, leaving less memory for
  191.     the ASEs' available cache.
  192.    
  193. ASE Buffer Cache
  194.  
  195. In Sybase 4.0.1 there was a limit to the amount of memory that could be
  196. allocated to a ASE. It was around 80MB, with 40MB being the typical max. This
  197. was due to internal implementations of Sybase's data structures.
  198.  
  199. With Sybase System 10 there really was no limit. For instance, we had an ASE
  200. cranked up to 300MB under 10. With System 11 and 12 this has been further
  201. extended. ASE's with 4G bytes of memory are not uncommon. I have not heard of
  202. an 11.9.3 or a 12 server with more that 4G bytes, but I am sure that they are
  203. not far away.
  204.  
  205. The memory in an ASE is primarily used to cache data pages from disk. Consider
  206. that the ASE is a light weight Operating System: handling user (connections),
  207. allocating memory to users, keeping track of which data pages need to be
  208. flushed to disk and the sort. Very sophisticated and complex. Obviously if a
  209. data page is found in memory it's much faster to retrieve than going out to
  210. disk.
  211.  
  212. Each connection takes away a little bit from the available memory that is used
  213. to cache disk pages. Upon startup, the ASE pre-allocates the memory that is
  214. needed for each connection so it's not prudent to configure 500 connections
  215. when only 300 are needed. We'd waste 200 connections and the memory associated
  216. with that. On the other hand, it is also imprudent to under configure the
  217. number of connections; users have a way of soaking up a resource (like an ASE)
  218. and if users have all the connections a DBA cannot get into the server to
  219. allocate more connections.
  220.  
  221. One of the neat things about an ASE is that it reaches (just like a Unix
  222. process) a working set. That is, upon startup it'll do a lot of physical I/O's
  223. to seed its cache, to get lookup information for typical transactions and the
  224. like. So initially, the first users have heavy hits because their requests have
  225. to be performed as a physical I/O. Subsequent transactions have less physical I
  226. /O and more logical I/O's. Logical I/O is an I/O that is satisfied in the ASEs'
  227. buffer cache. Obviously, this is the preferred condition.
  228.  
  229. DSS vs OLTP
  230.  
  231. We throw around terms like everyone is supposed to know this high tech lingo.
  232. The problem is that they are two different animals that require a ASE to be
  233. tuned accordingly for each.
  234.  
  235. Well, here's the low down.
  236.  
  237. DSS
  238.     Decision Support System
  239. OLTP
  240.     Online Transaction Processing
  241.  
  242. What do these mean? OLTP applications are those that have very short orders of
  243. work for each connection: fetch this row and with the results of it update one
  244. or two other rows. Basically, small number of rows affected per transaction in
  245. rapid sucession, with no significant wait times between operations in a
  246. transaction.
  247.  
  248. DSS is the lumbering elephant in the database world (unless you do some
  249. tricks... out of this scope). DSS requires a user to comb through gobs of data
  250. to aggregate some values. So the transactions typically involve thousands of
  251. rows. Big difference than OLTP.
  252.  
  253. We never want to have DSS and OLTP on the same ASE because the nature of OLTP
  254. is to grab things quickly but the nature of DSS is to stick around for a long
  255. time reading tons of information and summarizing the results.
  256.  
  257. What a DSS application does is flush out the ASE's data page cache because of
  258. the tremendous amount of I/O's. This is obviously very bad for OTLP
  259. applications because the small transactions are now hurt by this trauma. When
  260. it was only OLTP a great percentage of I/O was logical (satisfied in the
  261. cache); now transactions must perform physical I/O.
  262.  
  263. That's why it's good not to mix DSS and OLTP if at all possible.
  264.  
  265. If mixing them cannot be avoided, then you need to think carefully about how
  266. you configure your server. Use named data caches to ensure that the very
  267. different natures of OLTP and DSS do not conflict with each other. If you
  268. tables that are shared, consider using dirty reads for the DSS applications if
  269. at all possible, since this will help not to block the OLTP side.
  270.  
  271. Asynchronous I/O
  272.  
  273. Why async I/O? The idea is that in a typical online transaction processing
  274. (OLTP) application, you have many connections (over 200 connections) and short
  275. transactions: get this row, update that row. These transactions are typically
  276. spread across different tables of the databases. The ASE can then perform each
  277. one of these asynchronously without having to wait for others to finish. Hence
  278. the importance of having async I/O fixed on our platform.
  279.  
  280. Engines
  281.  
  282. Sybase System 10 can have more than one engine (as stated above). Sybase has
  283. trace flags to pin the engines to a given CPU processor but we typically don't
  284. do this. It appears that the master engine goes to processor 0 and subsequent
  285. subordinates to the next processor.
  286.  
  287. Currently, Sybase does not scale linearly. That is, five engines do not make
  288. Sybase perform five times as fast however we do max out with four engines.
  289. After that performance starts to degrade. This is supposed to be fixed with
  290. Sybase System 11.
  291.  
  292. Putting Everything Together
  293.  
  294. As previously mentioned, an ASE is a collection of databases with connections
  295. (that are the users) to apply and retrieve information to and from these
  296. containers of information (databases).
  297.  
  298. The ASE is built and its master device is typically built over a medium sized
  299. (50MB) raw partition. The tempdb is built over a cooked (regular - as opposed
  300. to a raw device) file system to realize any performance gains by buffered
  301. writes. The databases themselves are built over the raw logical devices to
  302. ensure their integrity. (Note: in System 12 you can use the dsync flag to
  303. ensure that writes to file system devices are secure.
  304.  
  305. Physical and Logical Devices
  306.  
  307. Sybase likes to live in its own little world. This shields the DBA from the
  308. outside world known as Unix, VMS or NT. However, it needs to have a conduit to
  309. the outside world and this is accomplished via devices.
  310.  
  311. All physical devices are mapped to logical devices. That is, given a physical
  312. device (such as /lv1/dumps/tempdb_01.efs or /dev/rdsk/dks1ds0) it is mapped by
  313. the DBA to a logical device. Depending on the type of the device, it is
  314. allocated, by the DBA, to the appropriate place (vague enough?).
  315.  
  316. Okay, let's try and clear this up...
  317.  
  318. Dump Device
  319.  
  320. The DBA may decide to create a device for dumping the database nightly. The DBA
  321. needs to create a dump device.
  322.  
  323. We'll call that logically in the database datadump_for_my_db but we'll map it
  324. to the physical world as /lv1/dumps/in_your_eye.dat So the DBA will write a
  325. script that connects to the ASE and issues a command like this:
  326.  
  327.      dump database my_stinking_db to datadump_for_my_db
  328.      go
  329.  
  330. and the backupserver (out of this scope) takes the contents of my_stinking_db
  331. and writes it out to the disk file /lv1/dumps/in_your_eye.dat
  332.  
  333. That's a dump device. The thing is that it's not preallocated. This special
  334. device is simply a window to the operating system.
  335.  
  336. Data and Log Devices
  337.  
  338. Ah, now we are getting into the world of pre-allocation. Databases are built
  339. over raw partitions. The reason for this is because Sybase needs to be
  340. guaranteed that all its writes complete successfully. Otherwise, if it posted
  341. to a file system buffer (as in a cooked file system) and the machine crashed,
  342. as far as Sybase is concerned the write was committed. It was not, however, and
  343. integrity of the database was lost. That is why Sybase needs raw partitions.
  344. But back to the matter at hand...
  345.  
  346. When building a new ASE, the DBA determines how much space they'll need for all
  347. the databases that will be housed in this ASE.
  348.  
  349. Each production database is composed of data and log.
  350.  
  351. The data is where the actual information resides. The log is where the changes
  352. are kept. That is, every row that is updated/deleted/inserted gets placed into
  353. the log portion then applied to the data portion of the database.
  354.  
  355.     That's why DBA strives to place the raw devices for logs on separate disks
  356.     because everything has to single thread through the log.
  357.    
  358. A transaction is a collection of SQL statements (insert/delete/update) that are
  359. grouped together to form a single unit of work. Typically they map very closely
  360. to the business.
  361.  
  362. I'll quote the Sybase ASE Administration Guide on the role of the log:
  363.  
  364.     The transaction log is a write-ahead log. When a user issues a statement
  365.     that would modify the database, ASE automatically writes the changes to the
  366.     log. After all changes for a statement have been recorded in the log, they
  367.     are written to an in-cache copy of the data page. The data page remains in
  368.     cache until the memory is needed for another database page. At that time,
  369.     it is written to disk. If any statement in a transaction fails to complete,
  370.     ASE reverses all changes made by the transaction. ASE writes an "end
  371.     transaction" record to the log at the end of each transaction, recording
  372.     the status (success or failure) of the transaction
  373.    
  374. As such, the log will grow as user connections affect changes to the database.
  375. The need arises to then clear out the log of all transactions that have been
  376. flushed to disk. This is performed by issuing the following command:
  377.  
  378.      dump transaction my_stinking_db to logdump_for_my_db
  379.      go 
  380.  
  381. The ASE will write to the dumpdevice all transactions that have been committed
  382. to disk and will delete the entries from its copy, thus freeing up space in the
  383. log. Dumping of the transaction logs is accomplished via cron (the Unix
  384. scheduler, NT users would have to resort to at or some third party tool) . We
  385. schedule the heavily hit databases every 20 minutes during peak times.
  386.  
  387.     A single user can fill up the log by having begin transaction with no
  388.     corresponding commit/rollback transaction. This is because all their
  389.     changes are being applied to the log as an open-ended transaction, which is
  390.     never closed. This open-ended transaction cannot be flushed from the log,
  391.     and therefore grows until it occupies all of the free space on the log
  392.     device.
  393.    
  394. And the way we dump it is with a dump device. :-)
  395.  
  396. An Example
  397.  
  398. If the DBA has four databases to plop on this ASE and they need a total of
  399. 800MB of data and 100MB of log (because that's what really matters to us), then
  400. they'd probably do something like this:
  401.  
  402.  1. allocate sufficient raw devices to cover the data portion of all the
  403.     databases
  404.  2. allocate sufficient raw devices to cover the log portion of all the
  405.     databases
  406.  3. start allocating the databases to the devices.
  407.  
  408. For example, assuming the following database requirements:
  409.  
  410.      Database      
  411.    Requirements    
  412.                               +-----------------+                              
  413.                               |    |      |     |                              
  414.                               |----+------+-----|                              
  415.                               | DB | Data | Log |                              
  416.                               |----+------+-----|                              
  417.                               |----+------+-----|                              
  418.                               | a  | 300  | 30  |                              
  419.                               |----+------+-----|                              
  420.                               | b  | 400  | 40  |                              
  421.                               |----+------+-----|                              
  422.                               | c  | 100  | 10  |                              
  423.                               +-----------------+                              
  424.  
  425.                           and the following devices:                           
  426.  
  427.               Devices              
  428.                       +---------------------------------+                      
  429.                       |    Logical    | Physical | Size |                      
  430.                       |---------------+----------+------|                      
  431.                       |               | /dev/    |      |                      
  432.                       | dks3d1s2_data | rdsk/    | 500  |                      
  433.                       |               | dks3d1s2 |      |                      
  434.                       |---------------+----------+------|                      
  435.                       |               | /dev/    |      |                      
  436.                       | dks4d1s2_data | rdsk/    | 500  |                      
  437.                       |               | dks4d1s2 |      |                      
  438.                       |---------------+----------+------|                      
  439.                       |               | /dev/    |      |                      
  440.                       | dks5d1s0_log  | rdsk/    | 200  |                      
  441.                       |               | dks5d1s0 |      |                      
  442.                       +---------------------------------+                      
  443.  
  444. then the DBA may elect to create the databases as follows:
  445.  
  446.       create database a on dks3d1s2_data = 300 log on dks5d1s0_log = 30
  447.       create database b on dks4d1s2_data = 400 log on dks5d1s0_log = 40
  448.       create database c on dks3d1s2_data = 50, dks4d1s2_data = 50 log on dks5d1s0_log = 10
  449.  
  450. Some of the devices will have extra space available because out database
  451. allocations didn't use up all the space. That's fine because it can be used for
  452. future growth. While the Sybase ASE is running, no other Sybase ASE can
  453. re-allocate these physical devices.
  454.  
  455. TempDB
  456.  
  457. TempDB is simply a scratch pad database. It gets recreated when a SQL Server is
  458. rebooted. The information held in this database is temporary data. A query may
  459. build a temporary table to assist it; the Sybase optimizer may decide to create
  460. a temporary table to assist itself.
  461.  
  462. Since this is an area of constant activity we create this database over a
  463. cooked file system which has historically proven to have better performance
  464. than raw - due to the buffered writes provided by the Operating System.
  465.  
  466. Port Numbers
  467.  
  468. When creating a new ASE, we allocate a port to it (currently, DBA reserves
  469. ports 1500 through 1899 for its use). We then map a host name to the different
  470. ports: hera, fddi-hera and so forth. We can actually have more than one port
  471. number for an ASE but we typically don't do this.
  472.  
  473. Back to top
  474.  
  475. -------------------------------------------------------------------------------
  476.  
  477. 1.1.2: How to start/stop ASE when CPU reboots
  478.  
  479. -------------------------------------------------------------------------------
  480.  
  481. Below is an example of the various files (on Irix) that are needed to start/
  482. stop an ASE. The information can easily be extended to any UNIX platform.
  483.  
  484. The idea is to allow as much flexibility to the two classes of administrators
  485. who manage the machine:
  486.  
  487.   * The System Administrator
  488.   * The Database Administrator
  489.  
  490. Any errors introduced by the DBA will not interfere with the System
  491. Administrator's job.
  492.  
  493. With that in mind we have the system startup/shutdown file /etc/init.d/sybase
  494. invoking a script defined by the DBA: /usr/sybase/sys.config/
  495. {start,stop}.sybase
  496.  
  497. /etc/init.d/sybase
  498.  
  499. On some operating systems this file must be linked to a corresponding entry in
  500. /etc/rc.0 and /etc/rc.2 -- see rc0(1M) and rc2(1M)
  501.  
  502. #!/bin/sh
  503. # last modified:  10/17/95, sr.
  504. #
  505. # Make symbolic links so this file will be called during system stop/start.
  506. # ln -s /etc/init.d/sybase /etc/rc0.d/K19sybase
  507. # ln -s /etc/init.d/sybase /etc/rc2.d/S99sybase
  508. # chkconfig -f sybase on
  509.  
  510. # Sybase System-wide configuration files
  511. CONFIG=/usr/sybase/sys.config
  512.  
  513. if $IS_ON verbose ; then        # For a verbose startup and shutdown
  514.         ECHO=echo
  515.         VERBOSE=-v
  516. else                            # For a quiet startup and shutdown
  517.         ECHO=:
  518.         VERBOSE=
  519. fi
  520.  
  521. case "$1" in
  522. 'start')
  523.         if $IS_ON sybase; then
  524.                 if [ -x $CONFIG/start.sybase ]; then
  525.                    $ECHO "starting Sybase servers"
  526.                    /bin/su - sybase -c "$CONFIG/start.sybase $VERBOSE &"
  527.                 else
  528.                    <error condition>
  529.                 fi
  530.         fi
  531.         ;;
  532.  
  533. 'stop')
  534.         if $IS_ON sybase; then
  535.                 if [ -x $CONFIG/stop.sybase ]; then
  536.                    $ECHO "stopping Sybase servers"
  537.                    /bin/su - sybase -c "$CONFIG/stop.sybase $VERBOSE &"
  538.                 else
  539.                    <error condition>
  540.                 fi
  541.         fi
  542.         ;;
  543.  
  544. *)
  545.         echo "usage: $0 {start|stop}"
  546.         ;;
  547. esac
  548.  
  549. /usr/sybase/sys.config/{start,stop}.sybase
  550.  
  551. start.sybase
  552.  
  553. #!/bin/sh -a
  554. #
  555. # Script to start sybase
  556. #
  557. # NOTE: different versions of sybase exist under /usr/sybase/{version}
  558. #
  559. # Determine if we need to spew our output
  560. if [ "$1" != "spew" ] ; then
  561.     OUTPUT=">/dev/null 2>&1"
  562. else
  563.     OUTPUT=""
  564. fi
  565. # 10.0.2 servers
  566. HOME=/usr/sybase/10.0.2
  567. cd $HOME
  568. # Start the backup server
  569. eval install/startserver -f install/RUN_BU_KEPLER_1002_52_01 $OUTPUT
  570. # Start the dataservers
  571. # Wait two seconds between starts to minimize trauma to CPU server
  572. eval install/startserver -f install/RUN_FAC_WWOPR $OUTPUT
  573. sleep 2
  574. eval install/startserver -f install/RUN_MAG_LOAD $OUTPUT
  575. exit 0
  576.  
  577. stop.sybase
  578.  
  579. #!/bin/sh
  580. #
  581. # Script to stop sybase
  582. #
  583. # Determine if we need to spew our output
  584. if [ -z "$1" ] ; then
  585.     OUTPUT=">/dev/null 2>&1"
  586. else
  587.     OUTPUT="-v"
  588. fi
  589. eval killall -15 $OUTPUT dataserver backupserver sybmultbuf
  590. sleep 2
  591. # if they didn't die, kill 'em now...
  592. eval killall -9 $OUTPUT dataserver backupserver sybmultbuf
  593. exit 0 
  594.  
  595. If your platform doesn't support killall, it can easily be simulated as
  596. follows:
  597.  
  598. #!/bin/sh
  599. #
  600. # Simple killall simulation...
  601. # $1 = signal
  602. # $2 = process_name
  603. #
  604. #
  605. # no error checking but assume first parameter is signal...
  606. # what ya want for free? :-)
  607. #
  608. kill -$1 `ps -ef | fgrep $2 | fgrep -v fgrep | awk '{ print $1 }'` 
  609.  
  610. Back to top
  611.  
  612. -------------------------------------------------------------------------------
  613.  
  614. 1.1.3: How do I move tempdb off of the Master Device?
  615.  
  616. -------------------------------------------------------------------------------
  617.  
  618. There used to be a section in the FAQ describing how to drop all of tempdb's
  619. devices physically from the master device.  This can make recovery of the
  620. server impossible in case of a serious error and so it strongly recommended
  621. that you do not do this but simply drop the segments as outlined below.
  622.  
  623. Sybase TS Preferred Method of Moving tempdb off the Master Device.
  624.  
  625. This is the Sybase TS method of removing most activity from the master device:
  626.  
  627.  1. Alter tempdb on another device:
  628.      1> alter database tempdb on ...
  629.      2> go
  630.  2. Use the tempdb:
  631.      1> use tempdb
  632.      2> go
  633.  3. Drop the segments:
  634.      1> sp_dropsegment "default", tempdb, master
  635.      2> go
  636.      1> sp_dropsegment "logsegment", tempdb, master
  637.      2> go
  638.      1> sp_dropsegment "system", tempdb, master
  639.      2> go
  640.  
  641.     Note that there is still some activity on the master device. On a three
  642.     connection test that I ran:
  643.    
  644.        while ( 1 = 1 )
  645.        begin
  646.           create table #x (col_a int)
  647.           drop table #x
  648.        end
  649.    
  650.     there was one write per second. Not bad.
  651.    
  652. An Alternative
  653.  
  654.     (I recently did some bench marks comparing this method, the previous method
  655.     and a combination of both.  According to sp_sysmon there was no difference
  656.     in activity at all.  I leave it here just in case it proves useful to
  657.     someone.)
  658.    
  659. The idea of this handy script is to simply fill the first 2MB of tempdb thus
  660. effectively blocking anyone else from using it. The slight gotcha with this
  661. script, since we're using model, is that all subsequent database creates will
  662. also have tempdb_filler installed. This is easily remedied by dropping the
  663. table after creating a new database.
  664.  
  665. This script works because tempdb is rebuilt every time the ASE is rebooted.
  666. Very nice trick!
  667.  
  668. /* this isql script creates a table in the model database. */
  669. /* Since tempdb is created from the model database when the    */
  670. /* server is started, this effectively moves the active        */
  671. /* portion of tempdb off of the master device.                 */
  672.  
  673. use model
  674. go
  675.  
  676. /* note: 2k row size */
  677. create table tempdb_filler(
  678. a char(255) not null,
  679. b char(255) not null,
  680. c char(255) not null,
  681. d char(255) not null,
  682. e char(255) not null
  683. )
  684. go
  685.  
  686. /* insert 1024 rows */
  687. declare @i int
  688. select @i = 1
  689. while (@i <= 1024)
  690. begin
  691.    insert into tempdb_filler values('a','b','c','d','e')
  692.    if (@i % 100 = 0) /* dump the transaction every 100 rows */
  693.       dump tran model with truncate_only
  694.    select @i=@i+1
  695. end
  696. go
  697.  
  698. Back to top
  699.  
  700. -------------------------------------------------------------------------------
  701.  
  702. 1.1.4: How do I correct timeslice -201
  703.  
  704. -------------------------------------------------------------------------------
  705.  
  706. (Note, this procedure is only really necessary with pre-11.x systems.  In
  707. system 11 systems, these parameters are tunable using sp_configure.)
  708.  
  709. Why Increase It?
  710.  
  711. Basically, it will allow a task to be scheduled onto the CPU for a longer time.
  712. Each task on the system is scheduled onto the CPU for a fixed period of time,
  713. called the timeslice, during which it does some work, which is resumed when its
  714. next turn comes around.
  715.  
  716. The process has up until the value of ctimemax (a config block variable) to
  717. finish its task. As the task is working away, the scheduler counts down
  718. ctimemax units. When it gets to the value of ctimemax - 1, if it gets stuck and
  719. for some reason cannot be taken off the CPU, then a timeslice error gets
  720. generated and the process gets infected.
  721.  
  722. On the other hand, ASE will allow a server process to run as long as it needs
  723. to. It will not swap the process out for another process to run. The process
  724. will decide when it is "done" with the server CPU. If, however, a process goes
  725. on and on and never relinquishes the server CPU, then Server will timeslice the
  726. process.
  727.  
  728. Potential Fix
  729.  
  730.  1. Shutdown the ASE
  731.  2. %buildmaster -dyour_device -yctimemax=2000
  732.  3. Restart your ASE. If the problem persists contact Sybase Technical Support
  733.     notifying them what you have done already.
  734.  
  735. Back to top
  736.  
  737. -------------------------------------------------------------------------------
  738.  
  739. 1.1.5: Certified Sybase Professional
  740.  
  741. -------------------------------------------------------------------------------
  742.  
  743. There have been changes in the process of becoming a Sybase Certified
  744. Professional. There's a very informative link at http://www.sybase.com/
  745. education/profcert, Professional Certification.
  746.  
  747. Rob Verschoor has put together some good stuff on his pages ( http://
  748. www.euronet.nl/~syp_rob/certtips.html) that have pretty much all that you need
  749. to know. He also has a quiz which is intended to test each and everyone's
  750. knowledge of ASE and RepServer.
  751.  
  752. Sybase have released some sample questions (look for them at http://
  753. www.sybase.com/education/). The GUI requires MS Windows (at the time of
  754. writing), but they are definitely a sample of what you will be asked. There are
  755. also a couple of CDs available with yet more questions on them.
  756.  
  757. The Certification Kickback
  758.  
  759. There have been a couple of articles recently covering the kickback that seems
  760. to be happening as far as certification is concerned. Serveral HR people have
  761. said that if a person's CV (resume) is sent in covered in certifications then
  762. it goes straight into the bit bucket. I do not know if this is true or not, but
  763. one thing that you might wish to consider is the preparation of two CVs, one
  764. with certifications, one without. If the job request specifies certification is
  765. necessary, then send in the appropriate CV. If it does not specifiy
  766. certification, send in the clean version. If you go into the interview for a
  767. job that did not specify certifications up front and the interviewer starts
  768. going about you not being certificated, you simply produce your card as proof.
  769.  
  770. -------------------------------------------------------------------------------
  771.  
  772.  
  773.  
  774. 1.1.6: RAID and Sybase
  775.  
  776. -------------------------------------------------------------------------------
  777.  
  778. Here's a short summary of what you need to know about Sybase and RAID.
  779.  
  780. The newsgroup comp.arch.storage has a detailed FAQ on RAID, but here are a few
  781. definitions:
  782.  
  783. RAID
  784.  
  785. RAID means several things at once. It provides increased performance through
  786. disk striping, and/or resistance to hardware failure through either mirroring
  787. (fast) or parity (slower but cheaper).
  788.  
  789. RAID 0
  790.  
  791. RAID 0 is just striping. It allows you to read and write quickly, but provides
  792. no protection against failure.
  793.  
  794. RAID 1
  795.  
  796. RAID 1 is just mirroring. It protects you against failure, and generally reads
  797. and writes as fast as a normal disk. It uses twice as many disks as normal (and
  798. sends twice as much data across your SCSI bus, but most machines have plenty of
  799. extra capacity on their SCSI busses.)
  800.  
  801.     Sybase mirroring always reads from the primary copy, so it does not
  802.     increase read performance.
  803.    
  804. RAID 0+1
  805.  
  806. RAID 0+1 (also called RAID 10) is striping and mirroring together. This gives
  807. you the highest read and write performance of any of the raid options, but uses
  808. twice as many disks as normal.
  809.  
  810. RAID 4/RAID 5
  811.  
  812. RAID 4 and 5 have disk striping and use 1 extra disk to provide parity. Various
  813. vendors have various optimizations, but this RAID level is generally much
  814. slower at writes than any other kind of RAID.
  815.  
  816. RAID 7
  817.  
  818. I am not sure if this is a genuine RAID standard, further checking on your part
  819. is required.
  820.  
  821. Details
  822.  
  823. Most hardware RAID controllers also provide a battery-backed RAM cache for
  824. writing. This is very useful, because it allows the disk to claim that the
  825. write succeeded before it has done anything. If there is a power failure, the
  826. information will (hopefully) be written to disk when the power is restored. The
  827. cache is very important because database log writes cause the process doing the
  828. writes to stop until the write is successful. Systems with write caching thus
  829. complete transactions much more quickly than systems without.
  830.  
  831. What RAID levels should my data, log, etc be on? Well, the log disk is 
  832. frequently written, so it should not be on RAID 4 or 5. If your data is 
  833. infrequently written, you could use RAID 4 or 5 for it, because you don't mind
  834. that writes are slow. If your data is frequently written, you should use RAID
  835. 0+1 for it. Striping your data is a very effective way of avoiding any one disk
  836. becoming a hot-spot. Traditionally Sybase databases were divided among devices
  837. by a human attempting to determine where the hot-spots are. Striping does this
  838. in a straight-forward fashion, and also continues to work if your data access
  839. patterns change.
  840.  
  841. Your tempdb is data but it is frequently written, so it should not be on RAID 4
  842. or 5.
  843.  
  844. If your RAID controller does not allow you to create several different kinds of
  845. RAID volumes on it, then your only hope is to create a huge RAID 0+1 set. If
  846. your RAID controller does not support RAID 0+1, you shouldn't be using it for
  847. database work.
  848.  
  849. Back to top
  850.  
  851. -------------------------------------------------------------------------------
  852.  
  853. 1.1.7: How to swap a db device with another
  854.  
  855. -------------------------------------------------------------------------------
  856.  
  857. Here are four approaches. Before attempting any of the following: Backup,
  858. Backup, Backup.
  859.  
  860. Dump and Restore
  861.  
  862.  1. Backup the databases on the device, drop the databases, drop the devices.
  863.  2. Rebuild the new devices.
  864.  3. Rebuild the databases (Make sure you recreate the fragments correctly - See
  865.     Ed Barlow's scripts (http://www.tiac.net/users/sqltech/) for an sp that
  866.     helps you do this if you've lost your notes. Failure to do this will
  867.     possibly lead to data on log segments and log on data segments).
  868.  4. Reload the database dumps!
  869.  
  870. Twiddle the Data Dictionary - for brave experts only.
  871.  
  872.  1. Shut down the server.
  873.  2. Do a physical dump (using dd(1), or such utility) of the device to be
  874.     moved.
  875.  3. Load the dump to the new device
  876.  4. Edit the data dictionary (sysdevices.physname) to point to the new device.
  877.  
  878. The Mirror Trick
  879.  
  880.  1. Create a mirror of the old device, on the new device.
  881.  2. Unmirror the primary device, thereby making the _backup_ the primary
  882.     device.
  883.  3. Repeat this for all devices until the old disk is free.
  884.  
  885. dd (Unix only)
  886.  
  887. (This option is no use if you need to move a device now, rather if you
  888. anticipate moving a device at some point in the future.)
  889.  
  890. You may want to use this approach for creating any database.
  891.  
  892. Create (or use) a directory for symbolic links to the devices you wish to use.
  893. Then create your database, but instead of going to /dev/device, go to /
  894. directory/symlink - When it comes time to move your devices, you shut down the
  895. server, simply dd(1) the data from the old device to the new device, recreate
  896. the symbolic links to the new device and restart the ASE. Simple as that.
  897.  
  898. Backups are a requisite in all cases, just in case.
  899.  
  900. Back to top
  901.  
  902. -------------------------------------------------------------------------------
  903.  
  904. 1.1.8: Server naming and renaming
  905.  
  906. -------------------------------------------------------------------------------
  907.  
  908. There are three totally separate places where ASE names reside, causing much
  909. confusion.
  910.  
  911. ASE Host Machine interfaces File
  912.  
  913. A master entry in here for server TEST will provide the network information
  914. that the server is expected to listen on. The -S parameter to the dataserver
  915. executable tells the server which entry to look for, so in the RUN_TEST file,
  916. -STEST will tell the dataserver to look for the entry under TEST in the
  917. interfaces file and listen on any network parameters specified by 'master'
  918. entries.
  919.  
  920. TEST
  921.         master tcp ether hpsrv1 1200
  922.         query tcp ether hpsrv1 1200
  923.  
  924.    
  925.     Note that preceding the master/query entries there's a tab.
  926.    
  927. This is as far as the name TEST is used. Without further configuration the
  928. server does not know its name is TEST, nor do any client applications.
  929. Typically there will also be query entries under TEST in the local interfaces
  930. file, and client programs running on the same machine as the server will pick
  931. this connection information up. However, there is nothing to stop the query
  932. entry being duplicated under another name entirely in the same interfaces file.
  933.  
  934. ARTHUR
  935.         query tcp ether hpsrv1 1200
  936.  
  937. isql -STEST or isql -SARTHUR will connect to the same server. The name is
  938. simply a search parameter into the interfaces file.
  939.  
  940. Client Machine interfaces File
  941.  
  942. Again, as the server name specified to the client is simply a search parameter
  943. for Open Client into the interfaces file, SQL.INI or WIN.INI the name is
  944. largely irrelevant. It is often set to something that means something to the
  945. users, especially where they might have a choice of servers to connect to. Also
  946. multiple query entries can be set to point to the same server, possibly using
  947. different network protocols. eg. if TEST has the following master entries on
  948. the host machine:
  949.  
  950. TEST
  951.        master tli spx /dev/nspx/ \xC12082580000000000012110
  952.        master tcp ether hpsrv1 1200
  953.  
  954. Then the client can have a meaningful name:
  955.  
  956. ACCOUNTS_TEST_SERVER
  957.         query tcp ether hpsrv1 1200
  958.  
  959. or alternative protocols:
  960.  
  961. TEST_IP
  962.         query tcp ether hpsrv1 1200
  963. TEST_SPX
  964.         query tli spx /dev/nspx/ \xC12082580000000000012110
  965.  
  966. sysservers
  967.  
  968. This system table holds information about remote ASEs that you might want to
  969. connect to, and also provides a method of naming the local server.
  970.  
  971. Entries are added using the sp_addserver system procedure - add a remote server
  972. with this format:
  973.  
  974.         sp_addserver server_name, null, network_name
  975.  
  976. server_name is any name you wish to refer to a remote server by, but
  977. network_name must be the name of the remote server as referenced in the
  978. interfaces file local to your local server. It normally makes sense to make the
  979. server_name the same as the network_name, but you can easily do:
  980.  
  981.         sp_addserver LIVE, null, ACCTS_LIVE
  982.  
  983. When you execute for example, exec LIVE.master..sp_helpdb the local ASE will
  984. translate LIVE to ACCTS_LIVE and try and talk to ACCTS_LIVE via the ACCTS_LIVE
  985. entry in the local interfaces file.
  986.  
  987. Finally, a variation on the sp_addserver command:
  988.  
  989.         sp_addserver LOCALSRVNAME, local
  990.  
  991. names the local server (after a restart). This is the name the server reports
  992. in the errorlog at startup, the value returned by @@SERVERNAME, and the value
  993. placed in Open Client server messages. It can be completely different from the
  994. names in RUN_SRVNAME or in local or remote interfaces - it has no bearing on
  995. connectivity matters.
  996.  
  997. Back to top
  998.  
  999. -------------------------------------------------------------------------------
  1000.  
  1001. 1.1.9: How do I interpret the tli strings in the interface file?
  1002.  
  1003. -------------------------------------------------------------------------------
  1004.  
  1005. The tli string contained with Solaris interface files is a hex string
  1006. containing port and IP address.  If you have an entry
  1007.  
  1008. SYBSRVR
  1009.     master tli tcp /dev/tcp \x000204018196c4510000000000000000
  1010.  
  1011. Then it can be interpreted as follows:
  1012.  
  1013.     x0002    no user interpretation (header info?)
  1014.     0401     port number (1025 decimal)
  1015.     81       first part of IP address  (129 decimal)
  1016.     96       second part of IP address (150 decimal)
  1017.     c4       third part of IP address (196 decimal)
  1018.     51       fourth part of IP address (81 decimal)
  1019.    
  1020. So, the above tli address is equivalent to
  1021.  
  1022. SYBSRVR
  1023.     master tcp ether sybhost 1025
  1024.  
  1025. where sybhost's IP address is 129.150.196.81.
  1026.  
  1027. The following piece of Sybperl (courtesy of Michael Peppler) takes a tli entry
  1028. and returns the IP address and port number for each server in a Solaris' 
  1029. interfaces file.
  1030.  
  1031. #!/usr/local/bin/perl -w
  1032.  
  1033. use strict;
  1034.  
  1035. my $server;
  1036. my @dat;
  1037. my ($port, $ip);
  1038.  
  1039. while(<>) {
  1040.     next if /^\s*$/;
  1041.     next if /^\s*\#/;
  1042.     chomp;
  1043.     if(/^\w/) {
  1044.         $server = $_;
  1045.         $server =~ s/\s*$//;
  1046.         next;
  1047.     }
  1048.  
  1049.     @dat = split(' ', $_);
  1050.     ($port, $ip) = parseAddress($dat[4]);
  1051.     print "$server - $dat[0] on port $port, host $ip\n";
  1052. }
  1053.  
  1054. sub parseAddress {
  1055.     my $addr = shift;
  1056.  
  1057.     my $port;
  1058.     my $ip;
  1059.  
  1060.     my (@arr) = (hex(substr($addr, 10, 2)),
  1061.  
  1062. hex(substr($addr, 12, 2)),
  1063.  
  1064. hex(substr($addr, 14, 2)),
  1065.  
  1066. hex(substr($addr, 16, 2)));
  1067.     $port = hex(substr($addr, 6, 4));
  1068.     $ip = join('.', @arr);
  1069.  
  1070.     ($port, $ip);
  1071. }
  1072.  
  1073. Back to top
  1074.  
  1075. -------------------------------------------------------------------------------
  1076.  
  1077. 1.1.10: How can I tell the datetime my Server started?
  1078.  
  1079. -------------------------------------------------------------------------------
  1080.  
  1081. Method #1
  1082.  
  1083. The normal way would be to look at the errorlog, but this is not always
  1084. convenient or even possible. From a SQL session you find out the server startup
  1085. time to within a few seconds using:
  1086.  
  1087.    select  "Server Start Time" = crdate
  1088.    from    master..sysdatabases
  1089.    where   name = "tempdb"
  1090.  
  1091. Method #2
  1092.  
  1093. Another useful query is:
  1094.  
  1095.    select * from sysengines
  1096.  
  1097. which gives the address and port number at which the server is listening.
  1098.  
  1099. Back to top
  1100.  
  1101. -------------------------------------------------------------------------------
  1102.  
  1103. 1.1.11: Raw partitions or regular files?
  1104.  
  1105. -------------------------------------------------------------------------------
  1106.  
  1107. Hmmm... as always, this answer depends on the vendor's implementation on a
  1108. cooked file system for the ASE...
  1109.  
  1110. Performance Hit (synchronous vs asynchronous)
  1111.  
  1112. If on this platform, the ASE performs file system I/O synchronously then the
  1113. ASE is blocked on the read/write and throughput is decreased tremendously.
  1114.  
  1115. The way the ASE typically works is that it will issue an I/O (read/write) and
  1116. save the I/O control block and continue to do other work (on behalf of other
  1117. connections). It'll periodically poll the workq's (network, I/O) and resume
  1118. connections when their work has completed (I/O completed, network data
  1119. xmit'd...).
  1120.  
  1121. Performance Hit (bcopy issue)
  1122.  
  1123. Assuming that the file system I/O is asynchronous (this can be done on SGI), a
  1124. performance hit may be realized when bcopy'ing the data from kernel space to
  1125. user space.
  1126.  
  1127. Cooked I/O typically (again, SGI has something called directed I/O which allows
  1128. I/O to go directly to user space) has to go from disk, to kernel buffers and
  1129. from kernel buffers to user space; on a read. The extra layer with the kernel
  1130. buffers is inherently slow. The data is moved from kernel buffers to/from user
  1131. space using bcopy(). On small operations this typically isn't that much of an
  1132. issue but in a RDBMS scenario the bcopy() layer is a significant performance
  1133. hit because it's done so often...
  1134.  
  1135. Performance Gain!
  1136.  
  1137. It's true, using file systems, at times you can get performance gains assuming
  1138. that the ASE on your platform does the I/O asynchronously (although there's a
  1139. caveat on this too... I'll cover that later on).
  1140.  
  1141. If your machine has sufficient memory and extra CPU capacity, you can realize
  1142. some gains by having writes return immediately because they're posted to
  1143. memory. Reads will gain from the anticipatory fetch algorithm employed by most
  1144. O/S's.
  1145.  
  1146. You'll need extra memory to house the kernel buffered data and you'll need
  1147. extra CPU capacity to allow bdflush() to write the dirty data out to disk...
  1148. eventually... but with everything there's a cost: extra memory and free CPU
  1149. cycles.
  1150.  
  1151. One argument is that instead of giving the O/S the extra memory (by leaving it
  1152. free) to give it to the ASE and let it do its caching... but that's a different
  1153. thread...
  1154.  
  1155. Data Integrity and Cooked File System
  1156.  
  1157. If the Sybase ASE is not certified to be used over a cooked file system,
  1158. because of the nature of the kernel buffering (see the section above) you may
  1159. face database corruption by using cooked file system anyway. The ASE thinks
  1160. that it has posted its changes out to disk but in reality it has gone only to
  1161. memory. If the machine halts without bdflush() having a chance to flush memory
  1162. out to disk, your database may become corrupted.
  1163.  
  1164. Some O/S's allow cooked files to have a write through mode and it really
  1165. depends if the ASE has been certified on cooked file systems. If it has, it
  1166. means that when the ASE opens a device which is on a file system, it fcntl()'s
  1167. the device to write-through.
  1168.  
  1169. When to use cooked file system?
  1170.  
  1171. I typically build my tempdb on cooked file system and I don't worry about data
  1172. integrity because tempdb is rebuilt every time your ASE/SQL Server is rebooted.
  1173.  
  1174. Back to top
  1175.  
  1176. -------------------------------------------------------------------------------
  1177.  
  1178. 1.1.12: Is Sybase Y2K (Y2000) compliant?
  1179.  
  1180. -------------------------------------------------------------------------------
  1181.  
  1182. Sybase is year 2000 compliant at specific revisions of each product. Full
  1183. details are available at http://www.sybase.com, specifically (as these links
  1184. will undoubtedly change):
  1185.  
  1186.     http://www.sybase.com/success/inc/corpinfo/year2000_int.html
  1187.     http://www.sybase.com/Company/corpinfo/year2000_matrix.html
  1188.    
  1189. Note: Since we have made it to 2000 more or less intact, I see no reason to
  1190. include this question.  I plan to remove with the next release of the FAQ.  If
  1191. you feel strongly about leaving it in then let me know.
  1192.  
  1193. Back to top
  1194.  
  1195. -------------------------------------------------------------------------------
  1196.  
  1197. 1.1.13 How Can I Run the ASE Upgrade Manually?
  1198.  
  1199. -------------------------------------------------------------------------------
  1200.  
  1201. How to Run the ASE Upgrade Manually
  1202.  
  1203. This document describes the steps required to perform a manual upgrade for ASE
  1204. from release 4.x or 10.0x to release 11.02. In most cases, however, you should
  1205. use sybinit to perform the upgrade.
  1206.  
  1207. BE SURE TO HAVE GOOD BACKUPS BEFORE STARTING THIS PROCEDURE.
  1208.  
  1209.  1. Use release 11.0x sybinit to run the pre-eligibility test and Check
  1210.     Reserved words. Make any necessary changes that are mentioned in the
  1211.     sybinit log. The sybinit log is located in $SYBASE/init/logs/logxxxx.yyy.
  1212.  2. Use isql to connect to the 4.x or 10.0x ASE and do the following tasks:
  1213.     a. Turn on option to allow updates to system tables:
  1214.     1> sp_configure "allow updates", 1
  1215.     2> go
  1216.     
  1217.     b. Checkpoint all databases:
  1218.     1> use "dbname"
  1219.     2> go
  1220.     1> checkpoint
  1221.     2> go
  1222.     
  1223.     c. Shutdown the 4.x or 10.0x ASE.
  1224.     1> shutdown
  1225.     2> go
  1226.  3. Copy the interfaces file to the release 11.0x directory.
  1227.  4. Set the environment variable SYBASE to the release 11.0x directory.
  1228.  5. Copy the runserver file to the release 11.0x $SYBASE/install directory.
  1229.  6. Edit the $SYBASE/install/RUN_SYBASE (runserver file) to change the path
  1230.     from the 4.x or 10.x dataserver directory to the new release 11.0x
  1231.     directory.
  1232.  7. Start ASE using the new runserver file.
  1233.     % startserver -f$SYBASE/install/RUN_SYBASE
  1234.  8. Run the upgrade program:
  1235.    
  1236.     UNIX: $SYBASE/upgrade/upgrade -S"servername" -P"sapassword" > $SYBASE/init/
  1237.     logs/mylog.log 2>&1 VMS: SYBASE_SYSTEM[SYBASE.UPGRADE]upgrade /password=
  1238.     "sa_password" /servername="servername"
  1239.    
  1240.  9. Shut down SQL server after a successful upgrade.
  1241.     % isql -Usa -Pxxx
  1242.     -SSYBASE
  1243.     1> shutdown
  1244.     2> go
  1245. 10. Start ASE using the release 11.0x runserver file.
  1246.    
  1247.     % startserver -f$SYBASE/install/RUN_SYBASE
  1248.    
  1249. 11. Create the sybsystemprocs device and database if upgrading from 4.9.x. You
  1250.     should create a 21mb sybsystemprocs device and database.
  1251.     a. Use the disk init command to create the sybsytemprocs device and
  1252.     database manually, for example:
  1253.    
  1254.     disk init name = "sybprocsdev", physname="/dev/sybase/rel1102/
  1255.     sybsystemprocs.dat", vdevno=4, size=10752 go To check to see which vdevno
  1256.     is available: type 1> select distinct low/16777216 from sysdevices 2> order
  1257.     by low 3> go A sample create database command: create database
  1258.     sybsystemprocs on sybprocsdev=21 go Please refer to the "Sybase ASE
  1259.     Reference Manual", for more information on these commands.
  1260.    
  1261. 12. Run the installmaster and installmodel scripts:
  1262.     UNIX: %isql -Usa -Psapassword -i$SYBASE/scripts/installmaster
  1263.     UNIX: %isql -Usa -Psapassword -i$SYBASE/scripts/installmodel
  1264.     VMS: $isql /user="sa" /password="sapass"
  1265.     /input="[sybase_system.scripts]installm aster"
  1266.     VMS: $isql /user="sa" /password="sapass"
  1267.     /input="[sybase_system.scripts]installm odel"
  1268. 13. If you upgraded from ASE 4.9.2, you will need to run sp_remap to remap the
  1269.     compiled objects. Sp_remap remaps stored procedures, triggers, rules,
  1270.     defaults, or views to be compatible with the current release of ASE. Please
  1271.     refer to the Reference Manual Volume II for more information on the
  1272.     sp_remap command.
  1273.    
  1274.     The syntax for sp_remap:
  1275.    
  1276.     sp_remap object_name
  1277.  
  1278. If you are upgrading to ASE 11.0.x and the upgrade process failed when using
  1279. sybinit, you can invoke sybinit and choose remap query tress from the upgrade
  1280. menu screen. This is a new option that is added, after a failed upgrade.
  1281.  
  1282. Back to top
  1283.  
  1284. -------------------------------------------------------------------------------
  1285.  
  1286. 1.1.14 We have lost the sa password, what can we do?
  1287.  
  1288. -------------------------------------------------------------------------------
  1289.  
  1290. Remember Douglas Adams famous quote "Don't panic" is the first thing!  
  1291.  
  1292. I know that most people use the 'sa' account all of the time, which is fine if
  1293. there is only ever one dba administering the system. If you have more than one
  1294. person accessing the server using the 'sa' account, consider using sa_role
  1295. enabled accounts and disabling the 'sa' account. Funnily enough, this is
  1296. obviously what Sybase think because it is one of the questions in the
  1297. certification exams.
  1298.  
  1299. If you see that someone is logged using the 'sa' account or is using an account
  1300. with 'sa_role' enabled, then you can do the following:
  1301.  
  1302. sp_configure "allow updates to system tables",1
  1303. go
  1304. update syslogins set password=null where name = 'sa'
  1305. go
  1306. sp_password null,newPassword
  1307. go
  1308.  
  1309. You must rememeber to reset the password before exiting isql or sqsh. I thought
  1310. that setting it to null would be enough, and exited isql thinking that I would
  1311. be able to get in with a null password. Take it from me that the risk is not
  1312. worth it. It failed for me and I had to kill the dataserver and get a new
  1313. password. I just tried the above method and it works fine.
  1314.  
  1315. If you have a user with sso_role enabled, login with that account and change
  1316. the 'sa' password that way. It is often a good idea to have a separate site
  1317. security officer, just to get you out of this sticky situation. Certainly stops
  1318. you looking an idiot in managements eyes for having to reboot production
  1319. because you have locked yourself out!
  1320.  
  1321. OK, so we have got to the point where there are no accounts with sufficient
  1322. priviledges to allow you to change the 'sa' account password. (You are sure
  1323. about that, since the next part can cause data loss, so have another quick
  1324. look.) We now need to some more drastic stuff.
  1325.  
  1326. If the server is actually running, then you need to stop it.  We know that the
  1327. only accounts that can stop the server in a nice manner are not available, so
  1328. it has to be some sort of kill. You can try:
  1329.  
  1330. kill -SIGTERM 
  1331.  
  1332. or
  1333.  
  1334. kill -15 
  1335.  
  1336. (they are identical) which is designed to be caught by ASE, which then performs
  1337. the equivalent of shutdown with nowait. If ASE does not die, and you should
  1338. give it a little while to catch and act on the signal, then you might have to
  1339. try other measures, which is probably kill -9. Note that if you have tables
  1340. with identity columns, most of these will jump alarmingly, unless you are using
  1341. ASE 12.5 and the identity interval is set to 1.
  1342.  
  1343. Once down, edit the RUN_SERVER file ( RUN_SERVER.bat on NT) and add "-psa" (it
  1344. is important not to leave a space between the"-p" and the "sa", and that it is
  1345. all lower-case) to the end of the dataserver or sqlsrvr.exe line. You will end
  1346. up with a file that looks a bit like:
  1347.  
  1348. #!/bin/sh
  1349. #
  1350. # Adaptive Server name: N_UTSIRE
  1351. # Master device path:   /data/sybase/databases/N_UTSIRE/master.dat
  1352. # Error log path:       /opt/sybase-11.9.2/install/N_UTSIRE.log
  1353. # Directory for shared memory files:    /opt/sybase-11.9.2
  1354. #
  1355. # Regenerate sa password -psa
  1356. #
  1357. /opt/sybase-11.9.2/bin/dataserver \
  1358. -sN_UTSIRE \
  1359. -d/data/sybase/databases/N_UTSIRE/master.dat \
  1360. -e/opt/sybase-11.9.2/install/N_UTSIRE.log \
  1361. -M/opt/sybase-11.9.2 -psa \
  1362.  
  1363. (I add the line mentioning the regenerate, so that if I need to do this in a
  1364. moment of extreme pressure it is there in front of my nose.
  1365.  
  1366. Now, start the server again and you should see the following on the screen:
  1367.  
  1368. 00:00000:00001:2001/05/26 18:29:21.39 server    'bin_iso_1' (ID = 50)
  1369. 00:00000:00001:2001/05/26 18:29:21.39 server  on top of default character set:
  1370. 00:00000:00001:2001/05/26 18:29:21.39 server    'iso_1' (ID = 1).
  1371. 00:00000:00001:2001/05/26 18:29:21.39 server  Loaded default Unilib conversion handle.
  1372.  
  1373. New SSO password for sa:tmfyrkdwpibung
  1374.  
  1375. Note that it is not written to the log file, so keep your eyes peeled.
  1376.  
  1377. On NT you will have to start the server from the command line and not use
  1378. Sybase Central or the control panel.
  1379.  
  1380. Obviously, you will want to change the password to something much more
  1381. memorable as soon as possible.
  1382.  
  1383. Remember to remove the "-psa" from the "RUN" file before you start the server
  1384. again or else the password will be changed again for you.
  1385.  
  1386. Back to top
  1387.  
  1388. -------------------------------------------------------------------------------
  1389.  
  1390. 1.1.15 How do I set a password to be null?
  1391.  
  1392. -------------------------------------------------------------------------------
  1393.  
  1394. Since ASE 11 (I cannot remember if it was with the very first release of 11,
  1395. but certainly not before) the password column in syslogins has been encrypted.
  1396. Setting this column to NULL does not equate to that login having a NULL
  1397. password. A NULL password still requires the correct binary string to be in
  1398. place.
  1399.  
  1400. In release 12 and above, set the minimum password length to be 0 using
  1401. sp_configure and give that account a null password, and all should be fine.
  1402.  
  1403. Before 12, it is not possible to set the minimum password length, so the direct
  1404. approach is not possible. So, update the relevant record in syslogins setting
  1405. the password column to be the same as that of an account with a NULL password
  1406. already.
  1407.  
  1408. How does one get the correct binary value? When a new ASE is built, the 'sa'
  1409. account has a NULL password to start with. Setting an account to have the same
  1410. binary value as such an 'sa' account should work. Remember that the binary
  1411. string is going to be specific to the operating system and the exact release of
  1412. ASE etc. Obviously, if you have set the password of your 'sa' accounts to be
  1413. something other than NULL (sensible move), then you are going to have to build
  1414. yourself a dummy server just to get the correct string. If this is important to
  1415. you, then you may wish to store the value somewhere safe once you have
  1416. generated it.
  1417.  
  1418. Yet another method would be to simply insert the correct hex string into the
  1419. password column. Rob Verschoor has a very nice stored proc on his site called
  1420. sp_blank_password to allow you to do just this. Go to http://www.sypron.nl/
  1421. blankpwd.html .
  1422.  
  1423. Back to top
  1424.  
  1425. -------------------------------------------------------------------------------
  1426.  
  1427. 1.1.16: Does Sybase support Row Level Locking?
  1428.  
  1429. -------------------------------------------------------------------------------
  1430.  
  1431. With Adaptive Server Enterprise 11.9 Sybase introduced row level locking into
  1432. its product.  In fact it went further than that, it introduced 3 different
  1433. locking levels:
  1434.  
  1435.   * All Pages Locking
  1436.  
  1437.     This is the scheme that is implemented in all servers prior to 11.9.   Here
  1438.     locks are taken out at the page level, which may included many rows.  The
  1439.     name refers to the fact that all of the pages in any data manipulation
  1440.     statement are locked, both data and index.
  1441.    
  1442.   * Data Page Locking
  1443.  
  1444.     The other two locking schemes are bundled together under the title Data
  1445.     Page Locking, refering to the fact that only data pages are ever locked in
  1446.     the conventional sense.   Data Page Locking is divided into two categories
  1447.       + Data Only Locking
  1448.    
  1449.        
  1450.         This locking scheme still locks a page at a time, including all of the
  1451.         rows contained within that page, but uses a new mechanism, called
  1452.         latches, to lock index pages for the shortest amount of time.  One of
  1453.         the consequences of this scheme is that it does not update index
  1454.         pages.  In order to support this Sybase has introduced a new concept,
  1455.         forwarded rows.  These are rows that have had to move because they have
  1456.         grown beyond space allowed for them on the page they were created. 2002
  1457.         bytes per page.
  1458.        
  1459.       + Row Level Locking
  1460.    
  1461.        
  1462.         Just as it sounds, the lock manager only locks the row involved in the
  1463.         operation.
  1464.        
  1465. Back to top
  1466.  
  1467. -------------------------------------------------------------------------------
  1468.  
  1469. 1.1.17: What platforms does ASE run on?
  1470.  
  1471. -------------------------------------------------------------------------------
  1472.  
  1473. Sybase has an excellent lookup page that tells you all of the releases that
  1474. Sybase has certifies as running on a particular platform. Got to http://
  1475. ohno.sybase.com/cgi-bin/ws.exe/cert/ase_cert.hts .
  1476.  
  1477. Back to top
  1478.  
  1479. -------------------------------------------------------------------------------
  1480.  
  1481. 1.1.18: How do I backup databases > 64G on ASE prior to 12.x?
  1482.  
  1483. -------------------------------------------------------------------------------
  1484.  
  1485. As you are all well aware, prior to version of ASE 12, dumping large databases
  1486. was a real pain. Tape was the only option for anything greater than 64 gig.
  1487. This was because only 32 dump devices, or stripes, were supported, and since
  1488. file based stripes were restricted to no more than 2 gig, the total amount of
  1489. data that could be dumped was <= 32 * 2 = 64G.
  1490.  
  1491. With the introduction of ASE 12, the number of stripes was increased
  1492.  
  1493. Back to top
  1494.  
  1495. -------------------------------------------------------------------------------
  1496.  
  1497. User Database Administration # ASE FAQ
  1498.  
  1499.