Administrating and Supporting ORACLE7 For A/UX - Part 2 (10/93)

This technical information was provided by Oracle. This document was not
written by Apple or tested for accuracy, but it's included because we feel
you might find it useful.

This is part 2 of 2, of an Oracle technical note on Administrating and
Supporting ORACLE7 for A/UX. To find part 1 or 2, search for an article
titled, "Administrating and Supporting ORACLE7 For A/UX - Part 1 (10/93)."


Tips For Administrating and Supporting ORACLE7 For A/UX            Desktop
Victor Grigorieff
September 29, 1993                                        Apple A/UX 3.0.1

Revised: 10/28/93 by Victor Grigorieff


File Management
---------------

ls          ls gives a listing of the files in the current directory.

           ls -lF gives a useful long listing, and places a '/' after the
           name of each directory, and a '*' after each executable
           program.

           ls -a lists all files, including files that begin with the "."

cd          cd changes the current directory.

           'cd /' changes the active directory to the root of the
           filesystem.

           'cd ..' changes to the parent directory of the current
           directory.

pwd         pwd tells you what directory you are accessing.

mkdir       'mkdir new_directory' makes a new directory called
           'new_directory'

cp          cp is the command to copy a file to a new file.

           'cp -r' is a recursive copy, which can copy directories and

           their contents.

mv          mv is the command to move or rename a file.  mv is not capable
           of moving a file from one filesystem to another.

chmod       chmod <new permissions> <some_file> changes the permission bits
           on  a file.  chmod is often used to either restrict access to a
           file, or to enable the 'setuid bit' on an executable program.

           A file has certain permission bits, which determine the rights
           to read, write, and execute the file.  These permissions are
           given differently to the owner of the file, the group to which
           the file belongs, and everyone else.

           ls -l will give a full listing of files, and the left-most
           column is a listing of permission bits.

           -rwxr-xr-x   1 oracle   dba      4122655 Jun 19 14:19 sqldba*

           There are a total of 10 characters in the left column.

           The first character is '-' for a file, and 'd' if the item is a
           directory.


           The next 9 characters are 3 groups of 3 characters each.
           Each group determines the rights to read, write, and execute.

           rwx means that read, write, and execute rights are enabled
           r-x means that read and execute are enabled, but writing is
           not.

           If the letter is present in a particular position, the right is
           enabled.  If there is a '-', the permission is disabled.

           The first group of letters corresponds to the rights granted to
           the owner of the file.  The userid listed in the third column
           of the ls -l output is the owner of the file.

             ** If the owner's permissions are 'rws', then the setuid bit
             ** is set, meaning that the program will run with all of the
             ** rights as the owner of the program, regardless of who
             ** invokes the program.

           The second group of letters corresponds to the rights of the
           group to which the file corresponds, which is the fourth

           parameter of the ls -l output.

           The third group of letters defines the permissions for
           everybody.

           -rwxr-xr-x means that everyone can read and execute the file,
                      but only the owner can write (modify) it.

           -rwsr-x--- means that the setuid bit is enabled, people in the
                      group which owns the file may read and execute the
                      file, but people outside of the group have no access
                      to the program.

           To set the permissions, you need to assemble a string of 3
           numbers to tell chmod how to set the permissions. Different
           privileges are enabled by adding up the numbers below:

           read -    4
           write -   2
           execute - 1

           read and execute privilege (4 + 1) are 5
           read, write, and execute (4 + 2 + 1) are 7
           to set the setuid bit, you prefix your string with the number
           4.

           chmod  755  (yields -rwxr-xr-x)

           chmod  400  (yields -r--------)
           chmod 4755  (yields -rwsr-xr-x)  (The setuid bit is enabled)

           The files 'orasrv' and 'oracle' (which are located in the
           /users/oracle/bin) should be -rwsr-xr-x.  You can set these
           permissions with the command:

           chmod 4755 orasrv oracle

chown       chown <new_owner> <some_file> changes the ownership of
           <some_file> to be owned by <new_owner>.  Only the current owner
           or the superuser (root) may issue this command.

           Only the owner and the superuser (root) may delete a file.
           the ownership of a file is usually most important with
           executable files that have the setuid bit set (see chmod
           above).

           *** Note:  when you change the ownership of a file, the
           ***        permission bits can be changed.  You may need to use
           ***        the chmod command to get the proper setting.

chgrp       chgrp <new_group> <some_file> changes the group ownership of

           <some_file> to be owned by <new_group>.  Only the current owner
           or the superuser (root) may issue this command.

find        find can be used to locate files, and perform an action on each
           of them if desired.

           find . -exec ls -l {}\\;

           This command looks a bit confusing, but it gives a long listing
           of the files in the current directory, as well as all of the
           subdirectories.  Check the manual pages on find for more
           detailed information.

tar         tar creates archives and extracts data from them.

           tar -cf archive.tar something
             (creates a new archive called 'archive.tar' containing a copy
              of 'something'.  Something could be a file, or a filesystem)

           ** Note: NEVER try to back up a database that is RUNNING.
           **       copies of running databases WILL NOT WORK.

           tar -xf archive.tar
             (extracts the contents of archive.tar into the current

              directory)

compress    'compress some_file' will create a compressed version of the
           file called some_file.Z, and deletes some_file.  You must
           uncompress the some_file.Z before using it again.

Filesystem Management
---------------------

If you are not familiar with filesystems, mounting of filesystems, or disk
setup in general on A/UX 3.0.1, please refer to the "Disk Setup" section of
Bulletin #103947.028 -- "Setting up an AWS 95 Server for ORACLE7 for A/UX".

df -B       df will give you a line of information for each of the mounted
           filesystems.  Note the capital letter 'B', which specifies
           that the results should be given in kilobytes.

           df -B
           Filesystem        kbytes    used   avail %used  Mounted on
           /dev/dsk/c0d0s0   140519  125637    7856   94%  /
           /dev/dsk/c300d0s  637015  523524   81640   87%  /u1
           /dev/dsk/c401d0s 1122889  805559  261185   76%  /u2

           This command tells you which filesystems were successfully

           mounted, where they are mounted, how big they are, and how much
           space is available on each of them.

           ** Notice that the 'Filesystem' column is not giving you the
           ** first 16 letters in the name of the disk device file.  If
           ** you need the full name, check the /etc/fstab file, or use
           ** the df command without the -B flag.

/etc/fstab  the fstab file has one line for each filesystem which should be
           mounted.  It specifies the type of filesystem, where to mount
           it, and on what device it resides.

           # fstab for Squid 6/23/93
           #
           /dev/dsk/c300d0s0       /       ignore  rw      1 0
           /dev/dsk/c300d0s2       /u1     4.2     rw      1 0
           /dev/dsk/c401d0s2       /u2     4.2     rw      1 0

           The lines that begin with # are ignored.  It is a good idea to
           put notes in this file that identify which machine it belongs
           to, and when it was last modified.  Whenever you modify this

           file, you should PRINT it and put it somewhere safe.

         *** IMPORTANT:  having a printout of the fstab file is very
         ***             helpful if your machine has a damaged root
         ***             partition, and you need to remember where all of
         ***             your filesystems reside.  You need to know the
         ***             location of your root filesystem.
         ***             /dev/dsk/c300d0s0 is the default, but it may be
         ***             different on your system.

         ***  I like to tape a printout of this file to the machine.

fsck        fsck checks filesystem consistency and interactively repairs
           the filesystem.  If a filesystem will not mount, you need to
           run fsck on it to verify and fix it.  fsck works on a disk
           device file that corresponds to the filesystem in question.  If
           the filesystem which normally mounts fine on u1 is not
           mounting, I need to run fsck.  I can't just run 'fsck u1'.  I

           need to run fsck on the disk device file that was listed in the
           /etc/fstab file that corresponds to the problematic filesystem.

           squid.root # fsck /dev/dsk/c300d0s2
           ** /dev/dsk/c300d0s2
           ** Last Mounted on /u1
           ** Phase 1 - Check Blocks and Sizes
           ** Phase 2 - Check Pathnames
           ** Phase 3 - Check Connectivity
           ** Phase 4 - Check Reference Counts
           ** Phase 5 - Check Cyl groups
           FILE SYSTEM STATE IS MARKED AS DIRTY
           FIX?

           When you find out "FILE SYSTEM STATE IS MARKED AS DIRTY", you
           do NOT ALWAYS want to fix that.

              ** If the filesystem is currently mounted ( it shows up when
                 you use the df command), it will be DIRTY, which is OK.
                 Filesystems are dirty when there is data in buffers that
                 has not been written out to disk, which is fine if the
                 filesystem is mounted and in use.  If this is the case,

                 choose N.

              ** If the filesystem is not mounted (it does not show up
                 when you use the df command) then you should choose Y.

           If an Oracle database (or some other program) is writing to a
           file on a filesystem at the time a server goes down (crashes),
           then the filesystem will not mount when the server comes back
           up.  You need to run fsck to repair the dirty filesystem.

           If the dirty filesystem is the root (/) filesystem, then A/UX
           will not boot.  The A/UX Startup program will tell you that the
           root filesystem (/dev/dsk/c0d0s0) is dirty, and will present
           you with a window in which you can issue some UNIX commands.
           Try:

           fsck /dev/dsk/c300d0s0

           Once fsck completes the repairs on the filesystem, you should
           be able to type the command 'boot' to start A/UX.

mount -a    mount -a will attempt to mount every filesystem listed in the

           /etc/fstab file.  If mount -a returns no information, that
           means that it had no problem.  If it gives you errors, that
           means that either the /etc/fstab file is not set up properly,
           or the filesystem is damaged and should be checked with fsck.

           mount -a is automatically called at startup time.  You should
           only need to use this command after modifying the /etc/fstab
           file or after repairing a filesystem with fsck.

Unix Shells
-----------

.login      The .login file is in the home directory of each user.  The
           .login file contains commands which are executed automatically
           when the user logs in to the UNIX machine.

           It is often helpful to set the following in the .login file:

           setenv ORACLE_HOME /users/oracle
           setenv ORACLE_SID  SAMP
           setenv PATH        "/users/oracle/bin:/bin:/usr/bin:/usr/ucb:
                              /mac/bin:/etc:/usr/etc:/usr/local/bin"


           Adding these lines to the .login file will set these variables
           automatically when you next login, or use the source command.

PATH        PATH is the environment variable which lists the directories on
           the UNIX machine that will be searched when a command is typed.
           If I type 'do_something', and there is no program called
           'do_something' in the current directory, the shell will search
           all the directories listed in the PATH for an executable
           program called 'do_something'.  A default PATH may look like:

           PATH=:/bin:/usr/bin:/usr/ucb:/mac/bin:/etc:/usr/etc:/usr/local
                 /bin

           If you try to use the oracle program called 'sqldba' you will
           see:

           sqldba
           sqldba: Command not found.

           If you want to be able to use Oracle commands, you should add
           the bin directory of the oracle home to the PATH.  This is
           '/users/oracle/bin' by default.  Then the PATH would look like:


           PATH=:/bin:/usr/bin:/usr/ucb:/mac/bin:/etc:/usr/etc:/usr/local
                 /bin:/users/oracle/bin

           In this case, the PATH references /users/oracle/bin, so the
           sqldba command can be used without problem.

csh         csh is the C shell, which is the default shell for each user
           except root.  Use the setenv command to set environment
           variables.  when running the C shell.  This is also known as
           /bin/csh.

setenv      setenv sets environment variables under csh.

           'setenv SOME_VARIABLE some_contents' sets the variable
           SOME_VARIABLE to be some_contents.

           There are 3 environment variables which are important under
           A/UX.  They are ORACLE_HOME, ORACLE_SID, and PATH.

           ORACLE_HOME = /users/oracle ( This is the directory where the
                                         oracle files and executables
                                         reside )
           ORACLE_SID  = SAMP          ( This is the name of the default

                                         database, which is SAMP )
           PATH = ../users/oracle/bin.. (discussed in PATH section above)

sh          sh is the Bourne shell, which is the default user for the root
           user.  This is also known as /bin/sh.

           To set an environment variable in the Bourne shell, you can do:

           SOME_VARIABLE=some_contents; export SOME_VARIABLE

           It is important to add the '; export SOME_VARIABLE' to the
           line, as otherwise programs that you run will not be able to
           evaluate that environment variable.

           ORACLE_SID=SAMP; export SAMP

           This sets the ORACLE_SID to be SAMP, and allows other programs
           you run (like Oracle utilities) to read the variable.

env         env lists the names and contents of all variables in the
           current shell's environment.

source      source is used to read in a configuration file.  If you edit
           the .login file, and want the changes to take effect, you can

           log out and log in again, or read in the file.  To read in the
           .login:

           source .login

           This will run all of the commands in the .login file.

Oracle Database Management
--------------------------

tcpctl      tcpctl is a command to help you start, stop, and get the status
           of the SQL*Net TCP/IP version 1 listener.

      **   'tcpctl status' should give you the status of orasrv.

           tcpctl status
           tcputl: Status summary follows
           Server is running:
             Started             : 8-SEP-93 12:08:51
             Last connection     : 15-SEP-93 11:09:17
             Total connections   : 87
             Total rejections    : 3
             Active subprocesses : 9
             ORACLE SIDs         : S6A,S6B,S6C,S7F,SAMP
             Default SID         : (null)
           Logging mode is ENABLED.
           DBA logins are DISABLED.
           OPS$ logins are ENABLED.
           OPS$ROOT logins are DISABLED.
           Orasrv is detached from the terminal.

           Break mode = IN BAND.
           Debug level = 1
           No timeout (on orasrv handshaking).
           Length of listen queue = 10
           Orasrv logfile = /u2/7012f/tcp/log/orasrv.log
           Orasrv mapfile = /etc/oratab

           This tells you that the server is running, and has been running
           for a week.  It has serviced 87 connections since it was
           started, and there are currently 9 connections made to the
           server.  The active SIDs were read in from the /etc/oratab
           file.

           If the server is not running, it will look like:

           tcpctl status
           tcputl: server is not running: Connection refused

      **   'tcpctl start' should start the TCP/IP listener process
           (orasrv).

           tcpctl start
           tcpctl: log file is /u2/7012f/tcp/log/orasrv.log
           tcpctl: SID mapping file is /etc/oratab
           tcpctl: server will be run under oracle
           tcpctl: logging mode is on


           orasrv: Release 1.2.7.5.1 - Production on Wed Sep 15 12:01:06
           1993

           Copyright (c) Oracle Corporation 1979, 1993.  All rights
           reserved.

           Starting server on port 1525.
           tcpctl: server has been started

           This means that server was successfully started on port 1525
           (which was read in from the /orasrv entry of the etc/services
           file).

           You may get the following error if you try to issue the 'tcpctl
           start' immediately after issuing a 'tcpctl stop':

           Starting server on port 1525.
           orasrv: server already running: Address already in use

           If this happens, wait a few minutes and try again, while the
           UNIX operating system releases the port.

      **   'tcpctl stop'  should stop the TCP/IP listener process
           (orasrv).

           'tcpctl stop' requires that you log into the A/UX machine as
           the user who started the server.  You must actually log into

           the machine or telnet to the machine to have the proper
           privileges.  If I log in as a user who is not a dba, and use
           the 'su - oracle' command to become the oracle user, it will
           not work:

           tcpctl stop
           tcputl: checking user permission...
           tcputl: permission denied

           If I then telnet to this machine as oracle, or log out and log
           in as oracle, it will work:

           tcpctl stop
           tcputl: checking user permission...
           tcputl: server has been stopped

           You can also stop the orasrv process by killing it.

           ps -ef | grep orasrv   (this finds the orasrv process...)
           oracle   692       1  0  Sep 21  ?        0:02 orasrv
           vgrigori 16358 15344  2 18:17:44 p2       0:00 grep orasrv

           kill 692  (This kills the orasrv process.)

orasrv      orasrv is the SQL*Net TCP/IP version 1 listener process which
           is controlled by the tcpctl program.


atksrv      atksrv is the SQL*Net AppleTalk version 1 listener process.  It
           is invoked with the command atksrv.

           atksrv Squid
           atksrv: Release 1.0.1.2.1 - Production on Wed Sep 15 12:38:06
           1993

           Copyright (c) Oracle Corporation 1979, 1993.  All rights
           reserved.

           Server name is Squid

           Server Squid[10790] is accepting connections....

        *  If you get the error: Cannot register service "Squid" on
           network, that means that there is an AppleTalk listener using
           that name already in your zone of the AppleTalk network.

           The [10790] tells you the PID of the atksrv process.  You can
           stop the atksrv listener by hitting control-C, or by killing
           the process manually from another UNIX prompt.

           You could also kill the atksrv process in the same way you
           could kill the orasrv process, which is described in the tcpctl
           section.

sqldba      sqldba is the utility used to administrate the Oracle database.

           It can create, startup, and shutdown databases. If the database
           is not running, you can only connect to it by using 'connect
           internal'. Once connected internally, you may startup and
           shutdown the database.

           sqldba

           SQL*DBA: Release 7.0.12.2.0 - Production on Wed Sep 15 12:44:56

           Copyright (c) Oracle Corporation 1979, 1993.  All rights
           reserved.

           ORACLE7 Server Release 7.0.12.2.0 - Production
           With the procedural and distributed options
           PL/SQL Release 2.0.14.0.1

           SQLDBA> connect system/manager
           ORA-01034: ORACLE not available
           ORA-07318: smsget: open error when opening sgadef.dbf file.
           Macintosh A/UX Error: 2: No such file or directory

           The above error occurs when the database is not running. If you
           are logged in as a user in the dba group, you may connect
           internally and startup the database.

           SQLDBA> connect internal

           Connected.
           SQLDBA> startup
           ORACLE instance started.
           Database mounted.
           Database opened.
           Total System Global Area       7319428 bytes
                         Fixed Size         30492 bytes
                      Variable Size       6453352 bytes
                   Database Buffers        819200 bytes
                       Redo Buffers         16384 bytes

           After starting up the database, you may connect as a database
           user.

           SQLDBA> connect scott/tiger
           Connected.

           You could then connect internally and shutdown the database.

           SQLDBA> connect internal
           Connected.
           SQLDBA> shutdown
           Database closed.
           Database dismounted.
           ORACLE instance shut down.

Loopback    You could then attempt a TCP/IP connection to the database
           (provided you have started the orasrv process).  This is called
           a loopback, as the server machine is making a connection to

           itself, which is a useful test of the server's functionality.

           SQLDBA> connect scott/tiger@t:squid:S7F
           Connected.

         * You may get errors trying to do the loopback.

           ORA-6114 - problem with the SID you specified.  Compare the SID
                      you tried with the /etc/oratab file.

           ORA-6401 - you did not install SQL*Net TCP/IP.

           ORA-3113 - you probably did not install the C programming
                      option of A/UX and oracle was not properly
                      installed.

           ORA-6107 - you need to add the orasrv entry to /etc/services.

           ORA-6105 - you need to add the server's hostname to /etc/hosts

           ORA-6108 - orasrv is not running, or you have the wrong IP
                      address entered for your server in /etc/hosts.
                      Refer to the description of ping above.

           ORA-1034 - orasrv is running properly, but the rdbms is not.
                      Use sqldba to start the database.


           ORA-7318 - This error usually follows ORA-1034, but it means
                      the same thing.  The database is not running.

/etc/oratab       - This file lists the instances (SID's) available on the
                   A/UX machine.  The has one line per database on the
                   machine.  Lines beginning with '#' are comments which
                   are ignored.  Each line is made up of the format:
?                    SID:ORACLE_HOME:STARTUP

                   Where:  SID is the name of the database
                           ORACLE_HOME is where you installed the database
                           STARTUP is either Y or N, which indicates
                                   whether the dbstart and dbshut
                                   utilities should start or stop that
                                   database.

                   The default /etc/oratab should have the line:

                   SAMP:/users/oracle:N

                   This means that I have one database on my machine, it

                   is named SAMP, and the ORACLE_HOME for the SAMP
                   database is /users/oracle. The ORA-6114 error occurs if
                   you attempt to connect to a database that is not listed
                   in the oratab file.

                   *** The capitalization of the SID is important
                   *** 'SAMP' is different from 'samp'.


Published Date: Feb 19, 2012