old-www/HOWTO/Sybase-ASE-HOWTO/config.html

785 lines
16 KiB
HTML

<HTML
><HEAD
><TITLE
>Configuring an ASE Server</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Sybase Adaptive Server Enterprise / SQL Server HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Installation"
HREF="install.html"><LINK
REL="NEXT"
TITLE="Basic Usage"
HREF="usage.html"></HEAD
><BODY
CLASS="sect1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Sybase Adaptive Server Enterprise / SQL Server HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="install.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="usage.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="config"
></A
>3. Configuring an ASE Server</H1
><P
>&#13;So far we have copied the software into the file system, now we will do the actual setup of a database server. First we need to make sure the sybase user is set up properly, then we can start the configuration utilities and enter the correct settings there.
</P
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN263"
></A
>3.1. Pre-Configuration steps</H2
><P
>&#13;<P
></P
><OL
TYPE="1"
><LI
><P
>&#13;To begin with, read the <TT
CLASS="filename"
>LICENSE</TT
> file if it exists. Once you agree with this, continue down this list.
</P
></LI
><LI
><P
>&#13;There are some useful steps done by the installation scripts in the RPM packages that you may want to do by hand if you installed with extra RPM switches or used alien. One is that directories in ASE 12.5 get shortcuts created with shorter names. ASE-12_5 gets a symlink named ASE, OCS-12_5 has a symlink named OCS. You can set these up yourself to save some typing later.
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;bash$ cd /opt/sybase
bash$ ln -s SYBASE_ASE ASE
bash$ ln -s SYBASE_OCS OCS
bash$ ln -s shared-1_0 shared
bash$ ln -s SYSAM-1_0 SYSAM
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
><P
>&#13;Change the installation to be owned by the sybase user.
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;bash$ su - root
bash# chown -R sybase.sybase /opt/sybase
bash# chmod -R ug+w /opt/sybase
</PRE
></FONT
></TD
></TR
></TABLE
>
This is more or less what the <TT
CLASS="filename"
>sybinstall.sh</TT
> script does for you. In SQL Server 11.0.3.3 there is a script which attempts to set all permissions right, <TT
CLASS="filename"
>$SYBASE/install/setperm_all</TT
>
</P
></LI
><LI
><P
>&#13;Make sure you allow ASE to allocate the necessary amount of shared memory. Your current maximum is what you find from <B
CLASS="command"
>ipcs -lm</B
> (in KiloBytes) or <B
CLASS="command"
>cat /proc/sys/kernel/shmmax</B
> (in bytes) or <B
CLASS="command"
>sysctl kernel.shmmax</B
> (in bytes). This can be set with
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;<B
CLASS="command"
>sysctl -w kernel.shmmax=<TT
CLASS="replaceable"
><I
>[number of bytes]</I
></TT
></B
></PRE
></FONT
></TD
></TR
></TABLE
>
or by directly
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
><B
CLASS="command"
>echo <TT
CLASS="replaceable"
><I
>[number of bytes]</I
></TT
> &#62; /proc/sys/kernel/shmmax</B
></PRE
></FONT
></TD
></TR
></TABLE
>
as root. Make sure this is permanently changed on every reboot by either inserting a line in <TT
CLASS="filename"
>/etc/sysctl.conf</TT
> or place the echo command in a rc startup file (such as rc.local) as the Sybase documentation says. Depending upon the version, here is the memory requirements for ASE:
<DIV
CLASS="table"
><A
NAME="AEN290"
></A
><P
><B
>Table 3. ASE Memory Requirements</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><THEAD
><TR
><TH
WIDTH="25%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>Version</TH
><TH
WIDTH="25%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>Minimum Memory</TH
><TH
WIDTH="25%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>shmmax</TH
><TH
WIDTH="25%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>"total memory"</TH
></TR
></THEAD
><TBODY
><TR
><TD
WIDTH="25%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>11.0.3.3</TD
><TD
WIDTH="25%"
ALIGN="RIGHT"
VALIGN="MIDDLE"
>&#732;15 MB</TD
><TD
WIDTH="25%"
ALIGN="RIGHT"
VALIGN="MIDDLE"
>15360000 bytes</TD
><TD
WIDTH="25%"
ALIGN="RIGHT"
VALIGN="MIDDLE"
>7500 2K pages</TD
></TR
><TR
><TD
WIDTH="25%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>11.9.2.x</TD
><TD
WIDTH="25%"
ALIGN="RIGHT"
VALIGN="MIDDLE"
>32 MB</TD
><TD
WIDTH="25%"
ALIGN="RIGHT"
VALIGN="MIDDLE"
>33554432 bytes</TD
><TD
WIDTH="25%"
ALIGN="RIGHT"
VALIGN="MIDDLE"
>16384 2K pages</TD
></TR
><TR
><TD
WIDTH="25%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>12.5.0.x</TD
><TD
WIDTH="25%"
ALIGN="RIGHT"
VALIGN="MIDDLE"
>50 MB</TD
><TD
WIDTH="25%"
ALIGN="RIGHT"
VALIGN="MIDDLE"
>52428800 bytes</TD
><TD
WIDTH="25%"
ALIGN="RIGHT"
VALIGN="MIDDLE"
>25600 2K pages</TD
></TR
></TBODY
></TABLE
></DIV
>
</P
></LI
><LI
><P
>&#13;Make sure the sybase user has all relevant environment variables set correctly.
<DIV
CLASS="table"
><A
NAME="AEN321"
></A
><P
><B
>Table 4. Sybase environment variables</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><THEAD
><TR
><TH
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>Version</TH
><TH
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>Variable</TH
><TH
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>Set to</TH
></TR
></THEAD
><TBODY
><TR
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>11.0.3.3 and 11.9.2.x</TD
><TD
>&nbsp;</TD
><TD
>&nbsp;</TD
></TR
><TR
><TD
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>$LANG</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>Must not be set!</TD
></TR
><TR
><TD
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>$LC_ALL</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>"default"</TD
></TR
><TR
><TD
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>$SYBASE</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>Top-level of installation, default is /opt/sybase/</TD
></TR
><TR
><TD
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>$PATH</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>Add /opt/sybase/bin to the start of the existing $PATH</TD
></TR
><TR
><TD
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>$LD_LIBRARY_PATH</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>Add /opt/sybase/lib to the start of the existing $LD_LIBRARY_PATH</TD
></TR
><TR
><TD
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>$SYBPLATFORM</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>"linux"</TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>12.5.0.x</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>All of the above plus</TD
><TD
>&nbsp;</TD
></TR
><TR
><TD
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>$SYBASE_ASE</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>Subdirectory (not full path) to the ASE part of the installation</TD
></TR
><TR
><TD
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>$SYBASE_OCS</TD
><TD
WIDTH="33%"
ALIGN="LEFT"
VALIGN="MIDDLE"
>Subdirectory (not full path) to the Open Client / Open Server part of the installation</TD
></TR
></TBODY
></TABLE
></DIV
>
Create a script with all environment variables that you can source in, or modify startup files such as <TT
CLASS="filename"
>.cshrc</TT
> or <TT
CLASS="filename"
>.profile</TT
>. Here are the needed settings:
</P
><P
>&#13;sh/bash/ksh type shells
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;unset LANG
export LC_ALL="default"
export SYBASE="/opt/sybase/"
export PATH="$SYBASE/bin:$SYBASE/$SYBASE_ASE/bin:$SYBASE/$SYBASE_OCS/bin:
$SYBASE/$SYBASE_SYSAM/bin:$PATH"
export LD_LIBRARY_PATH="$SYBASE/lib:$SYBASE/$SYBASE_ASE/lib:$SYBASE/$SYBASE_OCS/lib:
$LD_LIBRARY_PATH"
export SYBPLATFORM="linux"
export SYBASE_ASE="ASE"
export SYBASE_OCS="OCS"
export SYBASE_FTS="FTS"
export SYBASE_SYSAM="SYSAM"
</PRE
></FONT
></TD
></TR
></TABLE
>
csh/tcsh type shells
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="screen"
>&#13;unsetenv LANG
setenv LC_ALL default
setenv SYBASE /opt/sybase/
setenv PATH $SYBASE/bin:$SYBASE/$SYBASE_ASE/bin:$SYBASE/$SYBASE_OCS/bin:
$SYBASE/$SYBASE_SYSAM/bin:$PATH
setenv LD_LIBRARY_PATH=$SYBASE/lib:$SYBASE/$SYBASE_ASE/lib:$SYBASE/$SYBASE_OCS/lib:
$LD_LIBRARY_PATH
setenv SYBPLATFORM=linux
setenv SYBASE_ASE ASE
setenv SYBASE_OCS OCS
setenv SYBASE_FTS FTS
setenv SYBASE_SYSAM SYSAM
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
></LI
><LI
><P
>&#13;Prepare the data area.
</P
></LI
></OL
>
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN369"
></A
>3.2. Preparing the Data Area</H2
><P
>&#13;Since the file system for the software is now prepared, we can decide where to locate the data storage used to hold the data inserted into the databases. The first decision is whether to use raw devices or file system. Traditionally, raw devices were used. You had to partition a disk and set a certain label to have it recognized as raw. Linux didn't have this previously and the Sybase virtual devices were instead written to files in a file system.
</P
><P
>&#13;So, what is the difference between these approaches and when should you choose each? Unfortunately, it is one of the areas where the answer is a very clear and unambiguos "it depends". Raw devices were introduced first with kernel patches and then included in the 2.4 series. You use the command <B
CLASS="command"
>raw</B
> to create bindings between partitions and the <TT
CLASS="filename"
>/dev/raw<TT
CLASS="replaceable"
><I
>n</I
></TT
></TT
> devices. This means that you will need to have a free partition on a disk. Changing this later can also be difficult. The advantages of raw devices are that you know exactly where on disk they are located - you can place them on the fastest cylinders if you like. Writes to the raw devices will be unbuffered, they will go directly to disk. In case of a failure (such as power outage, disk controller failure or process crash) the finished writes are guaranteed to be on disk instead of only having been written to a buffer waiting for the disk to be ready. Also, the ASE server will to asynchronous I/O on these devices. It can queue a series of I/O instead of having to do a single I/O, wait for it to finish and then do the next operation. While the I/O result is pending, the ASE server will perform other work. With a virtual device written to a file on a file system (ext2, ext3 and Reiserfs are all supported), the writes will normally be done to the file system buffers. The actual file may be located anywhere on the partition and may not be contiguous. Note that there is no need for a journalling file system since these will only log the changes to the inode, not the contents of the data blocks. The Sybase ASE transaction log will do exactly this kind of "journalling" of the data modifications for you. The buffering means that reading data not held in ASE cache may take place from the file system buffer instead of having to read it from disk, thereby speeding up these. However, writes will probably take longer time to finish since they have to pass through the file system driver layer. In order to have safe writes to file system devices you can configure ASE to open the device using the O_DSYNC flag, which will cause writes to be flushed to disc immediately when writing.
</P
><P
>&#13;In ASE 11.0.3.3 ESD #6 there is support for raw devices. This will need certain patches shipped in the GPL directory, one for raw device access, one for KAIO. There are instructions for how to apply these to the kernels and distributions that were current at the time.
</P
><P
>&#13;In 11.9.2.x it was decided not to include any experimental raw device support before the Linux kernel officially included and supported this. In order to guarantee safe writes, the O_DSYNC flag is always enabled by default. You can globally disable this with traceflag 1625; add -T1625 as a parameter to the RUN_SERVER file.
</P
><P
>&#13;In ASE 12.5.0.x there was a change starting in 12.5.0.2 where the server is now compiled to use the kernel 2.4 functionality. That means you can create raw devices on OS level and configure ASE to use these without any special patches. If you prefer file system devices, you can set the O_DSYNC flag to be used with the <TT
CLASS="parameter"
><I
>dsync=true</I
></TT
> parameter when creating the device with <B
CLASS="command"
>disk init</B
>, or the <B
CLASS="command"
>sp_deviceattr</B
> stored procedure to modify it later.
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN382"
></A
>3.3. Starting the Configuration</H2
><P
>&#13;To configure a SQL Server 11.0.3.3 you log in as the sybase user and start the <B
CLASS="command"
>sybinit</B
> utility. You can run this in a console, make changes and hit <B
CLASS="keycap"
>Ctrl</B
>-<SPAN
CLASS="keysym"
>A</SPAN
> for "accept" and <B
CLASS="keycap"
>Ctrl</B
>-<SPAN
CLASS="keysym"
>X</SPAN
> to go back to the previous menu.
</P
><P
>&#13;In ASE 11.9.2.x and 12.5.0.x, you normally use the <B
CLASS="command"
>srvbuild</B
> command, but you will need an X server to display it. For those not using X, an option is to use the shell script "sybinit4ever", available on the web from SyPron, see the 3rd party utilities section later. This will give you a classic sybinit menu interface to the configuration process. An alternative from Sybase is the <B
CLASS="command"
>srvbuildres</B
> utility which uses a resource file containing all configuration options which you can edit with your settings, these options are described in an appendix of the Installation Guide.
</P
><P
>&#13;The exact entries for configuring a server are described in more detail in the /opt/sybase/doc/howto/howto-ase-quickstart.html file from the ASE 11.0.3.3 documentation RPM, and in the "Configuration Guide for UNIX" for the newer versions. The information you will need for all versions are:
<P
></P
><UL
><LI
><P
>&#13;IP address of the interface which ASE will listen on. Use the network IP of the machine or 127.0.0.1 if you are only going to accept local connections.
</P
></LI
><LI
><P
>&#13;TCP port which ASE will listen on. Choose any port not in use. Port 2025 was used before, 4100 is the current default. Use 1433 if you are trying to trick applications into believing this is an MS SQL Server.
</P
></LI
><LI
><P
>&#13;Path to the master device (raw device or file).
</P
></LI
><LI
><P
>&#13;Path to the sybsystemprocs device (raw device or file).
</P
></LI
><LI
><P
>&#13;Character set and sort order for your data (you want to get this right the first time, changing it later involves copying all data out to files and load them back in). ISO_1 character set should be sufficient for most purposes. Unicode is only supported in the 12.5.0.x releases.
</P
></LI
><LI
><P
>&#13;Logical server name - this is just a placeholder to identify an ASE instance. In the examples I have named the server SYBASE.
</P
></LI
></UL
>
</P
><P
>&#13;Once you have decided on these settings, start the configuration program. If you use <B
CLASS="command"
>srvbuild</B
>, you will need to set your $DISPLAY variable correctly. Type in the requested settings and let the configuration utility build the server. Some parts of this, such as creating the database devices and loading the system stored procedures, will take time. Once the process has finished, you server should have been built and be up and running, ready for requests.
</P
></DIV
><DIV
CLASS="sect2"
><H2
CLASS="sect2"
><A
NAME="AEN411"
></A
>3.4. Finishing Off</H2
><P
>&#13;If you want automatic startup and shutdown, consider the rc.sybase script a good start. You can copy this to where all your other startup scripts are and create the correct start and stop links from your runlevel directories.
</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="install.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="usage.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Installation</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Basic Usage</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>