UNIX / Linux Command To Check Existing Groups and Users

0 comments

Find out if user exists in /etc/passwd file

/etc/passwd file stores essential information required during login. All you have to do is search this file for user name using following syntax:
$ egrep -i "^username" /etc/passwd
For, example find out if vivek user exists or not, enter:
$ egrep -i "^vivek" /etc/passwd
Sample output:
vivek:x:1000:1000:Vivek Gite,,,,:/home/vivek:/bin/bash
A quick shell script code:
#!/bin/bash
# init
USERID="$1"
#....
/bin/egrep  -i "^${USERID}" /etc/passwd
if [ $? -eq 0 ]; then
   echo "User $USERID exists in /etc/passwd"
else
   echo "User $USERID does not exists in /etc/passwd"
fi
# ....
Normally, exit status is 0 returned if user accounts (lines) are found and 1 otherwise.

Find out if group exists in /etc/group file

/etc/group is an text file which defines the groups to which users belong under Linux and UNIX operating system. Again, you have to search /etc/group file using following syntax:
$ egrep -i "^groupname" /etc/group
For, example find out if vivek group exists or not, enter:
$ egrep -i "^vivek" /etc/group

id command

id is another command to display user / group information for any USERNAME, or the current user. To find out more about user called, tom, enter:
$ id tom
Sample output
id: tom: No such user
To find out ftpuser group, enter:
$ id -g ftpuser
Sample output:
id: ftpuser: No such user
id command exit status is 0 returned if user accounts (lines) are found and 1 otherwise. A sample shell script using id command:
#!/bin/bash
USERID="$1"
/bin/id $USERID 2>/dev/null
[ $? -eq 0 ] && echo "User found" || echo "User not found"
 
/bin/id -g $USERID 2>/dev/null
[ $? -eq 0 ] && echo "Group found" || echo "Group not found"
 
reference:
http://www.cyberciti.biz/faq/linux-check-existing-groups-users/

Oracle10g/Linux Errors and Problems

0 comments

Here is a list of common Oracle10g installation problems and other issues.

Note that most of the issues are due to not following the installation procedure correctly. And some errors are due to not using an Oracle supported Linux OS.

The Installation log file can be found in $ORACLE_BASE/oraInventory/logs.
The Database Creation log file can be found in $ORACLE_BASE/admin/$ORACLE_SID/create.


  • Checking monitor: must be configured to display at least 256 colors Failed <<<< >>> Could not execute auto check for display colors using command /usr/X11R6/bin/xdpyinfo. Check if the DISPLAY variable is set. Some optional pre-requisite checks have failed (see above). Continue? (y/n) [n]
    • I ignored this error message on my system and said "Yes" to continue. But if you want to fix it and get rid of this error message, ensure the following RPMS are installed:
      rpm -q XFree86 xf86tools cabextract libpng libjpeg XFree86-Mesa
      Example for installing these packages on SLES-9 (packages can be found on the 2nd CD):
      su - root
      rpm -Uvh XFree86-4.3.99.902-43.22.i586.rpm \
               XFree86-Mesa-4.3.99.902-43.22.i586.rpm \
               xf86tools-0.1-955.5.i586.rpm \
               cabextract-1.0-17.1.i586.rpm \
               libpng-1.2.5-182.4.i586.rpm \
               libjpeg-6.2.0-731.1.i586.rpm
    
    
  • Enterprise manager configuration failed due to the following error - Failed to allocate port(s) int the specified range for the following process(es): JMS [5540-5559], RMI [5520-5539], Database Control [5500-5519], EM agent [1830-1849]
    • The problem is that ports listed in /etc/services are discounted. The workaround is to specify the ports manually, see emca -h. Use the following options and use the port ranges as specified in the above error message:
      emca -RMI_PORT  -JMS_PORT  -AGENT_PORT  -DBCONSOLE_HTTP_PORT 
    
    
  • ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist Linux Error: 2: No such file or directory
  • or ORA-01034: ORACLE not available
      First check if ORACLE_SID is set correctly. If ORACLE_SID is set correctly, then you probably have a trailing slash "/" on the ORACLE_HOME environment variable. Remove it and try again to connect to sys (e.g from ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1/ to ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1).
    
    
  • ORA-01034: ORACLE not available ORA-27121: unable to determine size of shared memory segment Linux Error: 13: Permission denied
    • Make sure the SUID/SGID bits are set for $ORACLE_HOME/bin/oracle:
      ls -l $ORACLE_HOME/bin/oracle
      -rwsr-s--x  1 oracle oinstall 72524978 Dec 26 13:12 /u01/app/oracle/OraHome_1/bin/oracle
    
    
  • ORA-00988 missing or invalid password(s).
    • During the Oracle10g installation you probably provided a password for the Oracle database accounts that started with a digit number. Ignore this error message and change the password when you are done with the Oracle10g installation.
    
    
  • X11 connection rejected because of wrong authentication. X connection to localhost:10.0 broken (explicit kill or server shutdown).
    • To rectify this problem, try to login to the remote Oracle server again by using the "X11 forward" feature of ssh. Execute the following command from your local desktop:
      $ ssh -X oracle@oracle_remote_server_name
      Now when you try to run any GUI tool on the remote server, it will automatically be relinked to your local desktop. If this is not working, verify that the ForwardX11 setting is not set to "no" in /etc/ssh/ssh_config on your remote server:
      su - root
      grep ForwardX11 /etc/ssh/ssh_config
      #   ForwardX11 no
      ForwardX11Trusted yes
      If you are using telnet, however, you will have to set DISPLAY manually, see my other article Starting runInstaller for more information.
    
    
  • ./runInstaller: line 67: 6275 Segmentation fault $CMDDIR/install/runInstaller -formCluster $*
    • This error can come up if your system does not have a swap space.
    
    
  • Preparing to launch Oracle Universal Installer from /tmp/OraInstall2005-03-13_03-53-51PM. Please wait .../tmp/OraInstall2005-03-13_03-53-51PM/oui/lib/linux/libclntsh.so.9.0 bad CRC c0265abb (should be f138c206) Error in writing to directory /tmp/OraInstall2005-03-13_03-53-51PM. Please ensure that this directory is writable and has atleast 60 MB of disk space. Installation cannot continue.
    • Sometimes I'm getting this error message. Simply try again.

  • Recovery Manager rman hangs
      You are probably running the wrong rman binary which belongs to the XFree86-devel RPM:
      $ which rman
      /usr/X11R6/bin/rman
        
      source and reference 
      http://www.puschitz.com/InstallingOracle10gOnSUSE.shtml#TipsAndHintsForOracle10gOnLinux
  • Operations Behind BACKUP ... PLUS ARCHIVELOG Command.

    0 comments

    Backing Up Logs with BACKUP ... PLUS ARCHIVELOG
    You can add archived redo logs to a backup of other files by using the BACKUP ...PLUS ARCHIVELOG clause. Adding BACKUP ... PLUS ARCHIVELOG causes RMAN to do the following:
    1. Runs the ALTER SYSTEM ARCHIVE LOG CURRENT command.
    2. Runs BACKUP ARCHIVELOG ALL. Note that if backup optimization is enabled, then RMAN skips logs that it has already backed up to the specified device.
    3. Backs up the rest of the files specified in BACKUP command.
    4. Runs the ALTER SYSTEM ARCHIVE LOG CURRENT command.
    5. Backs up any remaining archived logs generated during the backup.

    This guarantees that datafile backups taken during the command are recoverable to a consistent state.
    To back up archived redo logs with BACKUP ... PLUS ARCHIVELOG:
    After starting RMAN, run the BACKUP ... PLUS ARCHIVELOG command at the RMAN prompt . This example backs up the database and all archived logs:
    BACKUP DEVICE TYPE sbt DATABASE PLUS ARCHIVELOG;
    note: If backup optimization is enabled, then RMAN skips backups of archived logs that have already been backed up to the specified device.

    UNIX system, small sampling of commands on various topics.

    0 comments

    1 Communication

    cuConnect to UNIX system.
    ftpFile transfer protocol.
    loginSign on to UNIX.
    mailxRead or send mail.
    rloginSign on to remote UNIX.
    talkWrite to other terminals.
    telnetConnect to another system.
    vacationRespond to mail automatically.
    writeWrite to other terminals.

    2 Comparisons

    cmpCompare two files.
    commCompare items in files.
    diffCompare two files.
    diff3Compare three files.
    dircmpCompare directories.
    sdiffCompare two files, side by side.

    3 File Management

    catJoin files or display them.
    cdChange directory.
    chmodChange access modes on files.
    cpCopy files.
    csplitBreak files at specific locations.
    fileDetermine a file's type.
    headShow the first few lines of a file.
    installSet up system files.
    lnCreate filename aliases.
    lsList files or directories.
    mkdirCreate a directory.
    moreDisplay files by screenful.
    mvMove or rename files or directories.
    pwdPrint your working directory.
    rcpCopy files to remote system.
    rmRemove files.
    rmdirRemove directories.
    splitSplit files evenly.
    tailShow the last few lines of a file.
    wcCount lines, words, and characters.

    4 Miscellaneous

    bannerMake posters from words.
    bcPrecision calculator.
    calDisplay calendar.
    calendarCheck for reminders.
    clearClear the screen.
    killTerminate a running command.
    manGet information on a command.
    niceReduce a job's priority.
    nohupPreserve a job after logging out.
    passwdSet password.
    scriptProduce a transcript of your login session.
    spellReport misspelled words.
    suBecome a superuser.

    5 Printing

    cancelCancel a printer request.
    lpSend to the printer.
    lpstatGet printer status.
    prFormat and paginate for printing.

    6 Programming

    cbC source code "beautifier."
    ccC compiler.
    cflowC function flowchart.
    ctagsC function references.
    ctraceC debugger.
    cxrefC cross-references.
    lintC debugger.
    ldLink editor.
    lexLexical analyzer.
    makeExecute commands in a specified order.
    odDump input in various formats.
    sdbSymbolic debugger.
    stripRemove data from an object file.
    trussTrace signals and system calls.
    yaccCompiler used with lex.

    7 Searching

    egrepExtended version of grep.
    fgrepSearch files for literal words.
    findSearch the system for filenames.
    grepSearch files for text patterns.
    stringsSearch binary files for text patterns.

    8 Shell Programming

    echoRepeat input on the output.
    exprPerform arithmetic and comparisons.
    lineRead a line of input.
    sleepPause during processing.
    testTest a condition.

    9 Storage

    compressCompress files to free up space.
    cpioCopy archives in or out.
    packPack files to free up space.
    pcatDisplay contents of packed files.
    tarTape archiver.
    uncompressExpand compressed (.Z) files.
    unpackExpand packed (.z) files.
    zcatDisplay contents of compressed files.

    10 System Status

    atExecute commands later.
    chgrpChange file group.
    chownChange file owner.
    crontabAutomate commands.
    dateDisplay or set date.
    dfShow free disk space.
    duShow disk usage.
    envShow environment variables.
    fingerPoint out information about users.
    psShow processes.
    ruptimeShow loads on working systems.
    shutdownRevert to single-user mode.
    sttySet or display terminal settings.
    whoShow who is logged on.

    11 Text Processing

    cutSelect columns for display.
    exLine-editor underlying vi.
    fmtProduce roughly uniform line lengths.
    foldProduce exactly uniform line lengths.
    joinMerge different columns into a database.
    nawkNew version of awk (pattern-matching language for database files).
    pasteMerge columns or switch order.
    sedNoninteractive text editor.
    sortSort or merge files.
    trTranslate (redefine) characters.
    uniqFind repeated or unique lines in a file.
    viVisual text editor.
    xargsProcess many arguments in manageable portions.

    12 Troff

    All but deroff are in the compatibility packages.

    deroffRemove troff codes.
    eqnPreprocessor for equations.
    nroffFormatter for terminal display.
    picPreprocessor for line graphics.
    tblPreprocessor for tables.
    troffFormatter for typesetting.

    http://docstore.mik.ua/orelly/unix/unixnut/index/idx_0.htm