Wednesday, March 28, 2012

ORA-12519: TNS:no appropriate service handler found.

This error is mainly due to the low "PROCESSES" initialization parameter value.
PROCESS - parameter describes the total number of operating system process allowed to access the database concurrently.

This total process is divided into user process and background processes, user processes are the processes allotted to the users connected to the database and the background processes are the processes utilized by the database.

Procedure to increase the PROCESSES parameter
Login as SYS user
 SQL>alter system set processes=200 scope=spfile;  


then stop and start the DB server.

 SQL> shutdown immediate;  
SQL> startup;

Monday, March 26, 2012

Variable declarartion in Package specification

Variables / Collections / Cursors declared in the specification of the package are global to the session.

We are going to create a sample package to check the scope of the variable defined in the package specification.

Package
 CREATE OR REPLACE PACKAGE test_scope IS  
v_global_char VARCHAR2(300);
FUNCTION test_func(v_char VARCHAR2) RETURN BOOLEAN;
END test_scope;
CREATE OR REPLACE PACKAGE BODY test_scope IS
FUNCTION test_func(v_char VARCHAR2) RETURN BOOLEAN IS
BEGIN
v_global_char := v_char;
RETURN TRUE;
END;
END test_scope;


Assigning and checking the value in the same session

 SQL>   
SQL> SET serveroutput ON;
SQL> DECLARE
2 v_test BOOLEAN;
3 BEGIN
4 v_test :=test_scope.test_func('Oracle 11g PL/SQL Programming');
5 END;
6 /
PL/SQL procedure successfully completed
SQL> BEGIN
2 dbms_output.put_line(test_scope.v_global_char);
3 END;
4 /
Oracle 11g PL/SQL Programming
PL/SQL procedure successfully completed
SQL>


Checking the Assigned Value in different session

 SQL> set serveroutput on;  
SQL>
SQL> BEGIN
2 dbms_output.put_line(test_scope.v_global_char);
3 END;
4 /
PL/SQL procedure successfully completed
SQL>


So whatever the value stored in the global variable of package specification exist until the session expires.