Archive for the ‘Linux OS’ Category

Chmod With Examples Along With Quick Reference

July 1st, 2018, posted in Solaris
Share

What is chmod ?

chmod ( Change Mode ) is a command line utility in Unix , Linux and other Unix like systems to change the read, write, execute permissions of a file for owner , group and others.

How to use chmod?

Chmod command is used in two ways :
1. Using octal value & position : Sets the permission for owner, group and others with octal values , 4 for read , 2 for write , 1 for execute and any sum of these number to get cumulative permissions.

chmod syntax using octal mode
chmod [OPTION] MODE FILE

2. Using symbolic values to add, remove the file permission
u for user , g for group , o for others a for all ; r for read , w for write , x for execute , + , – & = for adding , removing and assigning r w x permissions.

chmod syntax for symbolic values
chmod [OPTION] MODE1,MODE2 FILE

3. chmod options

-R – Recursively change the permissions in the file under the directory.

chmod examples using octal mode :

  • First column shows the chmod command ,
  • second column shows how the value is calculated for the permission
  • last columns of owner, group, others shows individual octal values and actual bit set on file as seen by ls -l.
  • For setting any other permission combination for owner, group & other , pick corresponding value from each column and use with chmod command , for example chmod 264 file , chmod 400 file , chmod  755 file etc.
OWNER GROUP OTHERS
Permissions Value octal value & bit set
rwx
Read write Execute
$chmod 777 file
4+2+1 7
rwx
7
rwx
7
rwx
rw
Read & Write
$chmod 666 file
4+2 6
rw_
6
rw_
6
rw_
rx
Read & Execute
$chmod 555 file
4+1 5
r_ x
5
r_ x
5
r_ x
r
Read only
$chmod 444 file
4 4
r_ _
4
r_ _
4
r_ _
w
Write only
$chmod 222 file
2 2
_w_
2
_w_
2
_w_
x
Execute only
$chmod 111 file
1 1
_ _ x
1
_ _ x
1
_ _ x

chmod examples using symbolic mode :

Symbol are used to assign the permissions :

  • u – user , g – group,  o – others ,  a – all
  • +  to add permission  ,    to remove permission ,  = to assign permission
  • r w x   is used for read , write,execute ,  s  is used to set the sticky bit

Examples

  • chmod  ug+x file   ;  assign execute permission to user and group in file
  • chmod a+x  <file>  ;  assign execute permission to all in file
  • chmod o-x  <file>  ;  remove execute permission to others in file
  • chmod go+r  <file>  ;  assign read permission to group & others in file
  • chmod u+rwx ,g+rw,o+r  file

Special permissions – sticky bit , setuid , setguid bit

sticky bit

when sticky bit is set the file or script is kept in swap space and loaded in to memory on next request. This makes memory loading faster.

sticky bit is represented by t in symbol mode , for example

$chmod +t file.sh

In octal mode sticky bit is represented by 1

$chmod 1755 file.sh

Set user id – setuid and set group id –  setguid bits

when these bits are set for user or groups , they are given effective permission of owner of the file during run time

for example , if file.txt is owned by root and you need to give just run time root permission to some user , you can set the setuid for file.

Following examples sets the setuid , setguid on file along with normal 755 permission.

$chmod 4755 file.txt

you need to give just run time root permission to some group of users , you can set the setgid for file.

$chmod 4755 file.txt

Share

Shared Memory Tuning: Startup database – ORA-27102: out of memory Linux-X86_64 Error: 28: No space left on device

May 22nd, 2018, posted in Linux OS, Oracle Queries, Uncategorized
Share
Oracle on linux,Oracle,linux,Oracle DBA,Apps DBA,sun linux 10,sun linux,Oracle Database dba,Oracle database,Oracle Application, Linux, linux, solaris administrator, sun linux,SGA/PGA sizes,solaris SGA/PGA ,linux SGA/PGA sizes, prtconf,ORA-27102,ORA-27101: shared memory realm does not exist,ORA-27101,shared memory realm does not exist,SVR4 Error: 2: No such file or directory,Oracle Linux,Linux Oracle 
SQL> startup
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device
I have used RHEL X86_64 + memory (32GB) and setted sga_max_size=20G + sga_target=20G and …
$ cat /proc/sys/kernel/shmmax
26843545600
What wrong with my kernel tuning… So, I checked metalink (301830.1) and some recommend from RHEL
They told; set SHMALL to the total amount of physical RAM divided by page size.

SHMALL =>Total amount of shared memory available (bytes or pages)

then:
Check Page Size:
$ getconf PAGE_SIZE
4096
Determine the system wide maximum number of shared memory pages:
$ cat /proc/sys/kernel/shmall
2097152
My system 64bits with memory 32GB, then 1024 * 1024 * 1024 * 32 / 4096 = 8388608
So, change kernel.shmall = 8388608
$ su - root
# echo 8388608 > /proc/sys/kernel/shmall
Or modify /etc/sysctl.conf file:
kernel.shmall=8388608
and
# sysctl -p
After changed… check and startup database again:
$ cat /proc/sys/kernel/shmall
8388608
 
SQL> startup

.

.

.

--- NO ERROR ---
From this idea with memory 32GB
mem=$(free|grep Mem|awk '{print$2}')
totmem=$(echo "$mem*1024"|bc)
huge=$(grep Hugepagesize /proc/meminfo|awk '{print $2}')
max=$(echo "$totmem*75/100"|bc)
all=$(echo "$max/$huge"|bc)
echo "kernel.shmmax = $max"
echo "kernel.shmall = $all"
Result:
kernel.shmmax = 25213120512, kernel.shmall = 12311094
However, This case “ORA-27102: out of memory Linux-X86_64 Error: 28: No space left on device” , solved by set SHMALL = MemTotal(byte)/PAGE_SIZE
and …
I hope to hear your idea about kernel tuning with Oracle Database.
Share

Tar: .file too large to archive. Use E function modifier

April 30th, 2018, posted in Solaris
Share

Tar, .file too large to archive, Use E function modifier,E function modifier,solaris 10,unix,linux,sun solaris 10,solaris administrator,Using TAR for big files

tar: .file too large to archive. Use E function modifier.

Using TAR for big files ( > 8GB)

In Unix environment, If you are trying to “tar” OS files that is bigger than 8 GB of size. Following error is observed.

Regular tar command:

tar -cvf test.dmp.tar test.dmp

Error:

tar: test.dmp too large to archive.  Use E function modifier.

Solution:

tar -cvEf test.dmp.tar test.dmp
Share

Solaris Management in User And Group Management

April 25th, 2018, posted in Solaris
Share

Out Of Memory Not Enough Space Solaris 11,Out Of Memory , Not Enough Space Solaris 11,Solaris 11,Solaris 10,Oracle 12c on Solaris 11.3,Oracle 12c,Solaris 11.3,

User Management:

There are two types of User;

1. Hard User
2. Soft User

  1. Hard User Creation:You must be root (superuser) to add a user. An easy way to remember the syntax of the useradd command in Solaris is to run it with no options. Follow the resulting usage information including the parts that you require. Important options are:

-d home-directory-path

This is the new user’s home directory, typically /export/home/username

-m

Make home directory and copy the default skeleton files (these files are located in /etc/skel directory).

-u uid

The uid (userid) is a number from 0 to 65535 which identifies the user on the system.  uid 0 is reserved for root.  If you don’t specify one, the next available uid will be used automatically.

-c “User Name”

Comment field which usually contains the name of the user. Make sure you enclose the name in quotes if it contains a space.

-s /path/to/shell

The shell to use.  If you don’t specify this, it will default to /bin/sh. Make sure you specify the fully qualified path.

So, putting it together, a typical addition of a user named ‘tushar’ would be:

#useradd -d /export/home/tushar -m -s /bin/ksh -c “tushar” tushar

To set Password: 

Use the following command “passwd tushar”.
To delete Hard User use the below Command;

#userdel -r tushar

  1. Soft User Creation: You must be root (superuser) to add a user. However, you will get limited access to system by using Soft User. Simply use the below command;useradd “User Name”Example:useradd tushar
                Passwd tushar (To set password)To delete Soft User use the below command;

    userdel “User Name”

    Example: userdel tushar

    If you want to change any authorization of any User use the ‘usermod’ command;

    #usermod -s /bin/bash tushar (To change the default shell)

    Configuration files:

  1. i)  /etc/passwd à user details will be shown here.
  2.      ii) /etc/shadowà users password will be kept here in encrypted form.

It’s a smart idea to run pwck (passwd check) whenever you make a change to the /etc/passwd file (as when adding or changing a user). This program will identify any problems with the passwd file. If it doesn’t tell you anything, then you are in good shape.

# vi /etc/passwd
# pwck


Group Management:
There are two types of Group;

  1. Primary Group (one user can assign to maximum one Primary Group)
  2. Secondary Group (one user can assign to maximum fifteen Secondary Group)

Use ‘groupadd’ command to add group called ‘INVAS’:

# groupadd INVAS

Create a group called ‘VAS’ with GID 500:

# groupadd –g 500 VAS

Add a user ‘tushar’ to Primary group ‘INVAS’:

# usermod –g INVAS tushar

Add a user ‘tushar’ to Secondary group ‘VAS’:

# usermod -G VAS tushar

Change the name INVAS to O&M:

# groupmod -n O&M INVAS
Remove the group called INVAS:

# groupdel INVAS

If you manually modified the /etc/group file then you can check any group file inconsistencies with grpck command:

# vi /etc/group
# grpck

Configuration file:

/etc/group

Share

TNS-01155: Incorrectly specified SID_LIST_LISTENER parameter in LISTENER.ORA

April 10th, 2018, posted in Linux OS, Oracle, Windows
Share

TNS-01155: Incorrectly specified SID_LIST_LISTENER parameter in LISTENER.ORA,TNS-01155,Incorrectly specified SID_LIST_LISTENER parameter,LISTENER.ORA,LISTENER ORA,errors,Oracle ERP,Oracle ,ERP,Oracle ERP Application,Oracle Application,Oracle DBA,Oracle Forms,Oracle Apps,Apps DBA,ERP Application



Issue : While starting the listener we got the below error.


linux01(oracle:orcl1)/home/oracle: lsnrctl start

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-SEP-2015 03:43:02

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Starting /opt/oracle/product/11.2.0.4.RAC/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /opt/oracle/product/11.2.0.4.RAC/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/linux01/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
TNS-01155: Incorrectly specified SID_LIST_LISTENER parameter in LISTENER.ORA
 NL-00303: syntax error in NV string

Listener failed to start. See the error message(s) above...



Solution: 

In the listener.ora file there were blank lines under the section SID_LIST_LISTENER. We removed the blank line entries and brought up the listener. (please note that this may be one of the scenarios)

Erroneous listener.ora file excerpts below:

SID_LIST_LISTENER =
 (SID_LIST =
 (SID_DESC =
 (GLOBAL_DBNAME = ORCL1)
 (ORACLE_HOME = /opt/oracle/product/11.2.0.4.RAC)
 (SID_NAME = ORCL1)
 )
 <<<<< blank line
 (SID_DESC =
 (GLOBAL_DBNAME = ORCL2)
 (ORACLE_HOME = /opt/oracle/product/11.2.0.4.RAC)
 (SID_NAME = ORCL2)
 )
 <<<<< blank line
)
Share