Posts Tagged ‘Linux’

Fixing the ORA-27102: out of memory Error in Oracle on Solaris 10

April 8th, 2018, posted in Oracle Queries, Solaris
Share

Symptom:

As part of a database tuning effort you increase the SGA/PGA sizes; and Oracle greets with anORA-27102: out of memoryerror message. The system had enough free memory to serve the needs of Oracle.

SQL> startup
ORA-27102: out of memory
SVR4 Error: 22: Invalid argument

Diagnosis

$ oerr ORA 27102
27102, 00000, "out of memory"
// \*Cause: Out of memory
// \*Action: Consult the trace file for details

 

Not so helpful. Let’s look the alert log for some clues.

 

% tail -2 alert.log
WARNING: EINVAL creating segment of size 0x000000028a006000
fix shm parameters in /etc/system or equivalent

 

Oracle is trying to create a 10G shared memory segment (depends on SGA/PGA sizes), but operating system (Solaris in this example) responded with an invalid argument (EINVAL) error message. There is a little hint about setting shm parameters in/etc/system.

Prior to Solaris 10,shmsys:shminfo_shmmaxparameter has to be set in/etc/systemwith maximum memory segment value that can be created. 8M is the default value on Solaris 9 and prior versions; where as 1/4th of the physical memory is the default on Solaris 10 and later. On a Solaris 10 (or later) system, it can be verified as shown below:

 

% prtconf | grep Mem
Memory size: 32760 Megabytes
% id -p
uid=59008(oracle) gid=10001(dba) projid=3(default)
% prctl -n project.max-shm-memory -i project 3
project: 3: default
NAME    PRIVILEGE       VALUE    FLAG   ACTION                       RECIPIENT
project.max-shm-memory
        privileged      7.84GB      -   deny                                 -
        system          16.0EB    max   deny                                 -

 

Now it is clear that the system is using the default value of 8G in this scenario, where as the application (Oracle) is trying to create a memory segment (10G) larger than 8G. Hence the failure.

So, the solution is to configure the system with a value large enough for the shared segment being created, so Oracle succeeds in starting up the database instance.

On Solaris 9 and prior releases, it can be done by adding the following line to/etc/system, followed by a reboot for the system to pick up the new value.

set shminfo_shmmax = 0x000000028a006000Howevershminfo_shmmaxparameter was obsoleted with the release of Solaris 10; and Sun doesn’t recommend setting this parameter in/etc/systemeven though it works as expected.

On Solaris 10 and later, this value can be changed dynamically on a per project basis with the help of resource control facilities . This is how we do it on Solaris 10 and later:

 

% prctl -n project.max-shm-memory -r -v 10G -i project 3
% prctl -n project.max-shm-memory -i project 3
project: 3: default
NAME    PRIVILEGE       VALUE    FLAG   ACTION                       RECIPIENT
project.max-shm-memory
        privileged      10.0GB      -   deny                                 -
        system          16.0EB    max   deny                                 -

 

Note that changes made with theprctlcommand on a running system are temporary, and will be lost when the system is rebooted. To make the changes permanent, create a project withprojaddcommand and associate it with the user account as shown below:

 

% projadd -p 3  -c 'eBS benchmark' -U oracle -G dba  -K 'project.max-shm-memory=(privileged,10G,deny)' OASB
% usermod -K project=OASB oracle

 

Finally make sure the project is created withprojects -lorcat /etc/projectcommands.

 

% projects -l
...
...
OASB
        projid : 3
        comment: "eBS benchmark"
        users  : oracle
        groups : dba
        attribs: project.max-shm-memory=(privileged,10737418240,deny)
% cat /etc/project
...
...
OASB:3:eBS benchmark:oracle:dba:project.max-shm-memory=(privileged,10737418240,deny)

 

With these changes, Oracle would start the database up normally.

 

SQL> startup
ORACLE instance started.
Total System Global Area 1.0905E+10 bytes
Fixed Size                  1316080 bytes
Variable Size            4429966096 bytes
Database Buffers         6442450944 bytes
Redo Buffers               31457280 bytes
Database mounted.
Database opened.

 


 

Addendum : Oracle RAC settings

Anonymous Bob suggested the following settings for Oracle RAC in the form of a comment for the benefit of others who run into similar issue(s) when running Oracle RAC. I’m pasting the comment as is (Disclaimer: I have not verified these settings):

Thanks for a great explanation, I would like to add one comment that will help those with an Oracle RAC installation. Modifying the default project covers oracle processes great and is all that is needed for a single instance DB. In RAC however, the CRS process starts the DB and it is a root owned process and root does not use the default project. To fix ORA-27102 issue for RAC I added the following lines to an init script that runs before the init.crs script fires.

 

# Recommended Oracle RAC system params
ndd -set /dev/udp udp_xmit_hiwat 65536
ndd -set /dev/udp udp_recv_hiwat 65536
# For root processes like crsd
prctl -n project.max-shm-memory -r -v 8G -i project system
prctl -n project.max-shm-ids -r -v 512 -i project system
# For oracle processes like sqlplus
prctl -n project.max-shm-memory -r -v 8G -i project default
prctl -n project.max-shm-ids -r -v 512 -i project default

So simple yet it took me a week working with Oracle and SUN to come up with that answer…Hope that helps someone out.

Share

How to create and extract zip, tar, tar.gz and tar.bz2 files in Linux

May 12th, 2015, posted in Solaris
Share

Data compression has been extremely useful to us over the years. Whether its a zip file containing images to be sent in a mail How to create and extract zip tar tar.gz and tar.bz2 files in Linux, Linux,How to create and extract zip,How to create and extract tar,How to create and extract ,create and extract zip,linux,solaris 10,solaris,or a compressed data backup stored on a server, we use data compression to save valuable hard drive space or to make the downloading of files easier. There are compression formats out there which allow us to sometimes compress our data by 60% or more. I’ll run you through using some of these formats to compress and decompress files and directories on a Linux machine. We’ll cover the basic usage of zip, tar, tar.gz and the tar.bz2 formats. These are some of the most popular formats for compression used on Linux machines.

Before we delve into the usage of the formats I’d like to share some of my experience using the various formats of archiving. I’m talking about only a few data compression formats here, and there are many more out there. I’ve realized that I need two or three formats of compression that I’m comfortable using, and stick to them. The zip format is definitely one of them. This is because zip has become the de-facto standard choice for data compression, and it works on Windows as well. I use the zip format for files that I might need to share with Windows users. I like to use the tar.gz format for files that I would only use on my Mac and Linux machines.

 

ZIP

Zip is probably the most commonly used archiving format out there today. Its biggest advantage is the fact that it is available on all operating system platforms such as Linux, Windows, and Mac OS, and generally supported out of the box. The downside of the zip format is that it does not offer the best level of compression. Tar.gz and tar.bz2 are far superior in that respect. Let’s move on to usage now.
To compress a directory with zip do the following:

# zip -r archive_name.zip directory_to_compress

Here’s how you extract a zip archive:

# unzip archive_name.zip

 

TAR

Tar is a very commonly used archiving format on Linux systems. The advantage with tar is that it consumes very little time and CPU to compress files, but the compression isn’t very much either. Tar is probably the Linux/UNIX version of zip – quick and dirty. Here’s how you compress a directory:

# tar -cvf archive_name.tar directory_to_compress

And to extract the archive:

# tar -xvf archive_name.tar.gz

This will extract the files in the archive_name.tar archive in the current directory. Like with the tar format you can optionally extract the files to a different directory:

# tar -xvf archive_name.tar -C /tmp/extract_here/

 

TAR.GZ

This format is my weapon of choice for most compression. It gives very good compression while not utilizing too much of the CPU while it is compressing the data. To compress a directory use the following syntax:

# tar -zcvf archive_name.tar.gz directory_to_compress

To decompress an archive use the following syntax:

# tar -zxvf archive_name.tar.gz

This will extract the files in the archive_name.tar.gz archive in the current directory. Like with the tar format you can optionally extract the files to a different directory:

# tar -zxvf archive_name.tar.gz -C /tmp/extract_here/

 

TAR.BZ2

This format has the best level of compression among all of the formats I’ve mentioned here. But this comes at a cost – in time and in CPU. Here’s how you compress a directory using tar.bz2:

# tar -jcvf archive_name.tar.bz2 directory_to_compress

This will extract the files in the archive_name.tar.bz2 archive in the current directory. To extract the files to a different directory use:

# tar -jxvf archive_name.tar.bz2 -C /tmp/extract_here/

Data compression is very handy particularly for backups. So if you have a shell script that takes a backup of your files on a regular basis you should think about using one of the compression formats you learned about here to shrink your backup size.

Over time you will realize that there is a trade-off between the level of compression and the the time and CPU taken to compress. You will learn to judge where you need a quick but less effective compression, and when you need the compression to be of a high level and you can afford to wait a little while longer.

Share

Changing Root’s Password

May 3rd, 2015, posted in Solaris
Share

When changing root’s password, you must always run chkey -p immediately after changing the password with the passwd command. Failure to run chkey -p after changing root’s password will result in root being unable to properly log in.

To change a root password, follow these steps:

  1. Log in as root.
  2. Change root’s password using passwd.Do not use nispasswd.
  3. Run chkey -p.You must use the -p option.
Share

Basic LINUX Commands That a DBA Should Know

May 26th, 2012, posted in Oracle, Solaris
Share

Basic LINUX commands that a DBA should know

groupadd
This is the command used to create new group. At OS level group is used to give and take  pivillages.
Syntax : groupadd <group name>
Ex : [root@rac5 ~]# groupadd group1
View : [root@rac5 ~]# cat /etc/group  -This command used to view which user belongs to which group.
Output: group1:x:607:

useradd
This is the command used to create a new user in a group.
Syntax : useradd -g <group name> <user name>
Ex : [root@rac5 ~]# useradd -g group1 user1

passwd
This is the command used to give password for create use or to update the password.
Syntax : passwd <user name>
Ex: [root@rac5 ~]# passwd user1
Output :
[root@rac5 ~]# Changing password for user soufir.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

date
a. This is the command used to view the current system date.
Syntax : date
Output : Wed Oct 27 21:55:36 IST 2010
b. In order to update the date we can give :
Syntax : [root@rac5 ~]# date -s “2 OCT 2010 14:00:00″  OR
[root@rac5 ~]# date –set=”27 OCT 2010 21:56:00″
Output : Sat Oct  2 14:00:00 IST 2010

cal
This command shows the calender of current year or any.
Ex : [root@rac5 ~]#  Cal
Output : [root@rac5 ~]#    October 2010
Su Mo Tu We Th Fr Sa
1  2
3  4  5  6  7  8  9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31

pwd
This command is to view the present working directory.
Ex : [root@rac5 ~]# pwd
Output : [root@rac5 ~]# /root.

cd
a.This is the command used to change a directory
Ex : [oracle@rac5 ~]$ ls
authorized_keys  file   file2  oraInventory  stand.ora
authorized-keys  file1  file3  soufir
[oracle@rac5 ~]$ cd soufir
[oracle@rac5 soufir]$
b.This is used to go back to parent directory
Ex : cd ..
mkdir
This command is used for make a new directory.
Ex : mkdir dir1
rmdir
This commad is used for remove a directory.
Ex : rmdir dir1
rm -rf
This command is used to forcefully remove a direcory.
Ex : rm -fr dir1

man
This command is used to show the online manual pages of related commands
Ex : man ls

ls
This command is used to list all contents of directories
Ex : ls

ls -lt
This command is used to list lot of information about contents of directories
Ex : ls -lt
The permissions are the first 10 characters of the line (-rwxrwx—) and can be broken down as follows.
rwx
r–
r–
1
root
root
765
Apr 23
file.txt
File type
Owner
Group
All
Links
Owner
Group
Size
Mod date
Filename

touch

This command is used create an empty file
Ex : touch file1

cat
This command is used to create and view files of directories
Ex : cat file1
cat file1 > newfile   // owerwrite newfile with file1
cat file1 >> newfile  // append newfile the contents with file1

cp
This command is used to copy a file from one to another
Ex : cp file1 filenew

mv
This command is used to rename the name of a file to other
Ex : mv file1 filenew

su
This command is used to switch one user to other. it doesnot change the current working directory. so you cant access the /usr/sbin  directories.
Ex : su soufir

su –
This command is used to switch one user with changing current working directory.
Ex : su – soufir

*********************************************************************************************************************
Note : Please not do make backups before using these queries and also confirm them yourself or by aother means as
 well.
*********************************************************************************************************************
Share

List Of Few Common Linux Commands

May 26th, 2012, posted in Solaris
Share

alias – Create an alias

awk – Find and Replace text, database sort/validate/index

break – Exit from a loop

builtin – Run a shell builtin

cal – Display a calendar

cse – Conditionally perform a command

cat – Display the contents of a file

cd – Change Directory

cfdisk – Partition table manipulator for Linux

chgrp – Change group ownership

chmod – Change access permissions

chown – Change file owner and group

chroot – Run a command with a different root directory

cksum – Print CRC checksum and byte counts clear Clear terminal screen

cmp – Compare two files

comm – Compare two sorted files line by line

command – Run a command – ignoring shell functions

continue – Resume the next iteration of a loop

cp – Copy one or more files to another location

cron – Daemon to execute scheduled commands

crontab – Schedule a command to run at a later time

csplit – Split a file into context-determined pieces

cut – Divide a file into several parts

date – Display or change the date & time

dc – Desk Calculator

dd – Data Dump – Convert and copy a file

declare – Declare variables and give them attributes

df – Display free disk space

diff – Display the differences between two files

diff3 – Show differences among three files

dir – Briefly list directory contents

dircolors – Colour setup for `ls’

dirname – Convert a full pathname to just a path

dirs – Display list of remembered directories

du – Estimate file space usage

echo – Display message on screen ed A line-oriented text editor (edlin)

egrep – Search file(s) for lines that match an extended expression eject Eject CD-ROM

enable – Enable and disable builtin shell commands

env – Display, set, or remove environment variables

eval – Evaluate several commands/arguments

exec – Execute a command exit Exit the shell

expand – Convert tabs to spaces

export – Set an environment variable

expr – Evaluate expressions

factor – Print prime factors

false – Do nothing, unsuccessfully

fdformat – Low-level format a floppy disk

fdisk – Partition table manipulator for Linux

fgrep – Search file(s) for lines that match a fixed string

find – Search for files that meet a desired criteria

fmt – Reformat paragraph text

fold – Wrap text to fit a specified width.

for – Expand words, and execute commands format Format disks or tapes free Display memory usage

fsck – Filesystem consistency check and repair.

function – Define Function Macros

gawk – Find and Replace text within file(s)

getopts – Parse positional parameters

grep – Search file(s) for lines that match a given pattern

groups – Print group names a user is in

gzip – Compress or decompress named file(s)

hash – Remember the full pathname of a name argument

head – Output the first part of file(s)

history – Command History

hostname – Print or set system name

id – Print user and group id’s

if – Conditionally perform a command

import – Capture an X server screen and save the image to file

info – Help info

install – Copy files and set attributes

join – Join lines on a common field

kill – Stop a process from running

less – Display output one screen at a time

let – Perform arithmetic on shell variables

ln – Make links between files

local – Create variables

locate – Find files

logname – Print current login name

logout – Exit a login shell

lpc – Line printer control program

lpr – Off line print lprint Print a file lprintd Abort a print job lprintq List the print queue

lprm – Remove jobs from the print queue

ls – List information about file(s)

m4 – Macro processor

man – Help manual

mkdir – Create new folder(s)

mkfifo – Make FIFOs (named pipes)

mknod – Make block or character special files

more – Display output one screen at a time

mount – Mount a file system

mtools – Manipulate MS-DOS files

mv – Move or rename files or directories

nice – Set the priority of a command or job

nl – Number lines and write files

nohup – Run a command immune to hangups

passwd – Modify a user password

paste – Merge lines of files pathchk Check file name portability

popd – Restore the previous value of the current directory

pr – Convert text files for printing printcap Printer capability database printenv Print environment variables

printf – Format and print data

ps – Process status

pushd – Save and then change the current directory

pwd – Print Working Directory

quota – Display disk usage and limits

quotacheck – Scan a file system for disk usage

quotactl – Set disk quotas

ram – ram disk device

rcp – Copy files between two machines.

read – read a line from standard input

readonly – Mark variables/functions as readonly remsync Synchronize remote files via email

return – Exit a shell function

rm – Remove files

rmdir – Remove folder(s)

rpm – Remote Package Manager

rsync – Remote file copy (Synchronize file trees) screen Terminal window manager

sdiff – Merge two files interactively

sed – Stream Editor

select – Accept keyboard input

seq – Print numeric sequences

set – Manipulate shell variables and functions

shift – Shift positional parameters

shopt – Shell Options

shutdown – Shutdown or restart linux

sleep – Delay for a specified time

sort – Sort text files

source – Run commands from a file `.’

split – Split a file into fixed-size pieces

su – Substitute user identity

sum – Print a checksum for a file

symlink – Make a new name for a file

sync – Synchronize data on disk with memory

tac – Concatenate and write files in reverse

tail – Output the last part of files

tar – Tape ARchiver

tee – Redirect output to multiple files

test – Evaluate a conditional expression

time – Measure Program Resource Use

times – User and system times

touch – Change file timestamps

top – List processes running on the system

traceroute – Trace Route to Host trap Run a command when a signal is set(bourne)

tr – Translate, squeeze, and/or delete characters

true – Do nothing, successfully

tsort – Topological sort

tty – Print filename of terminal on stdin

type – Describe a command

ulimit – Limit user resources

umask – Users file creation mask umount Unmount a device

unalias – Remove an alias

uname – Print system information

unexpand – Convert spaces to tabs

uniq – Uniquify files

units – Convert units from one scale to another

unset – Remove variable or function names

unshar – Unpack shell archive scripts

until – Execute commands (until error)

useradd – Create new user account

usermod – Modify user account

users – List users currently logged in

uuencode – Encode a binary file

uudecode – Decode a file created by uuencode v Verbosely list directory contents (`ls -l -b’) vdir Verbosely list directory contents (`ls -l -b’)

watch – Execute/display a program periodically

wc – Print byte, word, and line counts

whereis – Report all known instances of a command

which – Locate a program file in the user’s path.

while – Execute commands

who – Print all usernames currently logged in whoami Print the current user id and name (`id -un’)

xargs – Execute utility, passing constructed argument list(s)

yes – Print a string until interrupted

.period – Run commands from a file

### – Comment / Remark

Share