You are looking at the HTML representation of the XML format.
HTML is good for debugging, but is unsuitable for application use.
Specify the format parameter to change the output format.
To see the non HTML representation of the XML format, set format=xml.
See the complete documentation, or API help for more information.
<?xml version="1.0"?>
<api>
  <query-continue>
    <allpages gapcontinue="RepServer_Throughput_Script" />
  </query-continue>
  <query>
    <pages>
      <page pageid="1397" ns="0" title="Reorg rebuild">
        <revisions>
          <rev contentformat="text/x-wiki" contentmodel="wikitext" xml:space="preserve">Reorg rebuild is a command for Sybase ASE that you can use to reorganize tables.

==Short introduction==
Before ASE version 15 you could only run this command on tables with a datapages or datarows locking scheme, but that restriction has been dropped. Reorg rebuild can be used to defragment tables. To run the command you need to turn on the database option &quot;select into/bulkcopy/pllsort&quot; as in this example:

 sp_dboption myDatabase,&quot;select into/bulkcopy/pllsort&quot;,true
 go

Then run the command like this

 use myDatabase
 go
 reorg rebuild CustomerTable
 go

During a reorg rebuild, the table is locked to users should have been informed or logged of from the system.

Remember to make a full database dump after you have run the reorg command, since the command creates unlogged transactions.

==Stored procedure to reorganize all tables in a database==
Here you can find a stored procedure to reorganize all user tables in a database. Since reorg rebuild effectively copies the table you need enough free space in a database that the largest table uses multiplied by two. The stored procedure will check for that. Some other features:
* Processing starts with smaller tables
* Proxy tables are skipped
* An sp_recompile is run after each table, to tell the server to generate new query plans.

Sample execution:

 myDatase..sp_dba_reorg_rebuild

Stored procedure:

 use sybsystemprocs
 go
 
 if exists (select *
    from sysobjects where type = 'P' and name = 'sp_dba_reorg_rebuild')
 begin
    drop procedure sp_dba_reorg_rebuild
 end
 go
 
 create proc sp_dba_reorg_rebuild
 as
 
 declare @user_name      varchar(30),
         @table_name     varchar(255),
         @reserved_pages int,
         @free_space     int,
         @cmd            varchar(1024),
         @db_name        varchar(30)
 
 declare c2 cursor for
         select user_name(uid),
                name,
                reserved_pages(db_id(@db_name),id)
                from    sysobjects
                where   type    = &quot;U&quot;   -- User tables
                and     not (sysstat2 &amp; 1024 = 1024 or  -- Remote
                        sysstat2 &amp; 2048 = 2048)         -- Proxy
                order   by 3
 
 set flushmessage on
 
 select @db_name = db_name()
 
 print &quot;reorg rebuild started for database %1!&quot;, @db_name
 
 exec sp_flushstats
 
 open c2
 
 fetch c2 into @user_name, @table_name, @reserved_pages
 
 while @@sqlstatus = 0
 begin
    select @free_space = sum(curunreservedpgs(db_id(), lstart, unreservedpgs))
           from  master..sysusages
           where dbid    = db_id()
           and   segmap != 4 -- logsegment
 
    if @free_space &lt; round(@reserved_pages * 2.0,0)
       print   &quot;Skipping table %1!.%2! not enough space in database&quot;, @user_name, @table_name
    else
    begin
       print &quot;Table %1!.%2!&quot;, @user_name, @table_name
 
       select @cmd = &quot;reorg rebuild &quot; + @user_name + &quot;.&quot; + @table_name
 
       exec (@cmd)
 
       if @@error != 0
          break
 
       select @cmd = rtrim(@user_name) + &quot;.&quot; + @table_name
 
       exec sp_recompile @cmd
 
       if @@error != 0
          break
    end
 
    fetch c2 into @user_name, @table_name, @reserved_pages
 end
 
 close c2
 
 deallocate cursor c2
 
 return 0
 go

[[Category:ASE]]</rev>
        </revisions>
      </page>
      <page pageid="1398" ns="0" title="RepServer Errorlog checker">
        <revisions>
          <rev contentformat="text/x-wiki" contentmodel="wikitext" xml:space="preserve">The script below is for monitoring the repserver errorlog - it works with any version of repserver and does not need to write to the errorlog itself in order to monitor it.  However, since it doesn't write to the errorlog, it does need a $ADMINDIR/control_files/ directory which you may wish to create as a non-transient file (rserrlogmarker.dat) is maintained there.
Also, as per the script notes, you can easily modify this script to monitor *any* log; be sure to give rserrlogmarker.dat and the other files in the config section different names or keep them elsewhere so that there is no conflict.

&lt;pre&gt;
#!/usr/bin/ksh
#
# Script: rs_log_checker.sh
# Author: Bob Holmes - email: cambob@gmail.com
# Date  : 08/05/2008
# Version: 1.1
# Usage : rs_log_checker.sh [v|V] (verbose mode)
# Description: Script for checking the repserver errorlog
# --------------------------
#    ***    Variables for customisation can be found by searching for &quot;!!&quot; ***
# --------------------------
# Modification history:
#
# --------------------------
# Enhancement notes:
# BobH: V1.0: Modified to re-create rserrlogmarker file if not found, then re-run automatically.
# BobH: V1.1: Updated for detecting a new log file and resetting rserrlogmarker if so.
# --------------------------
# Comments: This script can easily be modified to monitor any log, including ASE.
#           The log itself is never written to so this script maintains a control
#           file to keep track of the last line it checked.

##############################################################################
#                           setup environment                                #
##############################################################################
HOSTNAME=`hostname`

##############################################################################
#                           config variables                                 #
##############################################################################
# config
RSLOGFILE=&quot;/PATH_TO_ERRORLOG_HERE/servername_rs.log&quot;        # !! modify for your environment
ADMINDIR=&quot;/opt/home/sybase/admin&quot;                           # !! modify for your environment
RSLOGMARKER=&quot;$ADMINDIR/control_files/rserrlogmarker.dat&quot;    # !! need $ADMINDIR/control_files/ directory
RECIPIENTS=&quot;user@domain.dom&quot;                                # !! enter email address config here 
                                                            #   (separate with commas for multiple addresses)
# static
TEMPFILE1=&quot;$ADMINDIR/rslogchecker1.tmp&quot;                     # transient file
TEMPFILE2=&quot;$ADMINDIR/rslogchecker2.tmp&quot;                     # transient file
MAILFILE=&quot;$ADMINDIR/rslogchecker.mail&quot;                      # transient file
SCRIPT_NAME=`basename $0`

##############################################################################
#                             main program                                   #
##############################################################################

# check location of errorlog
if [ ! -f $RSLOGFILE ]
then
   echo RS errorlog file not found. Please check config.
   exit
fi

# get log marker value from file (or otherwise create it)
# V1.1: marker is now a line number
if [ ! -f $RSLOGMARKER ]
then
   MARKER=$(cat -n $RSLOGFILE | tail -1 | awk '{print $1}')
   echo $MARKER &gt; $RSLOGMARKER
   #echo &quot;rs log marker reset&quot;
   $SCRIPT_NAME # must re-run after marker file reset
   exit
else
   MARKER=$(cat $RSLOGMARKER)
fi

# Compare number of lines in log file with current marker value to check
# if a new log has been created/repserver restarted.
if [ $(wc -l $RSLOGFILE | awk '{print $1}') -lt $MARKER ]
then
   # new log file created/repserver restarted
   printf &quot;${SCRIPT_NAME}: New log file detected\n&quot; &gt; $TEMPFILE2
   RESTARTDT=$(head -1 $RSLOGFILE | awk '{print $2,$3}')
   printf &quot;${SCRIPT_NAME}: Repserver restarted at: ${RESTARTDT}\n\n&quot; &gt;&gt; $TEMPFILE2
   printf &quot;Errors/Warnings from startup follow:\n&quot; &gt;&gt; $TEMPFILE2
   printf &quot;------------------------------------\n&quot; &gt;&gt; $TEMPFILE2
   # pick out any errors/or warnings from log file:
   egrep &quot;^E. |^W. &quot; $RSLOGFILE &gt;&gt; $TEMPFILE2
   mailx -s &quot;$HOSTNAME: Repserver restarted!&quot; $RECIPIENTS &lt; $TEMPFILE2
   rm $RSLOGMARKER # force reset of marker file
   rm $TEMPFILE2
   exit
fi


if [ &quot;$1&quot; = &quot;V&quot; ] || [ &quot;$1&quot; = &quot;v&quot; ] # verbose (diag) mode
then
  echo Current marker value is: $MARKER
fi

# increment the marker (line number) to avoid re-reading same last line
((MARKER=MARKER+1))
sed -n &quot;$MARKER,$ p&quot; $RSLOGFILE &gt; $TEMPFILE1
######### next executable line checks for errors #########
######### add your search terms to the egrep below #######
EMSGS=$(egrep -c &quot;^E\. |^W\. &quot; $TEMPFILE1)
if [ $EMSGS -ne 0 ]
then
  if [ &quot;$1&quot; = &quot;V&quot; ] || [ &quot;$1&quot; = &quot;v&quot; ] # verbose (diag) mode
  then
     echo Error message found: $HOSTNAME: $EMSGS messages
     cat $TEMPFILE1
     echo END OF REPORT
  else
     cp $TEMPFILE1 $MAILFILE
     printf &quot;-------CALLOUT SYBASE DBA - ON CALL----------------\n&quot; &gt;&gt; $MAILFILE   # !! optional
     mailx -s &quot;$HOSTNAME: $EMSGS errors found in repserver errorlog&quot; $RECIPIENTS &lt; $MAILFILE
  fi
fi

#update marker:
# Note: use line count from TEMPFILE1 + (MARKER-1) to avoid re-scanning the whole errorlog;
# cat/cp'ing large log files can cause load issues so we don't do that!
LINECOUNT=$(wc -l $TEMPFILE1 | awk '{print $1}')
((MARKER=MARKER+LINECOUNT-1))
echo $MARKER &gt; $RSLOGMARKER
if [ &quot;$1&quot; = &quot;V&quot; ] || [ &quot;$1&quot; = &quot;v&quot; ] # verbose (diag) mode
then
  echo New marker value is: $MARKER
fi

# housekeeping
if [ -e $TEMPFILE1 ]
then
  rm $TEMPFILE1
fi
if [ -e $TEMPFILE2 ]
then
  rm $TEMPFILE2
fi

#end script
&lt;/pre&gt;

[[Category:RepServer]]</rev>
        </revisions>
      </page>
    </pages>
  </query>
</api>