



     COPYDB(UNIX)                 3/14/79                 COPYDB(UNIX)



     NAME
          copydb - create batch files to copy out a data base and  re-
          store it.

     SYNOPSIS
          _c_o_p_y_d_b [ -_u_n_a_m_e ] database full-path-name-of-directory [ re-
          lation ... ]

     DESCRIPTION
          _C_o_p_y_d_b creates two INGRES command files  in  the  directory:
          _C_o_p_y._o_u_t,  which  contains  Quel instuctions which will copy
          all relations owned by the user  into  files  in  the  named
          directory,  and _c_o_p_y._i_n, which contains instructions to copy
          the files into relations, create indexes  and  do  modifies.
          The files will have the same names as the relations with the
          users INGRES id tacked on the end.  (The directory MUST  NOT
          be the same as the data base directory as the files have the
          same names as the relation files.) The -_u flag may  be  used
          to  run  _c_o_p_y_d_b  with  a  different user id.  (The fact that
          _c_o_p_y_d_b creates the copy files does not imply that  the  user
          can necessarily access the specified relation).  If relation
          names are specified only those relations will be included in
          the copy files.

          _C_o_p_y_d_b is written in Equel and will access the  database  in
          the  usual  manner.   It  does not have to run as the INGRES
          user.

     EXAMPLE
          chdir /mnt/mydir
          copydb db /mnt/mydir/backup
          ingres db <backup/copy.out
          tp r1 backup
          rm -r backup

          tp x1
          ingres db <backup/copy.in

     DIAGNOSTICS
          _C_o_p_y_d_b will give  self-explanatory  diagnostics.   If  ``too
          many  indexes''  is  reported  it  means  that more than ten
          indexes have been specified on one relation.   The  constant
          can  be  increased and the program recompiled.  Other limits
          are set to the system limits.

     BUGS
          _C_o_p_y_d_b assumes that indexes which are ISAM do not need to be
          remodified.  _C_o_p_y_d_b cannot tell if the relation was modified
          with a fillfactor or minpages  specification.   The  _c_o_p_y._i_n
          file may be edited to reflect this.







     CREATDB(UNIX)                11/6/79                CREATDB(UNIX)



     NAME
          creatdb - create a data base

     SYNOPSIS
          _c_r_e_a_t_d_b [ -_u_n_a_m_e ] [ -_e ] [ -_m ] [ +__c ] [ +__q ] dbname

     DESCRIPTION
          Creatdb creates a  new  INGRES  database,  or  modifies  the
          status  of  an  existing  database.  The person who executes
          this command becomes the Database  Administrator  (DBA)  for
          the database.  The DBA has special powers not granted to or-
          dinary users.

          _D_b_n_a_m_e is the name of the database to be created.  The  name
          must be unique among all INGRES users.

          The flags +__c and +__q specify options on  the  database.   The
          form  +_x  turns  an option on, while -_x turns an option off.
          The -_c flag turns off the concurrency  control  scheme  (de-
          fault on).  The +_q flag turns on query modification (default
          on).

          Concurrency control should not be turned off except on data-
          bases  which are never accessed by more than one user.  This
          applies even if users do not  share  data  relations,  since
          system  relations are still shared.  If the concurrency con-
          trol scheme is not installed in UNIX, or if the special file
          /dev/lock does not exist or is not accessible for read-write
          by INGRES, concurrency control acts  as  though  it  is  off
          (although  it  will suddenly come on when the lock driver is
          installed in UNIX).

          Query modification must be turned on for the protection, in-
          tegrity,  and  view  subsystems to work, however, the system
          will run slightly slower in some cases if it is  turned  on.
          It  is  possible  to turn query modification on if it is al-
          ready off in an existing database, but it is not possible to
          turn it off if it is already on.

          Databases with query modification turned off create new  re-
          lations  with all access permitted for all users, instead of
          no access except to the owner,  the  default  for  databases
          with query modification enabled.

          Database options for an existing database may be modified by
          stating the -_e flag.  The database is adjusted to conform to
          the option flags.  For example:

                  creatdb -e +q mydb

          turns query  modification  on  for  database  ``mydb''  (but
          leaves  concurrency  control  alone).  Only the database ad-
          ministrator (DBA) may use the -_e flag.

          When query modification is turned on, new relations will  be
          created  with  no  access,  but previously created relations
          will still have all access to everyone.  The _d_e_s_t_r_o_y command
          may  be  used  to remove this global permission, after which
          more selective permissions may be specified with the  _p_e_r_m_i_t
          command.

          The INGRES user may use the -_u flag to specify  a  different
          DBA:  the  flag  should be immediately followed by the login
          name of the user who should be the DBA.

          The -_m flag specifies that the UNIX directory in  which  the
          database  is  to reside already exists.  This should only be
          needed if the directory if a mounted file system,  as  might
          occur  for  a very large database.  The directory must exist
          (as .../_d_a_t_a/_b_a_s_e/_d_b_n_a_m_e), must be mode  777,  and  must  be
          empty of all files.

          The user who executes this command must have  the  U_CREATDB
          bit set in the status field of her entry in the users file.

          The INGRES superuser can create a file in .../_d_a_t_a/_b_a_s_e con-
          taining  a single line which is the full pathname of the lo-
          cation of the database.  The file must be  owned  by  INGRES
          and  be  mode 600.  When the database is created, it will be
          created in the file named,  rather  than  in  the  directory
          .../_d_a_t_a/_b_a_s_e.      For     example,     if     the     file
          .../_d_a_t_a/_b_a_s_e/_e_r_i_c_d_b contained the line

                  /mnt/eric/database

          then the database  called  ``ericdb''  would  be  physically
          stored  in  the  directory /mnt/eric/database rather than in
          the directory .../data/base/ericdb.

     EXAMPLE
          creatdb demo
          creatdb -ueric -q erics_db
          creatdb -e +q -c -u:av erics_db

     FILES
          .../files/dbtmplt7
          .../files/data/base/*
          .../files/datadir/* (for compatibility  with  previous  ver-
          sions)

     SEE ALSO
          demodb(unix),   destroydb(unix),   users(files),   chmod(I),
          destroydb(quel), permit(quel)

     DIAGNOSTICS
          No database name specified.
              You have not specified  the  name  of  the  database  to
              create (or modify) with the command.
          You may not access this database
              Your entry in the users file says you are not authorized
              to access this database.
          You are not a valid INGRES user
              You do not have a users file entry, and can not do  any-
              thing with INGRES at all.
          You are not allowed this command
              The U_CREATDB bit is not set in your users file entry.
          You may not use the -u flag
              Only the INGRES superuser may become someone else.
          <name> does not exist
              With -_e or -_m, the directory does not exist.
          <name> already exists
              Without either -_e or -_m,  the  database  (actually,  the
              directory) already exists.
          <name> is not empty
              With the -_m flag, the directory you named must be empty.
          You are not the DBA for this database
              With the -_e flag, you must be the  database  administra-
              tor.






     DESTROYDB(UNIX)              3/14/79              DESTROYDB(UNIX)



     NAME
          destroydb - destroy an existing database

     SYNOPSIS
          _d_e_s_t_r_o_y_d_b [ -_s ] [ -_m ] dbname

     DESCRIPTION
          _D_e_s_t_r_o_y_d_b will remove all reference to an existing database.
          The directory of the database and all files in that directo-
          ry will be removed.

          To execute this command the current user must be  the  data-
          base  administrator for the database in question, or must be
          the INGRES superuser and have the -_s flag stated.

          The -_m flag causes _d_e_s_t_r_o_y_d_b not to remove the UNIX directo-
          ry.  This is useful when the directory is a separate mounted
          UNIX file system.

     EXAMPLE
          destroydb demo
          destroydb -s erics_db

     FILES
          .../data/base/*

     SEE ALSO
          creatdb(unix)

     DIAGNOSTICS
          invalid dbname - the database name specified is not a  valid
              name.
          you may not reference this database - the database  may  ex-
              ist,  but you do not have permission to do anything with
              it.
          you may not use the -s flag - you have tried to use  the  -_s
              flag, but you are not the INGRES superuser.
          you are not the dba - someone else created this database.
          database does not exist - this database does not exist.







     EQUEL(UNIX)                  3/14/79                  EQUEL(UNIX)



     NAME
          equel - Embedded QUEL interface to C

     SYNOPSIS
          _e_q_u_e_l [ -_d ] [ -_f ] [ -_r ] file.q ...

     DESCRIPTION
          _E_q_u_e_l provides the user with a  method  of  interfacing  the
          general  purpose programming language ``C'' with INGRES.  It
          consists of the EQUEL pre-compiler and the EQUEL runtime li-
          brary.

          _C_o_m_p_i_l_a_t_i_o_n

          The precompiler is invoked with the statement:

               _e_q_u_e_l [<flags>] file1.q [<flags>] file2.q ...

          where file_n.q are the source input file  names,  which  must
          end with ._q.  The output is written to the file ``file_n.c''.
          As many files as wished may be specified.
          The flags that may be used are:

          -d   Generate code to print source  listing  file  name  and
               line  number  when a run-time error occurs. This can be
               useful for debugging, but takes up process space.   De-
               faults to off.

          -f   Forces code to be on the same line in the  output  file
               as it is in the input file to ease interpreting C diag-
               nostic messages.  EQUEL will usually try to get  all  C
               code lines in the output file on the same lines as they
               were in the input file.  Sometimes  it  must  break  up
               queries into several lines to avoid C-preprocessor line
               overflows, possibly  moving  some  C  code  ahead  some
               lines.  With the -_f flag specified this will never hap-
               pen and, though the line buffer may overflow,  C  lines
               will  be on the right line.  This is useful for finding
               the line in the source file that C error diagnostics on
               the output file refer to.

          -r   Resets flags to default values.  Used to supress  other
               flags for some of the files in the argument list.

          The output files may than be compiled using the C compiler:

               _c_c file1.c file2.c ... -_l_q

          The -_l_q requests the use of the EQUEL object library.

          All EQUEL routines and globals  begin  with  the  characters
          "II",  and  so  all globals variables and procedure names of
          the form II_x_x_x are reserved for use by EQUEL and  should  be
          avoided by EQUEL users.

          _B_a_s_i_c _S_y_n_t_a_x

          EQUEL commands are indicated by lines  which  begin  with  a
          double  pound  sign (``##'').  Other lines are simply copied
          as is.  All normal INGRES commands may be used in EQUEL  and
          have  the  same effect as if invoked through the interactive
          terminal monitor.  Only retrieve commands with no result re-
          lation specified have a different syntax and meaning.

          The format of retrieve without a result relation is modified
          to:

               ## retrieve (C-variable = a_fcn { , C-variable =  a_fcn
               } )

          optionally followed (immediately) by:

               ##      [ _w_h_e_r_e _q_u_a_l ]
               ## {
                       /* C-code */
               ## }

          This statement causes the ``C-code'' to be executed once for
          each tuple retrieved, with the ``C-variable''s set appropri-
          ately.  Numeric values of any type are converted  as  neces-
          sary.   No  conversion is done between numeric and character
          values.  (The normal INGRES _a_s_c_i_i function may be  used  for
          this purpose.)

          Also, the following EQUEL commands are permitted.

          ## _i_n_g_r_e_s [ingres flags] data_base_name
               This command starts INGRES  running,  and  directs  all
               dynamically   following   queries   to   the   database
               _d_a_t_a__b_a_s_e__n_a_m_e.  It is a run-time error to execute this
               command  twice  without  an intervening ``## exit'', as
               well as to issue queries while an ``## ingres''  state-
               ment is not in effect.  Each flag should be enclosed in
               quotes to avoid confusion in the EQUEL parser:

                       ## ingres "-f4f10.2" "-i212" demo

          ## _e_x_i_t
               Exit simply exits from INGRES.  It is equivalent to the
               _\_q command to the teletype monitor.

          _P_a_r_a_m_e_t_r_i_z_e_d _Q_u_e_l _S_t_a_t_e_m_e_n_t_s

          Quel statements with target lists may  be  ``parametrized''.
          This  is  indicated by preceding the statement with the key-
          word ``param''.  The target list of a parametrized statement
          has the form:

                  ( _t_l__v_a_r, _a_r_g_v )

          where _t_l__v_a_r is taken to be a string  pointer  at  execution
          time  (it  may be a string constant) and interpreted as fol-
          lows.  For any parametrized EQUEL  statement  except  a  re-
          trieve without a result relation (no ``into rel'') (i.e. ap-
          pend, copy,  create,  replace,  retrieve  into)  the  string
          _t_l__v_a_r  is  taken  to  be  a regular target list except that
          wherever a `%' appears a valid INGRES type (f4, f8, i2,  i4,
          c)  is expected to follow.  Each of these is replaced by the
          value of the corresponding entry into _a_r_g_v (starting  at  0)
          which  is  interpreted  to be a pointer to a variable of the
          type indicated by the `%' sequence.  Neither  _a_r_g_v  nor  the
          variables which it points to need be declared to EQUEL.  For
          example:

               char    *argv[10];

                       argv[0] = &double_var;
                       argv[1] = &int_var;
               ##      param append to rel
               ##              ("dom1 = %f8, dom2 = %i2", argv)
               ##      /* to escape the "%<ingres_type>" mechanism use "%%" */
               ##      /* This places a single `%' in the string. */

          On a retrieve to C-variables, within _t_l__v_a_r, instead of  the
          C-variable  to  retrieve into, the same `%' escape sequences
          are used to denote the type of the corresponding argv  entry
          into which the value will be retrieved.

          The qualification of any query may be replaced by  a  string
          valued  variable,  whose contents is interpreted at run time
          as the text of the qualification.

          The _c_o_p_y statement may also be parametrized.   The  form  of
          the parametrized _c_o_p_y is analogous to the other parametrized
          statements: the target list may be parametrized in the  same
          manner  as  the  _a_p_p_e_n_d  statements,  and  furthermore,  the
          _f_r_o_m/_i_n_t_o keyword may be replaced by a string  valued  vari-
          able whose content at run time should be _i_n_t_o or _f_r_o_m.

          _D_e_c_l_a_r_a_t_i_o_n_s

          Any valid C variable declaration on a line beginning with  a
          ``##''  declares  a  C-variable that may be used in an EQUEL
          statement and as a normal variable.  All variables  must  be
          declared  before being used.  Anywhere a constant may appear
          in an INGRES command, a C-variable may appear.  The value of
          the C-variable is substituted at execution time.

          Neither nested structures nor variables of type _c_h_a_r (as op-
          posed  to  pointer  to  char  or array of char) are allowed.
          Furthermore, there are two restrictions in the way variables
          are referenced within EQUEL statements.  All variable usages
          must be dereferenced  and/or  subscripted  (for  arrays  and
          pointers),  or  selected  (for structure variables) to yield
          lvalues (scalar values).  _C_h_a_r variables are used  by  EQUEL
          as  a means to use _s_t_r_i_n_g_s.  Therefore when using a _c_h_a_r ar-
          ray or pointer it must be dereferenced only to a ``_c_h_a_r *''.
          Also,  variables  may  not  have parentheses in their refer-
          ences.  For example:

               ## struct xxx
               ## {
                       int     i;
               ##      int     *ip;
               ## }    **struct_var;

               /* not allowed */
               ##      delete p where p.ifield = *(*struct_var)->ip

               /* allowed */
               ##      delete p where p.ifield = *struct_var[0]->ip

          C variables declared to EQUEL have either  global  or  local
          scope.   Their scope is local if their declaration is within
          a free (not bound to a retrieve) block  declared  to  EQUEL.
          For example:

               /* globals scope variable */
               ## int  Gint;

               func(i)
               int     i;
               ## {
                       /* local scope variable */
               ##      int     *gintp;
                       ...
               ## }

          If a variable of one of the char types is used  almost  any-
          where  in an EQUEL statement the content of that variable is
          used at run time.  For example:

               ##      char    *dbname[MAXDATABASES + 1];
                       int     current_db;
                       dbname[current_db] = "demo";
               ##      ingres dbname[current_db]

          will cause INGRES to be invoked  with  data  base  ``demo''.
          However,  if  a variable's name is to be used as a constant,
          then the non-referencing operator `#' should be  used.   For
          example:

               ## char *demo;

                       demo = "my_database";

                       /* ingres -d my_database */
               ##      ingres "-d" demo

                       /* ingres -d demo */
               ##      ingres "-d" #demo

          The C-preprocessor's #include feature may be used  on  files
          containing  equel statements and declarations if these files
          are named _a_n_y_t_h_i_n_g._q._h.  An EQUEL processed version  of  the
          file, which will be #included by the C-preprocessor, is left
          in _a_n_y_t_h_i_n_g._c._h.

          _E_r_r_o_r_s _a_n_d _I_n_t_e_r_r_u_p_t_s

          INGRES and run-time EQUEL errors cause the  routine  _I_I_e_r_r_o_r
          to  be  called,  with the error number and the parameters to
          the error in an array of string pointers as in a C  language
          main  routine.   The  error  message  will  be looked up and
          printed. before printing  the  error  message,  the  routine
          (*IIprint_err)()  is  called  with  the  error  number  that
          ocurred  as  its  single   argument.   The   error   message
          corresponding    to    the    error   number   returned   by
          (*IIprint_err)()  will  be  printed.    Printing   will   be
          supressed if (*IIprint_err)() returns 0.  IIprint_err may be
          reassigned to, and is useful for programs which  map  INGRES
          errors  into  their own error messages.  In addition, if the
          ``-_d'' flag was set the file name and line number of the er-
          ror  will be printed.  The user may write an IIerror routine
          to do other tasks as long as the setting of IIerrflag is not
          modified as this is used to exit retrieves correctly.

          Interrupts are caught by equel if they  are  not  being  ig-
          nored.  This insures that the rest of INGRES is in sync with
          the EQUEL process.  There is a  function  pointer,  IIinter-
          rupt, which points to a function to call after the interrupt
          is caught. The user may use this to service  the  interrupt.
          It  is  initialized to "exit()" and is called with -1 as its
          argument.  For example:

                  extern int (*IIinterrupt)();
                  extern reset();

                  setexit();
                  IIinterrupt = reset;
                  mainloop();

          To ignore interrupts, signal() should be called  before  the
          ## ingres satatement is executed.

     FILES
          .../files/error8_*
               Can be used  by  the  user  to  decipher  INGRES  error
               numbers.
          .../lib/libq.a
               Run time library.

     SEE ALSO
          .../doc/other/equeltut.q, C reference manual,  ingres(UNIX),
          quel(QUEL)

     BUGS
          The C-code embedded in the tuple-by-tuple retrieve operation
          may  not contain additional QUEL statements or recursive in-
          vocations of INGRES.

          There is no way to specify an _i_1 format C-variable.

          Includes of an equel  file  within  a  parameterized  target
          list,  or within a C variable's array subscription brackets,
          isn't done correctly.






     HELPR(UNIX)                  3/14/79                  HELPR(UNIX)



     NAME
          helpr - get information about a database.

     SYNOPSIS
          _h_e_l_p_r [ -_u_n_a_m_e ] [ +__w ] database relation ...

     DESCRIPTION
          _H_e_l_p_r gives information about the named relation(s)  out  of
          the database specified, exactly like the _h_e_l_p command.

          Flags accepted are -_u and +__u.  Their meanings are  identical
          to the meanings of the same flags in INGRES.

     SEE ALSO
          ingres(unix), help(quel)

     DIAGNOSTICS
          bad flag - you have specified a flag which is not  legal  or
              is in bad format.
          you may not access database - this database is prohibited to
              you based on status information in the users file.
          cannot access database - the database does not exist.







     INGRES(UNIX)                 3/14/79                 INGRES(UNIX)



     NAME
          ingres - INGRES relational data base management system

     SYNOPSIS
          _i_n_g_r_e_s [ _f_l_a_g_s ] dbname [ process_table ]

     DESCRIPTION
          This is the UNIX command which is  used  to  invoke  INGRES.
          Dbname  is  the name of an existing data base.  The optional
          flags have the following meanings (a ``+_''  means  the  flag
          may  be stated ``+_x'' to set option _x or ``-_x'' to clear op-
          tion _x.  ``-'' alone means that ``-_x'' must be stated to get
          the _x function):

          +_U        Enable/disable direct update of the  system  rela-
                    tions  and  secondary indicies.  You must have the
                    000004 bit in the status field of the  users  file
                    set  for this flag to be accepted.  This option is
                    provided for  system  debugging  and  is  strongly
                    discouraged for normal use.
          -uname    Pretend you are the  user  with  login  name  _n_a_m_e
                    (found in the users file).  If _n_a_m_e is of the form
                    :_x_x, _x_x is the two character user code of a  user.
                    This  may only be used by the DBA for the database
                    or by the INGRES superuser.
          -cN       Set the minimum field width for printing character
                    domains to _N.  The default is 6.
          -ilN      Set integer output field width to _N.  _l may be  1,
                    2, or 4 for i1's, i2's, or i4's repectively.
          -flxM.N   Set floating point output field width to _M charac-
                    ters  with  _N  decimal places.  _l may be 4 or 8 to
                    apply to f4's or f8's respectively.  _x may  be  _e,
                    _E,  _f,  _F, _g, _G, _n, or _N to specify an output for-
                    mat.  _E is exponential form, _F is  floating  point
                    form,  and  _G  and _N are identical to _F unless the
                    number is too big to fit in that field, when it is
                    output  in  _E format.  _G format guarantees decimal
                    point alignment; _N does not.  The  default  format
                    for both is _n_1_0._3.
          -vX       Set the column seperator for retrieves to the ter-
                    minal  and print commands to be _X.  The default is
                    vertical bar.
          -rM       Set modify mode on the _r_e_t_r_i_e_v_e command to  _M.   _M
                    may  be  _i_s_a_m,  _c_i_s_a_m,  _h_a_s_h,  _c_h_a_s_h, _h_e_a_p, _c_h_e_a_p,
                    _h_e_a_p_s_o_r_t, or _c_h_e_a_p_s_o_r_t, for ISAM, compressed ISAM,
                    hash   table,   compressed   hash   table,   heap,
                    compressed heap, sorted heap, or compressed sorted
                    heap.  The default is ``cheapsort''.
          -nM       Set modify mode on the _i_n_d_e_x command to _M.  _M  can
                    take  the  same  values as the -_r flag above.  De-
                    fault is ``isam''.
          +_a        Set/clear the autoclear  option  in  the  terminal
                    monitor.  It defaults to set.
          +_b        Set/reset batch update.  Users must the 000002 bit
                    set in the status field of the users file to clear
                    this flag.   This  flag  is  normally  set.   When
                    clear,  queries  will  run slightly faster, but no
                    recovery can take place.  Queries which  update  a
                    secondary  index  automatically  set this flag for
                    that query only.
          +_d        Print/don't print the dayfile.  Normally set.
          +_s        Print/don't print any of the monitor messages, in-
                    cluding  prompts.  This flags is normally set.  If
                    cleared, it also clears the -_d flag.
          +_w        Wait/don't wait for the database.  If the +_w  flag
                    is  present, INGRES will wait if certain processes
                    are running (purge,restore, and/or sysmod) on  the
                    given   data   base.   Upon  completion  of  those
                    processes INGRES will proceed.  If the -_w flag  is
                    present,  a  message  is  returned  and  execution
                    stopped if the data base is not available.  If the
                    +__w  flag  is omitted and the data base is unavail-
                    able, the error message is returned if  INGRES  is
                    running  in foreground (more precisly if the stan-
                    dard input is from a terminal), otherwise the wait
                    option is invoked.

          _P_r_o_c_e_s_s__t_a_b_l_e is the pathname of a UNIX file  which  may  be
          used  to specify the run-time configuration of INGRES.  This
          feature is intended for use in system maintenance only,  and
          its  unenlightened  use  by  the  user community is strongly
          discouraged.

          Note: It  is  possible  to  run  the  monitor  as  a  batch-
          processing interface using the `<', `>' and `|' operators of
          the UNIX  shell,  provided  the  input  file  is  in  proper
          monitor-format.

     EXAMPLE
          ingres demo
          ingres -d demo
          ingres -s demo < batchfile
          ingres -f4g12.2 -i13 +b -rhash demo

     FILES
          .../files/users - valid INGRES users
          .../data/base/* - data bases
          .../datadir/* - for compatability with previous versions
          .../files/proctab8 - runtime configuration file


     SEE ALSO
          monitor(quel)

     DIAGNOSTICS
          Too many options to INGRES - you have stated too many  flags
              as INGRES options.
          Bad flag format - you have stated a flag in a  format  which
              is not intelligible, or a bad flag entirely.
          Too many parameters - you have given a database name, a pro-
              cess  table  name,  and  ``something else'' which INGRES
              doesn't know what to do with.
          No database name specified
          Improper database name - the database name is not legal.
          You may not access database _n_a_m_e - according  to  the  users
              file, you do not have permission to enter this database.
          You are not authorized to use  the  _f_l_a_g  flag  -  the  flag
              specified requires some special authorization, such as a
              bit in the users file, which you do not have.
          Database _n_a_m_e does not exist
          You are not a valid INGRES user - you have not been  entered
              into  the  users  file, which means that you may not use
              INGRES at all.
          You may not specify this process table - special  authoriza-
              tion is needed to specify process tables.
          Database temporarily unavailable - someone else is currently
              performing some operation on the database which makes it
              impossible for you  to  even  log  in.   This  condition
              should disappear shortly.







     PRINTR(UNIX)                 3/14/79                 PRINTR(UNIX)



     NAME
          printr - print relations

     SYNOPSIS
          _p_r_i_n_t_r [ _f_l_a_g_s ] database relation ...

     DESCRIPTION
          _P_r_i_n_t_r prints the named  relation(s)  out  of  the  database
          specified, exactly like the _p_r_i_n_t command.  Retrieve permis-
          sion must be granted to all people to execute this command.

          Flags accepted are -_u, +__w, -_c, -_i, -_f, and -_v.  Their  mean-
          ings  are  identical  to  the  meanings of the same flags in
          INGRES.

     SEE ALSO
          ingres(unix), print(quel)

     DIAGNOSTICS
          bad flag - you have specified a flag which is not  legal  or
              is in bad format.
          you may not access database - this database is prohibited to
              you based on status information in the users file.
          cannot access database - the database does not exist.







     PURGE(UNIX)                  3/14/79                  PURGE(UNIX)



     NAME
          purge - destroy all expired and temporary relations

     SYNOPSIS
          _p_u_r_g_e [ -_f ] [ -_p ] [ -_a ] [ -_s ] [ +__w ] [ database ... ]

     DESCRIPTION
          _P_u_r_g_e searches the named databases deleting system temporary
          relations.   When  using the -_p flag, expired user relations
          are deleted.  The -_f flag will cause unrecognizable files to
          be deleted, normally purge will just report these files.

          Only the database administrator (the DBA) for a database may
          run  purge,  except the INGRES superuser may purge any data-
          base by using the -_s flag.

          If no databases are specified all databases  for  which  you
          are the DBA will be purged.  All databases will be purged if
          the INGRES superuser has specified the -_s flag.  The -_a flag
          will cause purge to print a message about the pending opera-
          tion and execute it only if the response if a `y'.  Any oth-
          er response is interpreted as ``no''.

          _P_u_r_g_e will lock the data base while it is  being  processed,
          since errors may occur if the database is active while purge
          is working on the database.  If a data base  is  busy  _p_u_r_g_e
          will  report  this  and go on to the next data base, if any.
          If standard input is not a terminal _p_u_r_g_e will wait for  the
          data  base  to be free.  If -_w flag is stated _p_u_r_g_e will not
          wait, regardless of standard  input.   The  +_w  flag  causes
          _p_u_r_g_e to always wait.

     EXAMPLES
          purge -p +w tempdata
          purge -a -f

     SEE ALSO
          save(quel), restore(unix)

     DIAGNOSTICS
          who are you? - you are not entered into the users file.
          not ingres superuser - you have tried to use the -_s flag but
              you are not the INGRES superuser.
          you are not the dba - you have tried to purge a database for
              which you are not the DBA.
          cannot access database - the database does not exist.

     BUGS
          If no database names are given, only the  databases  located
          in the directory _d_a_t_a/_b_a_s_e are purged, and not the old data-
          bases in _d_a_t_a_d_i_r.  Explicit database names  still  work  for
          databases in either directory.







     RESTORE(UNIX)                3/14/79                RESTORE(UNIX)



     NAME
          restore - recover from an INGRES or UNIX crash.

     SYNOPSIS
          _r_e_s_t_o_r_e [ -_a ] [ -_s ] [ +__w ] [ database ... ]

     DESCRIPTION
          _R_e_s_t_o_r_e is used to restore a data base after  an  INGRES  or
          UNIX crash.  It should always be run after any abnormal ter-
          mination to ensure the integrity of the data base.

          In order to run restore, you must be the DBA for  the  data-
          base  you  are restoring or the INGRES superuser and specify
          the -_s flag.

          If no databases are specified then all databases  for  which
          you  are  the  DBA  are restored.  All databases will be re-
          stored if the INGRES superuser has specified the -_s flag.

          If the -_a flag is specified you will be asked before restore
          takes any serious actions.  It is advisable to use this flag
          if  you  suspect  the  database  is  in  bad  shape.   Using
          /dev/null as input with the -_a flag will provide a report of
          problems in the data base.  If there were  no  errors  while
          restoring  a  database,  _p_u_r_g_e will be called, with the same
          flags that were given to _r_e_s_t_o_r_e, to remove  unwanted  files
          and  system  temporaries.  _R_e_s_t_o_r_e may be called with the -_f
          and/or -_p flags for _p_u_r_g_e.  Unrecognized files  and  expired
          relations are not removed unless the proper flags are given.
          In the case of an incomplete destroy, create  or  index  _r_e_-
          _s_t_o_r_e  will  not  delete files for partially created or des-
          troyed relations.  _P_u_r_g_e must be called with the -_f flag  to
          accomplish this.

          _R_e_s_t_o_r_e locks the data base while it is being processed.  If
          a  data  base  is busy _r_e_s_t_o_r_e will report this and go on to
          the next data base.  If standard input is not a terminal _r_e_-
          _s_t_o_r_e  will  wait  for  the data base to be free.  If the -_w
          flag is set _r_e_s_t_o_r_e will not wait regardless of standard in-
          put.  If +_w is set it will always wait.

          _R_e_s_t_o_r_e can recover a database from an update which had fin-
          ished filling the batch file.  Updates which did not make it
          to this stage should be  rerun.   Similarly  modifies  which
          have finished recreating the relation will be completed (the
          relation relation and attribute relations will be  updated).
          If  a  destroy was in progress it will be carried to comple-
          tion, while a create will almost always be backed out.  Des-
          troying a relation with an index should destroy the index so
          _r_e_s_t_o_r_e may report that a secondary relation has been  found
          with no primary.

          If interrupt (signal 2) is received the current database  is
          closed  and the next, if any, is processed.  Quit (signal 3)
          will cause restore to terminate.

     EXAMPLE
          restore -f demo
          restore -a grants < /dev/null

     DIAGNOSTICS
          All diagnostics are followed by a tuple from a system  rela-
          tions.

          ``No relation for attribute(s)''  -  the  attributes  listed
               have no corresponding entry in the relation relation
          ``No primary relation for index'' - the tuple printed is the
               relation tuple for a secondary index for which there is
               no primary relation.  The  primary  probably  was  des-
               troyed the secondary will be.
          ``No indexes entry for primary relation'' - the tuple is for
               a  primary relation, the relindxd domain will be set to
               zero.  This is the product of an incomplete destroy.
          ``No indexes entry for index'' - the tuple is for  a  secon-
               dary  index,  the index will be destroyed.  This is the
               product of an incomplete destroy.
          ``_r_e_l_n_a_m_e is index for'' - an index has  been  found  for  a
               primary  which  is  not marked as indexed.  The primary
               will be so marked.  This is probably the product of  an
               incomplete  index  command.   The  index will have been
               created properly but not modified.
          ``No file for'' - There is no data for this relation  tuple,
               the  tuple  will  be deleted.  If, under the -_a option,
               the tuple is not deleted purge will not be called.
          ``No secondary index for indexes entry'' - An entry has been
               found  in  the indexes relation for which the secondary
               index does not exist (no relation relation tuple).  The
               entry will be deleted.

     SEE ALSO
          purge(unix)

     BUGS
          If no database names are given, only the  databases  located
          in the directory _d_a_t_a/_b_a_s_e are restored, and not the old da-
          tabases in _d_a_t_a_d_i_r.  Explicit database names still work  for
          databases in either directory.







     SYSMOD(UNIX)                 3/14/79                 SYSMOD(UNIX)



     NAME
          sysmod - modify system relations  to  predetermined  storage
          structures.

     SYNOPSIS
          _s_y_s_m_o_d [ -_s ] [ -_w ] dbname [ _r_e_l_a_t_i_o_n ]  [  _a_t_t_r_i_b_u_t_e  ]  [
          _i_n_d_e_x_e_s ] [ _t_r_e_e ] [ _p_r_o_t_e_c_t ] [ _i_n_t_e_g_r_i_t_i_e_s ]

     DESCRIPTION
          _S_y_s_m_o_d will modify the relation, attribute,  indexes,  tree,
          protect,  and  integrities relations to hash unless at least
          one of the _r_e_l_a_t_i_o_n, _a_t_t_r_i_b_u_t_e, _i_n_d_e_x_e_s, _t_r_e_e,  _p_r_o_t_e_c_t,  or
          _i_n_t_e_g_r_i_t_i_e_s  parameters  are given, in which case only those
          relations given as parameters are modified.  The system  re-
          lations are modified to gain maximum access performance when
          running INGRES.  The user must be the data base  administra-
          tor  for  the specified database, or be the INGRES superuser
          and have the -_s flag stated.

          _S_y_s_m_o_d should be run on a data base when it is first created
          and  periodically  thereafter  to maintain peak performance.
          If many relations and secondary indices are  created  and/or
          destroyed, _s_y_s_m_o_d should be run more often.

          If the data base is being used while _s_y_s_m_o_d is running,  er-
          rors  will occur.  Therefore, _s_y_s_m_o_d will lock the data base
          while it is being processed.  If the data base is busy, _s_y_s_-
          _m_o_d  will  report this.  If standard input is not a terminal
          _s_y_s_m_o_d will wait for the data base to be free.  If  -_w  flag
          is  stated  _s_y_s_m_o_d will not wait, regardless of standard in-
          put.  The +_w flag causes _s_y_s_m_o_d to always wait.

          The system relations are modified to hash; the relation  re-
          lation is keyed on the first domain, the indexes, attribute,
          protect, and integrities relations are keyed  on  the  first
          two  domains, and the tree relation is keyed on domains one,
          two, and five.  The relation and  attribute  relations  have
          the minpages option set at 10, the indexes, protect, and in-
          tegrities relations have the minpages value set at 5.

     SEE ALSO
          modify(quel)






     USERSETUP(UNIX)              3/14/79              USERSETUP(UNIX)



     NAME
          usersetup - setup users file

     SYNOPSIS
          .../_b_i_n/_u_s_e_r_s_e_t_u_p [ flags [ pathname ] ]

     DESCRIPTION
          The /_e_t_c/_p_a_s_s_w_d file is read and reformatted to  become  the
          INGRES users file, stored into .../_f_i_l_e_s/_u_s_e_r_s.  If _p_a_t_h_n_a_m_e
          is specified, it replaces ``...''.  If  pathname  is  ``-'',
          the result is written to the standard output.

          The user name, user, and group id's are  initialized  to  be
          identical  to  the  corresponding  entry  in the /_e_t_c/_p_a_s_s_w_d
          file.  The status field is initialized to be 000001,  except
          for user _i_n_g_r_e_s, which is initialized to all permission bits
          set.  If the _s_t_a_t_u_s parameter is provided, the field is  set
          to  this  instead.  The ``initialization file'' parameter is
          set to the file ._i_n_g_r_e_s in the user's login directory.   The
          user code field is initialized with sequential two-character
          codes.  All other fields are initialized to be null.

          After running _u_s_e_r_s_e_t_u_p, the _u_s_e_r_s file must be edited.  Any
          users who are to have any special authorizations should have
          the status field changed, according to the specifications in
          users(files).   To  disable a user from executing INGRES en-
          tirely, completely remove her line from the users file.

          As UNIX users are added  or  deleted  from  the  /_e_t_c/_p_a_s_s_w_d
          file,  the _u_s_e_r_s file will need to be editted to reflect the
          changes.  For deleted users, it is only necessary to  delete
          the  line for that user from the _u_s_e_r_s file.  To add a user,
          you must assign that user a code in the form "aa" and  enter
          a line in the users file in the form:
                  name:cc:uid:gid:status:flags:proctab:initfile::databases
          where  _n_a_m_e  is the user name (taken from the first field of
          the /_e_t_c/_p_a_s_s_w_d file entry for this user), _c_c  is  the  user
          code assigned, which must be exactly two characters long and
          must not be the same as any other existing user  codes,  _u_i_d
          and _g_i_d are the user and group ids (taken from the third and
          fourth fields in  the  /_e_t_c/_p_a_s_s_w_d  entry),  _s_t_a_t_u_s  is  the
          status  bits  for  this user, normally 000000, _f_l_a_g_s are the
          default flags for INGRES (on a per-user basis),  _p_r_o_c_t_a_b  is
          the  default  process table for this user (which defaults to
          =_p_r_o_c_t_a_b_8), and _d_a_t_a_b_a_s_e_s is a list of  the  databases  this
          user may enter.  If null, she may use all databases.  If the
          first character is a dash (``-''),  the  field  is  a  comma
          separated list of databases which she may not enter.  Other-
          wise, it is a list of databases which she may enter.

          The _d_a_t_a_b_a_s_e_s field includes the names  of  databases  which
          may be created.

          _U_s_e_r_s_e_t_u_p may be executed only once, to initially create the
          _u_s_e_r_s file.

     FILES
          .../files/users
          /etc/passwd

     SEE ALSO
          ingres(unix), passwd(5), users(files)

     BUGS
          It should be able to bring the _u_s_e_r_s file up to date.


