Monday, August 18, 2008

MAXDATAFILES , DB_FILES parameters and ORA-00059

Problem Description
Whenever I try to create tablespace it fails with error message, ORA-00059.

SQL> create tablespace test_tbs;
create tablespace test_tbs
*
ERROR at line 1:
ORA-00059: maximum number of DB_FILES exceeded

Cause of The Problem
You have reached the limit of DB_FILES parameter. Before entering into solution part let's have an idea about DB_FILES and MAXDATAFILES parameter.

The DB_FILES parameter limits the maximum number of datafile can exist in oracle database. We can't change this parameter dynamically. We have to change it spfile by using ALTER SYSTEM .... SCOPE=SPFILE or in the pfile.

And the MAXDATAFILES parameter you can find with the CREATE DATABASE command or in CREATE CONTROLFILE command. It is also a limitation of maximum number of datafiles can be in the datafile. But starting from oracle 8 this hard limit parameter can be easily expanded up to DB_FILES parameter. So, if you attempt to add a new file whose number is greater than MAXDATAFILES, but less than or equal to DB_FILES, the MAXDATAFILES parameter of the control file will expand automatically to accommodate more files.

So, if you are after oracle 8i then we should just forget about MAXDATAFILES parameter. We should rather think about DB_FILES parameter.

Solution of The Problem
If you use pfile to startup the database then edit pfile and add/modify the DB_FILES parameter to a greater value so that it can accommodate higher number of datafiles. Then start the database using that pfile.

If you use spfile to startup the database then issue,

SQL> alter system set db_files=300 scope=spfile;
System altered.

Then start your database and either create tablespace or add datafile to an existing tablespace. Hopefully it will work.

SQL> conn / as sysdba
SQL> startup force
SQL> CREATE TABLESPACE or ALTER TABLESPACE command to add datafile.

Related Documents
http://arjudba.blogspot.com/2008/07/ora-01667-cannot-add-any-more.html
http://arjudba.blogspot.com/2008/09/list-of-parameters-that-must-have.html
http://arjudba.blogspot.com/2008/08/possible-limitations-when-adding.html

CRS Stack Fails to Start After Reboot ORA-29702 CRS-0184

Problem Description
An attempt to manually start the instance fails with,

ORA-29702: error occurred in Cluster Group Service operation

crs_stat produces the error,

/oracle/crs/bin/crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.

CSS stack did not come up as the following command issued out of init.cssd
crsctl check boot
failed with error message
Failed 3 to bind listening endpoint: (ADDRESS=(PROTOCOL=tcp)(HOST=node2priv))
and return code 11.
The error message was also written to /var/log/messages on this node.

Note that in 10gR2 the message no longer gets written to /var/log/messages, instead it will be written to /tmp/crsctl.


Cause of the Problem
Error message 'Failed 3 to bind listening endpoint: (ADDRESS=(PROTOCOL=tcp)(HOST=node2priv))' indicated that CSS had a problem creating the listening endpoint for hostname node2

In node1 within the /etc/hosts file the name of the private interconnect exist. But on node2 somehow it is missing the private interconnect in the /etc/hosts file. That's why the problem occurs.

Solution of The Problem

1. Add the missing hostnames to /etc/hosts

2. Stop and start CRS stack
Related Documents
http://arjudba.blogspot.com/2010/03/cluvfy-fails-with-prvf-5436-prvf-9652.html
http://arjudba.blogspot.com/2010/03/in-11gr2-grid-rootsh-fails-with-crs.html
http://arjudba.blogspot.com/2010/03/what-to-do-after-failure-of-oracle.html
http://arjudba.blogspot.com/2009/12/enable-archive-log-mode-for-rac.html
http://arjudba.blogspot.com/2008/09/list-of-parameters-that-must-have.html
http://arjudba.blogspot.com/2008/08/oracle-rac-software-components.html
http://arjudba.blogspot.com/2008/08/oracle-clusterware-processes-on-unix.html
http://arjudba.blogspot.com/2008/08/configure-raw-devices-for-asm-in-rac.html
http://arjudba.blogspot.com/2008/08/crs-stack-fails-to-start-after-reboot.html
http://arjudba.blogspot.com/2008/08/configure-network-for-oracle-rac.html
http://arjudba.blogspot.com/2008/08/pre-installation-rac-environement-setup.html
http://arjudba.blogspot.com/2008/08/configure-server-to-install-oracle-rac.html

How to Resize a Datafile

There may be situations when you need to increase or decrease your datafile size. Prior to oracle 7.2 there was no easy way to resize the datafile. Before 7.2 the solutions was to drop and recreate the tablespace with different sized datafiles, or to add more datafiles to a tablespace whenever you need more space in the tablespace.

Before 7.2 the RESIZE command will raise error,
ORA-00923: FROM keyword not found where expected

Before entering into resize datafile let's be familiar with several views related to datafile.
From V$DATAFILE.CREATION_TIME we can see the timestamp of the datafile creation time.
From V$DATAFILE.BYTES we can see the current datafile size in bytes. 0 in this fields indicate the datafile is inaccessible.
From V$DATAFILE.CREATE_BYTES we can the datafile size when it was created.
From V$DBA_DATA_FILES.MAXBYTES we can see the maximum size of the datafile.

Before going into resize I just create one tablespace containing one datafile of size 10M which can be extended up to 100M.

SQL> create tablespace test_tbs datafile 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ARJU\test_tbs01.dbf' size 10M autoextend on maxsize 100M;
Tablespace created.

Now have a look at the current size of maximum size of this data file from dba_data_files view.
SQL> select bytes/1024/1024, maxbytes/1024/1024 from dba_data_files where file_id=6;
BYTES/1024/1024 MAXBYTES/1024/1024
--------------- ------------------
10 100

Increase datafile size
To see the current settings of the datafile query from v$datafile view. The BYTES column shows the current size of the datafile, and the CREATE_BYTES column shows what the size was
specified when the file was created.

Current size is 10M we can increase it upto 15M by,

SQL> alter database datafile 6 resize 15M;
Database altered.

SQL> select bytes/1024/1024, maxbytes/1024/1024 from dba_data_files where file_id=6;

BYTES/1024/1024 MAXBYTES/1024/1024
--------------- ------------------
15 100

SQL> select bytes/1024/1024, create_bytes/1024/1024 from v$datafile where file#=6;
BYTES/1024/1024 CREATE_BYTES/1024/1024
--------------- ----------------------
15 10

Here 12 is current size and 10 is creation time size.

Decrease Datafile size
Downsizing a datafile is more complicated than increasing the size of a datafile. Because you cannot deallocate space from a datafile that is currently being used by database objects. To remove space from a datafile, you have to have contiguous space at the END of the datafile. From DBA_FREE_SPACE we can see the free space in the datafile.

To resize our datafile to 2M issue,
SQL> alter database datafile 6 resize 2M;

If you try to resize a datafile to a size smaller than is needed to contain all the database objects in that datafile, the following error is returned,

ORA-03297: file contains blocks of data beyond requested RESIZE value
Or
ORA-03297: file contains used data beyond requested RESIZE value

Sunday, August 17, 2008

How to Find out or Check Linux Version Information

Before installing oracle clusterware it is necessary in which version of linux you are trying to install to. Because based on the version procedure may vary to install clusterware.
Here I mention several ways to check the version of linux.

Find out linux release information
1)On Red Hat Linux,
-bash-3.1$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 4 (Tikanga)

Alternatively,
# rpm -q redhat-release
redhat-release-4ES-2
2)On SUSE Linux,
$cat /etc/SuSE-release
SUSE LINUX Enterprise Server 9 (i586)
VERSION = 9

3)On Debian Release,
debian:/home/Arju/Spark# cat /etc/debian_version
4.0

Find out linux Kernel Version
debian:/home/Arju/Spark# uname -s -r
Linux 2.6.18-4-686

debian:/home/Arju/Spark# uname -a
Linux debian 2.6.18-4-686 #1 SMP Wed May 9 23:03:12 UTC 2007 i686 GNU/Linux

-bash-3.1$ uname -a
Linux racnode-1 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux

-bash-3.1$ uname -s -r
Linux 2.6.18-8.el5

Description of the output of uname -a
At the end but the before of OS name the output of "uname -a " shows the OS word-size.
- i686 i386 indicates 32-bit Linux on standard x86 microprocessor series hardware
- x86_64 indicates 64-bit Linux on standard AMD64 or Intel EM64T hardware
- ia64 indicates 64-bit Linux on the Itanium-2 processor developed jointly by Hewlett-Packard and Intel
- s390x indicates 64-bit Linux on IBM S/390 (31-bit) and zSeries (64-bit) hardware.
- ppc64 indicates 64-bit Linux on IBM power based systems that support Linux includes machines branded as pSeries, iSeries, System p5 and System i5.

The first word of the output shows the kernel name. We see the kernel name is linux.
Only itself can be seen by,
-bash-3.1$ uname -s
Linux

The second word of the output of " uname -a " shows the hostname. Here we see the hostname is debian for debian machine and racnode-1 for redhat linux machine.
Only itself can be seen by,
-bash-3.1$ uname -n
racnode-1

The third word of the output of "uname -a" prints the kernel release. Here for racnode-1 machine we see kernel release is 2.6.18-8.el5. Only itselef can be seen by uname -r
-bash-3.1$ uname -r
2.6.18-8.el5

The fourth word print the kernel version. For racnode-1 we see kernel version is #1 SMP Fri Jan 26 14:15:21 EST 2007. Only itself can be seen by, uname -v.
-bash-3.1$ uname -v
#1 SMP Fri Jan 26 14:15:21 EST 2007

The fifth one prints the machine hardware name. Only itself can be seen from ,
-bash-3.1$ uname -m
i686

The sixth one prints the processor type. Here it is seen by,
-bash-3.1$ uname -p
i686

The seventh one prints the hardware platform. Here it is
-bash-3.1$ uname -i
i386

The eighth one print the operating system. Here it is
-bash-3.1$ uname -o
GNU/Linux

In fact "uname -a" is the combination of all these 8. That is "uname -a" is equivalent to,
-bash-3.1$ uname -snrvmpio
Linux racnode-1 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux

Another Way by Cheking issue file
From the /etc/issue file you can also check the version information. In fact it is a text file which contains a message or system identification to be printed before the login prompt.

From here we see for debian machine it is 4.0 and for red hat racnode-1 it is 5.
debian:/home/Arju/Spark# cat /etc/issue
Debian GNU/Linux 4.0 \n \l

-bash-3.1$ cat /etc/issue
Red Hat Enterprise Linux Server release 5 (Tikanga)
Kernel \r on an \m

Related Documents
How to Identify OS or Oracle 64 bit or 32 bit on Unix

Different ways to take Screenshot on Linux

Way 1: Using GUI if you have GNOME:
If you have GNOME installed then using graphical tool you can easily take a screenshot. To do it
Click Applications —> Accessories —> Take Screenshot.
You are done.

Way 2: With the PrintScreen Button
To get a screenshot of your active window just press ALT+Print Screen button. A new window will appear. Just enter your name of the screenshot there as well as the location.

Way 3: Using ImageMagick Tool: This tool can be useful in certain scenario. Suppose to take a screenshot of a menu you can't use GNOME tool. You have to use this tool then as it support a delay before taking the screenshot. You need to install this tool to use.
To check whether ImageMagick tool is installed or not just issue,
# import -version
bash: import: command not found

You can get this tool from http://www.imagemagick.org/script/index.php.
The next step is to install it. On my debian linux, I issue
#apt-get install imagemagick

To take a screenshot in the terminal with ImageMagick, type the following line into a terminal and then click-and-drag the mouse over a section of the screen:

import MyScreenshot.jpg

To view it,
#eog MyScreenshot.jpg

To capture a creenshot after 10 seconds delay you can issue,
sleep 10; import -window root MyScreenshot2.jpg

Way 4: Using scrot
To install scrot on my system I used,
sudo aptitude install scrot

To take a snapshot with it use,
scrot MyScreenshot.png

Way 5: With the Terminal using gnome-panel-screenshot:
Using terminal in GNOME you can also take the snapshot in linux. Do it as,
$gnome-panel-screenshot

Also delay can be added by,
$gnome-panel-screenshot --delay 5

Way 6: With the GIMP
Install gimp on my debian system by,
# apt-get install gimp
And to take snapshot open gimp and follow,
File —> Acquire —> Screen Shot.

Way 7: Web Page Snapshot With Firefox
With screengrab you can take screenshot within webpage just by a click if you use firefox. To get screengrab just download it from https://addons.mozilla.org/en-US/firefox/search?q=screengrab&cat=all

To use it just right click on a web page and choose: ScreenGrab! —> Save document as image.

Way 8: With xwd to screen a terminal
Just on your terminal write,
$xvd> screen.xvd

And then convert it to any format that you wish using convert command.
$convert screen.xvd screen.jpg

Way 9: Using ksnpshot
With ksnapshot you can easily take snapshot. It can be used in KDE as well as GNOME.

Way 10: Using gimp Tool

If you know any other ways just enter inside comments in this post. Thank you.

Related Documents
How to change/configure IP Address on Linux/ Fedora /Ubuntu
Copy files between Unix and Windows with rcp
Screen -A very useful unix tool to work with remote system
How to change the hostname in Linux
Memory Usage of Solaris Operating System

Running Runinstaller fails with DISPLAY not set

When I running the runinstaller command on my linux server after entering through ssh it fails with DISPLAY not set.
$ssh oracle@192.168.1.91
-bash-3.1$ /oradata1/clusterware/runInstaller
Starting Oracle Universal Installer...

Checking installer requirements...

Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
Passed


All installer requirements met.

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2008-08-17_04-01-48PM. Please wait ...
DISPLAY not set. Please set the DISPLAY and try again.
Depending on the Unix Shell, you can use one of the following commands as examples to set the DISPLAY environment variable:
- For csh: % setenv DISPLAY 192.168.1.128:0.0
- For sh, ksh and bash: $ DISPLAY=192.168.1.128:0.0; export DISPLAY
Use the following command to see what shell is being used:
echo $SHELL
Use the following command to view the current DISPLAY environment variable setting:
echo $DISPLAY
- Make sure that client users are authorized to connect to the X Server.
To enable client users to access the X Server, open an xterm, dtterm or xconsole as the user that started the session and type the following command:
% xhost +
To test that the DISPLAY environment variable is set correctly, run a X11 based program that comes with the native operating system such as 'xclock':
% <full path to xclock.. see below>
If you are not able to run xclock successfully, please refer to your PC-X Server or OS vendor for further assistance.
Typical path for xclock: /usr/X11R6/bin/xclock

Solution of The Problem
If you are trying to run GUI on remote unix machine using ssh from the client unix machine then you have to ssh with the -X or -Y option. To solve the problem just quit the session and reenter to the remote machine using anyone of the following,

ssh oracle@192.168.1.91 -X
ssh oracle@192.168.1.91 -Y


If your are already on the machine and got above message then as a root user issue,

#xhost +
Now as oracle user run oracle universal installer.

RunInstaller fails with java.lang.UnsatisfiedLinkError

To install clusterware whenever I run runIstaller it fails with following errors along with unknown source.
-bash-3.1$ ./runInstaller
Starting Oracle Universal Installer...

Checking installer requirements...

Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
Passed


All installer requirements met.

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2008-08-17_03-53-41PM. Please wait ...-bash-3.1$ Oracle Universal Installer, Version 10.2.0.1.0 Production
Copyright (C) 1999, 2005, Oracle. All rights reserved.

Exception java.lang.UnsatisfiedLinkError: /tmp/OraInstall2008-08-17_03-53-41PM/jre/1.4.2/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory occurred..
java.lang.UnsatisfiedLinkError: /tmp/OraInstall2008-08-17_03-53-41PM/jre/1.4.2/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at sun.security.action.LoadLibraryAction.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.NativeLibLoader.loadLibraries(Unknown Source)
at sun.awt.DebugHelper.(Unknown Source)
at java.awt.Component.(Unknown Source)
at oracle.sysman.oii.oiif.oiifm.OiifmGraphicInterfaceManager.(OiifmGraphicInterfaceManager.java:222)
at oracle.sysman.oii.oiic.OiicSessionInterfaceManager.createInterfaceManager(OiicSessionInterfaceManager.java:193)
at oracle.sysman.oii.oiic.OiicSessionInterfaceManager.getInterfaceManager(OiicSessionInterfaceManager.java:202)
at oracle.sysman.oii.oiic.OiicInstaller.getInterfaceManager(OiicInstaller.java:436)
at oracle.sysman.oii.oiic.OiicInstaller.runInstaller(OiicInstaller.java:926)
at oracle.sysman.oii.oiic.OiicInstaller.main(OiicInstaller.java:866)
Exception in thread "main" java.lang.NoClassDefFoundError
at oracle.sysman.oii.oiif.oiifm.OiifmGraphicInterfaceManager.(OiifmGraphicInterfaceManager.java:222)
at oracle.sysman.oii.oiic.OiicSessionInterfaceManager.createInterfaceManager(OiicSessionInterfaceManager.java:193)
at oracle.sysman.oii.oiic.OiicSessionInterfaceManager.getInterfaceManager(OiicSessionInterfaceManager.java:202)
at oracle.sysman.oii.oiif.oiifm.OiifmAlert.(OiifmAlert.java:151)
at oracle.sysman.oii.oiic.OiicInstaller.runInstaller(OiicInstaller.java:984)
at oracle.sysman.oii.oiic.OiicInstaller.main(OiicInstaller.java:866)


Solution of The problem

Create the dynamic link with the library as following,
$cd /usr/lib
$ln -s libXpm.so.4.11.0 libXp.so.6