Friday 26 September 2014

ORA-00020: maximum number of processes (%s) exceeded

ORA-00020: maximum number of processes (%s) exceeded

Cause: All process state objects are in use.

Action: Increase the value of the PROCESSES initialization parameter.


ORA-00020 comes under "Oracle Database Server Messages". These messages are generated by the Oracle database server when running any Oracle program.

SOLUTION:
 
How to increase PROCESSES initialization parameter:

1. Login as sysdba

sqlplus / as sysdba

2. Check current setting of parameters
 
sql> show parameter sessions
sql> show parameter processes
sql> show parameter transactions

3. If you are planning to increase "PROCESSES" parameter you should also plan to increase "sessions and "transactions" parameters
A basic formula for determining these parameter values is as follows:


processes=x
sessions=x*1.1+5
transactions=sessions*1.1

 

4. These parameters can't be modified in memory. You have to modify the spfile only (scope=spfile) and bounce the instance.


sql> alter system set processes=700 scope=spfile;
sql> alter system set sessions=775 scope=spfile;
sql> alter system set transactions=852 scope=spfile;
sql> shutdown abort
sql> startup
 
NOTE:

Sometimes you may come across situation where due to this error you may not able to connect to database so in that situation you have to follow below steps.

Error:

ERROR:

ORA-00020: maximum number of processes (150) exceeded

SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM}] [edition=value]] where <logon> ::=< username>[/<password>][@<connect_identifier>]
<proxy> ::=< proxyuser>[<username>][/<password>][@<connect_identifier>]

ERROR:
ORA-01005: null password given; logon denied

SOLUTION:

1. Login as sysdba using following command and shut down database.

sqlplus -prelim "/as sysdba"

SQL*Plus: Release 11.2.0.4.0 Production on Fri Jun 6 09:09:15 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.

SQL> shutdown abort
ORACLE instance shut down.
 
SQL> exit
isconnected from ORACLE

2. Start database and follow same procedure as above.
 
sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Jun 6 09:10:38 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
 
SQL> startup

ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size 2248080 bytes
Variable Size 1258291824 bytes
Database Buffers 855638016 bytes
Redo Buffers 21708800 bytes
Database mounted.
Databasen opened.
 
 

I hope this article helped you. Your suggestions/feedback are most welcome.

Keep learning... Have a great day!!!

 

Tuesday 23 September 2014

Oracle Installation Error


Hello friends....... I hope you all doing well.

Last week I was installing Oracle database for a new project and I came across a following issue.

For a while I was confused and couldn’t understand the error, but then after little research i realise there is no entry for host in /etc/hosts file.So I added the host entry in /etc/hosts file and ran it again and its completed successfully

 





 

SOLUTION:

1.Login by root user.

bash-4.1$ su - root

2.Edit /etc/hosts file and add following entry.

                bash-4.1$ vi /etc/hosts

10.135.20.133   NVD1BKC150V07
 



I hope this article helped you. Your suggestions/feedback are most welcome.

Keep learning... Have a great day!!!

Thursday 18 September 2014

How to drop UNDO Tablespace



This is a mostly asked question on different oracle forums; How do I change the UNDO tablespace for my database and drop the old one? and the answer often is; Its very simple daa. But I don't think its that simple. The complexity comes in if there were pending transactions in your old undo tablespace and you have already switched to the new one and when you try to drop the old one it says "Tablespace is in use".


SQL> select tablespace_name,file_name from dba_data_files;

TABLESPACE_NAME                FILE_NAME
------------------------------ ---------------------------------------------------------------------
USERS                               D:\ORACLE\ORADATA\DATAFILE\USERS01.DBF
UNDOTBS1                       D:\ORACLE\ORADATA\DATAFILE\UNDOTBS01.DBF
SYSAUX                             D:\ORACLE\ORADATA\DATAFILE\SYSAUX01.DBF
SYSTEM                            D:\ORACLE\ORADATA\DATAFILE\SYSTEM01.DBF
EXAMPLE                          D:\ORACLE\ORADATA\DATAFILE\EXAMPLE01.DBF


SQL> drop tablespace undotbs1;
drop tablespace undotbs1
*
ERROR at line 1:
ORA-30013: undo tablespace 'UNDOTBS1' is currently in use

As the error indicate that the undo tablespace is in use so i issue the following command.

SQL> alter tablespace undotbs1 offline;

alter tablespace undotbs1  offline
*
ERROR at line 1:
ORA-30042: Cannot offline the undo tablespace.

Therefore, to drop undo  tablespace, we have to perform following steps:

 1) Create new undo tablespace
 2) Make it defalut tablepsace and undo management manual by editting parameter file and restart it.
 3) Check the all segment of old undo tablespace to be offline.
 4) Drop the old tablespace.
 5) Change undo management to auto by editting parameter file and restart the database

Step 1 : Create Tablespace   :  Create undo tablespace undotbs2    

SQL> create undo tablespace UNDOTBS2 datafile  'D:\ORACLE\ORADATA\DATAFILE\UNDOTBS02.DBF'  size 100M;
Tablespace created.

Step 2 : Edit the parameter file


SQL> alter system set undo_tablespace=UNDOTBS2 ;
System altered.

SQL> alter system set undo_management=MANUAL scope=spfile;
System altered.

SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.


SQL> startup
ORACLE instance started.
Total System Global Area  426852352 bytes
Fixed Size                  1333648 bytes
Variable Size             360711792 bytes
Database Buffers           58720256 bytes
Redo Buffers                6086656 bytes
Database mounted.
Database opened.

SQL> show parameter undo_tablespace
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_tablespace                      string      UNDOTBS2


Step 3: Check the all segment of old undo tablespace to be offline

SQL> select owner, segment_name, tablespace_name, status from dba_rollback_segs order by 3;

OWNER  SEGMENT_NAME                   TABLESPACE_NAME                STATUS
------ ------------------------------ ------------------------------ ----------------
SYS                 SYSTEM                                     SYSTEM                            ONLINE
PUBLIC       _SYSSMU10_1192467665$          UNDOTBS1                       OFFLINE
PUBLIC        _SYSSMU1_1192467665$           UNDOTBS1                       OFFLINE
PUBLIC        _SYSSMU2_1192467665$           UNDOTBS1                       OFFLINE
PUBLIC        _SYSSMU3_1192467665$           UNDOTBS1                       OFFLINE
PUBLIC        _SYSSMU4_1192467665$           UNDOTBS1                       OFFLINE
PUBLIC        _SYSSMU5_1192467665$           UNDOTBS1                       OFFLINE
PUBLIC        _SYSSMU6_1192467665$           UNDOTBS1                       OFFLINE
PUBLIC        _SYSSMU7_1192467665$           UNDOTBS1                       OFFLINE
PUBLIC        _SYSSMU8_1192467665$           UNDOTBS1                       OFFLINE
PUBLIC        _SYSSMU9_1192467665$           UNDOTBS1                       ONLINE
PUBLIC      _SYSSMU12_1304934663$          UNDOTBS2                        OFFLINE
PUBLIC      _SYSSMU13_1304934663$          UNDOTBS2                        OFFLINE
PUBLIC      _SYSSMU14_1304934663$          UNDOTBS2                        OFFLINE
PUBLIC      _SYSSMU15_1304934663$          UNDOTBS2                        OFFLINE
PUBLIC      _SYSSMU11_1304934663$          UNDOTBS2                        OFFLINE
PUBLIC      _SYSSMU17_1304934663$          UNDOTBS2                        OFFLINE
PUBLIC      _SYSSMU18_1304934663$          UNDOTBS2                        OFFLINE
PUBLIC      _SYSSMU19_1304934663$          UNDOTBS2                        OFFLINE
PUBLIC      _SYSSMU20_1304934663$          UNDOTBS2                        OFFLINE
PUBLIC      _SYSSMU16_1304934663$          UNDOTBS2                        OFFLINE

21 rows selected.

If anyone the above segment is online then change it status to offline by using below command.


SQL>alter rollback segment "_SYSSMU9_1192467665$" offline;

Step 4 : Drop old undo tablespace

SQL> drop tablespace UNDOTBS1 including contents and datafiles;
Tablespace dropped.

Step  5 : Change undo management to auto and restart the database



SQL> alter system set undo_management=auto scope=spfile;
System altered.

SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup
ORACLE instance started.
Total System Global Area  426852352 bytes
Fixed Size                  1333648 bytes
Variable Size             364906096 bytes
Database Buffers           54525952 bytes
Redo Buffers                6086656 bytes
Database mounted.
Database opened.


SQL> show parameter undo_tablespace


NAME                                       TYPE        VALUE
------------------------------------   ----------- ------------------------------
undo_tablespace                      string      UNDOTBS2

 


I hope this article helped you. Your suggestions/feedback are most welcome.

Keep learning... Have a great day!!!

 

Tuesday 16 September 2014

RECYCLE BIN USAGE AND MAINTENANACE


RECYCLE BIN concept has been in introduced in Oracle 10g onwards. This is similar to WINDOWS RECYCLEBIN and objects are stored in FLASHBACK area.

The Recycle Bin is a virtual container where all dropped objects reside. Underneath the covers, the objects are occupying the same space as when they were created. If table EMP was created in the USERS tablespace, the dropped table EMP remains in the USERS tablespace. Dropped tables and any associated objects such as indexes, constraints, nested tables, and other dependant objects are not moved, they are simply renamed with a prefix of BIN$$. You can continue to access the data in a
dropped table or even use Flashback Query against it. Each user has the same rights and privileges on Recycle Bin objects before it was dropped. You can view your dropped tables by querying the new RECYCLEBIN view. Objects in the Recycle Bin will remain in the database until the owner of the dropped objects decides to permanently remove them using the new PURGE command. The Recycle Bin objects are counted against a user's quota. But Flashback Drop is a non-intrusive feature. Objects in the Recycle Bin will be automatically purged by the space reclamation process if

o A user creates a new table or adds data that causes their quota to be exceeded.
o The tablespace needs to extend its file size to accommodate create/insert operations.


There is no issues with DROPping the table, behaviour wise. It is the same as in 8i / 9i. The space is not released immediately and is accounted for within the same tablespace / schema after the drop.

When we drop a tablespace or a user there is NO recycling of the objects.

o Recyclebin does not work for SYS objects

a) Check current value for recyclebin and change to “ON”



SQL> show parameter recycle
NAME TYPE VALUE
———————————— ———– ——————————
buffer_pool_recycle string
db_recycle_cache_size big integer 0
recyclebin string OFF
SQL> alter system set recyclebin=on scope=spfile;
System altered.
b) Restart the DB and check the value.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1620115456 bytes
Fixed Size 2228824 bytes
Variable Size 1056968104 bytes
Database Buffers 553648128 bytes
Redo Buffers 7270400 bytes
Database mounted.
Database opened.
SQL> show parameter recycle
NAME TYPE VALUE
———————————— ———– ——————————
buffer_pool_recycle string
db_recycle_cache_size big integer 0
recyclebin string ON
SQL>
2) How to disable recycle bin in oracle.

a) Check current value for recyclebin and change to “ON”


SQL> show parameter recycle
NAME TYPE VALUE
———————————— ———– ——————————
buffer_pool_recycle string
db_recycle_cache_size big integer 0
recyclebin string ON
SQL> alter system set recyclebin=OFF scope=spfile;
System altered.
b) Restart the DB and check the value.


SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1620115456 bytes
Fixed Size 2228824 bytes
Variable Size 1056968104 bytes
Database Buffers 553648128 bytes
Redo Buffers 7270400 bytes
Database mounted.
Database opened.
SQL> show parameter recycle
NAME TYPE VALUE
———————————— ———– ——————————
buffer_pool_recycle string
db_recycle_cache_size big integer 0
recyclebin string OFF
SQL>

3) How to purge recyclebin?


Purging can be done at user level or DB level. If we need to purge at User level only tables related to user only will be deleted but if we delete at DB level, all tables will be purged.


a) Purging a specific table
  1. Connect to user.
  2.  Check the current entries using user_recyclebin;
  3.  Purge the epcific table using “purge table <table_name>;”
  4.  Check the current entries using user_recyclebin;
            E.g.:-

      SQL> create table mytesttbl2(srno number,name varchar2(20));
            Table created.

SQL> drop table mytesttbl2;
            Table dropped.
 
SQL> SELECT object_name,original_name,operation,type,dropscn,droptime
2 FROM user_recyclebin
3 /

OBJECT_NAME                      ORIGINAL_NAME      OPERATION TYPE   DROPSCN   DROPTIME
------------------------------ -------------------------------- --------- ------------------------- ---------- -------------------
BIN$30N07CjBfIvgQz7c5gqzPQ==$0 mytesttbl2
DROP TABLE 8.1832E+12  2004-03-10:11:03:49

SQL> PURGE TABLE mytesttbl2;
Table purged.

b) Purging at user level.
  1. Connect to user.
  2. Check the current entries using user_recyclebin;
  3. Purge the recyclebin using “purge recyclebin;”
  4. Check the current entries using user_recyclebin;
E.g.:-
SQL> select count(1) from user_recyclebin;
COUNT(1)
———-
0
SQL> create table mytesttbl2(srno number,name varchar2(20));
Table created.
SQL> drop table mytesttbl2;
Table dropped.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
—————————— ——- ———-
BIN$30N07CjBfIvgQz7c5gqzPQ==$0 TABLE
COUNTRIES TABLE
DEPARTMENTS TABLE
EMPLOYEES TABLE
EMP_DETAILS_VIEW VIEW
JOBS TABLE
JOB_HISTORY TABLE
LOCATIONS TABLE
MYTESTTBL TABLE
REGIONS TABLE
10 rows selected.
SQL> select count(1) from user_recyclebin;
COUNT(1)
———-
1
SQL> purge recyclebin;
Recyclebin purged.
SQL> select count(1) from user_recyclebin;
COUNT(1)
———-
0
c) Purging at DB level.
  1. Connect to DB as sysdba user.
  2. Check the current entries using dba_recyclebin;
  3. Purge the recyclebin using “purge DBA_recyclebin;”
  4. Check the current entries using DBA_recyclebin;
E.g.: – $ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Jun 16 05:53:13 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select count(1) from dba_recyclebin;
COUNT(1)
———-
0
SQL> /
COUNT(1)
———-
1
SQL> /
COUNT(1)
———-
0
SQL> select count(1) from dba_recyclebin;
COUNT(1)
———-
1
SQL> purge dba_recyclebin;
DBA Recyclebin purged.
SQL> select count(1) from dba_recyclebin;
COUNT(1)
———-
0





There are various ways to PURGE objects:

      PURGE TABLE t1;
      PURGE INDEX ind1;
      PURGE recyclebin; (Purge all objects in Recyclebin)
      PURGE dba_recyclebin; (Purge all objects / only SYSDBA can)
      PURGE TABLESPACE users; (Purge all objects of the tablespace)
      PURGE TABLESPACE users USER <user name>; (Purge all objects of the
 
      tablspace belonging to specific user)



I hope this article helped you. Your suggestions/feedback are most welcome.

Keep learning... Have a great day!!!