Thursday, 24 November 2011

/3GB switch to increase the SGA size in windows

On 32 bit OS we can increase the SGA maximum up to 1700MB but by using /3GB switchs for complete memory addressed on windows server 2003 you can use maximum up to 3GB SGA for Oracle.

Additionally by using /PAE & /NoExecute=AlwaysOn switch you can use more than 3.2GB Physical RAM on 32bit windows server 2003 for all programs other than oracle.

Means 
In my test case i have 6 GB Physical RAM and 2Gb paging from OS. So if I use these switches I have maximum 3GB SGA and remaining 3GB+2GB for OS and other windows program.

NOTE
If I don't use these switches we have to face to possible errors

ORA-04030: out of process memory when trying to allocate 123404 bytes (QERHJ hash-joi,kllcqas:kllsltba)

OR

TNS-12518: TNS: listener could not hand off client connection
this error usually comes when your memory full reached or your listener comes in blocked state. you can check listener state by lsnrctl services command.

TEST CASE 1  with:  /3GB /PAE /NoExecute=AlwaysOn switchs in boot.ini


Changes made to Boot.ini
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /noexecute=AlwaysOn /3GB /PAE /fastdetect


MEMORY
Physical RAM     = 6GB
OS Paging Area = 2GB

SPFILE.ORA PARAMETERS
SGA_MAX_SIZE=1300M
SGA_TARGET=1300M
PGA_AGGREGATE_TARGET =194M
PROCESSES=500
SESSIONS=555
After Taking connection form sqlpls of HR user
SQL> select * from v$resource_limit where resource_name='processes';

RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL LIMIT_VALU
------------------------------ ------------------- --------------- ---------- ----------
processes                                      499             500        500        500

SQL> select * from v$resource_limit where resource_name='sessions';

RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL LIMIT_VALU
------------------------------ ------------------- --------------- ---------- ----------
sessions                                       503             504        555        555

SQL> select username , module ,count(username) from v$session group by username, module;

USERNAME                       MODULE                                           COUNT(USERNAME)
------------------------------ ------------------------------------------------ ---------------
SYSMAN                         OMS                                                       1
HR                                    SQL*Plus                                               474
DBSNMP                        emagent.exe                                          2
SYSMAN                         OEM.SystemPool                                  2
SYS                                  sqlplusw.exe                                           1
SYSMAN                         OEM.Loader                                           1

After Taking 503 session new session blocked by listener because of processes parameter limits reached.

So this is because of switchs I can able to make 500 connections 


HR 452 connections is from server side (in that case each sqlplus.exe took 14M aprox from memory which is also addressable) . So I can make more connection from different clients.
HR 22 connections is from client side


 
TEST CASE 2 with:  /NoExecute=OptIn switchs in boot.ini 


multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /noexecute=OptIn /fastdetect


MEMORY

Same as above


SPFILE.ORA PARAMETERS

Same as above


SQL> select * from v$resource_limit where resource_name='processes';



RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL LIMIT_VALU

------------------------------ ------------------- --------------- ---------- ----------

processes                                      266             269        500        500



SQL> select * from v$resource_limit where resource_name='sessions';



RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL LIMIT_VALU

------------------------------ ------------------- --------------- ---------- ----------

sessions                                       270             273        555        555



SQL> select username , module ,count(username) from v$session group by username, module;



USERNAME                       MODULE                                           COUNT(USERNAME)

------------------------------ ------------------------------------------------ ---------------

                                                                                                                         0

SYSMAN                         OMS                                                            1

HR                             SQL*Plus                                                         241

DBSNMP                         emagent.exe                                             2

SYS                            sqlplusw.exe                                                    1

SYSMAN                         OEM.SystemPool                                      2

SYSMAN                         OEM.Loader                                               1



After Taking total 270 session new session still open and processes parameter limits nopt reached.





HR 241 connections is from server side (in that case each sqlplus.exe took 14M aprox from memory also) . So I can make more connection from different clients.



HR 1 connections is from client side



After this I am facing the below error on connection.

As you can see currently 7.05 GB memory is using less than 900 MB from the 1st case. And we can make HR 271 connections and we make 474 connections of HR in 1st case
 

TEST CASE 3 with:  /NoExecute=OptIn /PAE switchs in boot.ini


multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /noexecute=OptIn /PAE /fastdetect


MEMORY

Same as above

SPFILE.ORA PARAMETERS

Same as above


Only 249 session can able to connect to database in which 243 is HR 



TEST CASE 4 with:  /NoExecute=AlwaysOn /PAE switchs in boot.ini


multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /noexecute=AlwaysOn /PAE /fastdetect


MEMORY

Same as above


SPFILE.ORA PARAMETERS

Same as above


Only 255 session can able to connect to database in which 225 is HR



SQL> select * from v$resource_limit where resource_name='sessions';



RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL LIMIT_VALU

------------------------------ ------------------- --------------- ---------- ----------

sessions                                       255             257        555        555



SQL> select * from v$resource_limit where resource_name='processes';



RESOURCE_NAME                  CURRENT_UTILIZATION MAX_UTILIZATION INITIAL_AL LIMIT_VALU

------------------------------ ------------------- --------------- ---------- ----------

processes                                      251             253        500        500




Hope you all understand the game of this switches.

ORA-06512: at "SYS.DBMS_DEBUG_JDWP", line 68


From Sql developer facing below issue.
Executing PL/SQL: ALTER SESSION SET PLSQL_DEBUG=TRUE
Executing PL/SQL: CALL DBMS_DEBUG_JDWP.CONNECT_TCP( '10.142.58.22', '52331' )
ORA-01031: insufficient privileges
ORA-06512: at "SYS.DBMS_DEBUG_JDWP", line 68
ORA-06512: at line 1
This session requires DEBUG CONNECT SESSION and DEBUG ANY PROCEDURE user privileges.
Process exited.
Disconnecting from the database KASBDB_RAC.

Solution
SQL> grant debug connect session, debug any procedure to  <Username>

User and Role what priviliges have assign


What Role does user have in current running session
SQL> show user
USER is "VISION211"

SQL> select * from session_roles;
ROLE
------------------------------
CONNECT
RESOURCE

What Role does user have and with admin option or not
SQL> show user
USER is "VISION211"

SQL> select * from user_role_privs;
USERNAME                       GRANTED_ROLE                   ADM DEF OS_
------------------------------ ------------------------------           --- --- ---
VISION211                      CONNECT                                   NO  YES NO
VISION211                      RESOURCE                                  NO  YES NO

What System Privileges does ROLE have and with admin option or not
SQL> desc role_sys_privs
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ROLE                                      NOT NULL VARCHAR2(30)
 PRIVILEGE                                 NOT NULL VARCHAR2(40)
 ADMIN_OPTION                                       VARCHAR2(3)

SQL> select PRIVILEGE, ADMIN_OPTION from role_sys_privs where role='RESOURCE';

PRIVILEGE                                ADM
---------------------------------------- ---
CREATE SEQUENCE                       NO
CREATE TRIGGER                           NO
CREATE CLUSTER                           NO
CREATE PROCEDURE                     NO
CREATE TYPE                              NO
FORCE TRANSACTION               NO
CREATE VIEW                              NO
CREATE OPERATOR                    NO
CREATE TABLE                             NO
CREATE INDEXTYPE                    NO

Sunday, 13 November 2011

ORA-23515: materialized views and/or their indices exist in the tablespace

SQL> drop tablespace TEST1 including contents cascade constraints;
*
ERROR at line 1:
ORA-23515: materialized views and/or their indices exist in the tablespace

Now you have to drop all materialized view in this tablespace to drop this tablespace.

SQL> drop materialized view  <MV_NAME>
 
Materialized view dropped.

Elapsed: 00:00:01.70
 
SQL> drop tablespace TEST1 including contents and datafiles;

Tablespace dropped.

Elapsed: 00:00:01.37
SQL>

Sunday, 16 October 2011

Setup ssh user equivalence for all RAC nodes


This Example Done on Two Node SSH Setup:
Log on as user ORACLE on nodes. Do not give pass phrase to any of the methods below.

ON NODE 1

Step 1

[root@rac1pub ~]# su - oracle

Step 2

[oracle@rac1pub ~]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Created directory '/home/oracle/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
b1:24:2f:8f:5a:27:4b:ce:aa:09:ce:13:bd:d8:b1:3e
oracle@rac1pub.kasb.com

Step 3

[oracle@rac1pub ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_rsa.
Your public key has been saved in /home/oracle/.ssh/id_rsa.pub.
The key fingerprint is:
68:0f:79:13:76:a7:a1:2e:ce:6e:1f:a6:2b:1a:15:f3
oracle@rac1pub.kasb.com

Step 4

[oracle@rac1pub ~]$ cd /home/oracle/.ssh

Step 5

[oracle@rac1pub .ssh]$ ls -ltr
total 16
-rw-r--r--  1 oracle oinstall 613 Oct 16 23:06 id_dsa.pub
-rw-------  1 oracle oinstall 668 Oct 16 23:06 id_dsa
-rw-r--r--  1 oracle oinstall 233 Oct 16 23:06 id_rsa.pub
-rw-------  1 oracle oinstall 883 Oct 16 23:06 id_rsa


Step 6

Note: The file name should be (authorized_keys) their is no chance for spelling mistake.
otherwise your ssh will be failed.


[oracle@rac1pub .ssh]$ cat id_dsa.pub >> authorized_keys

[oracle@rac1pub .ssh]$ cat id_rsa.pub >> authorized_keys

Step 7
Now we are sending node1 ssh keys to node 2 in temporary file because to get this keys in authorized_keys file of Node 2
 
[oracle@rac1pub .ssh]$ scp authorized_keys  rac2pub:/tmp/rac1keys.tmp


The authenticity of host 'storage (192.168.1.192)' can't be established.
RSA key fingerprint is 97:b4:a8:13:a1:76:57:44:e2:0b:60:c1:b8:13:db:27.
Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'rac2pub,192.168.1.192' (RSA) to the list of known hosts.oracle@rac2pub's password:
authorized_keys                                                   100% 1692     1.7KB/s   00:00
 

ON NODE 2
Now you can verfiy on Rac node 2 in tmp directory file(rac1keys.tmp) should be their

[oracle@rac2pub ~]$ cd /tmp
[oracle@rac2pub tmp]$ ls -ltr
-rw-r--r--  1 oracle oinstall  1692 Oct 17 00:06 rac1keys.tmp

STEPS ON NODE 2==================================================
Note: Follow same Steps(1 to 6) done on RAC node 1


Step 7
Now we are sending node2 ssh keys to node 1 in temporary file because to get this keys in authorized_keys file of Node 1


[oracle@rac2pub .ssh]$ scp authorized_keys  rac1pub:/tmp/rac2keys.tmp
The authenticity of host 'storage (192.168.1.191)' can't be established.
RSA key fingerprint is 97:b4:a8:13:a1:76:57:44:e2:0b:60:c1:b8:13:db:27.
Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'rac1pub,192.168.1.191' (RSA) to the list of known hosts.oracle@rac1pub's password:
authorized_keys                                                   100% 1692     1.7KB/s   00:00



ON NODE 1
Now you can verfiy on Rac node 1 in tmp directory file (rac2keys.tmp) should be their
[oracle@rac1pub ~]$ cd /tmp
[oracle@rac1pub tmp]$ ls -ltr
-rw-r--r--  1 oracle oinstall  1692 Oct 17 00:15 rac2keys.tmp


After you have done all above now proceed further

ON NODE 1

[oracle@rac1pub ~]$ cd /home/oracle/.ssh/
[oracle@rac1pub .ssh]$ cat /tmp/rac2keys.tmp >> authorized_keys

ON NODE 2


[oracle@rac2pub ~]$ cd /home/oracle/.ssh/
[oracle@rac2pub .ssh]$ cat /tmp/rac1keys.tmp >> authorized_keys


Gather ssh fingerprints of all RAC nodes.
Now get fingerprints of all possible interfaces / nodes of this RAC setup using ssh.

NOTE: You need to exit after each successful logon to avoid confusion.

On Node 1:
ssh rac1pub.kasb.com
ssh rac1pvt.kasb.com
ssh rac2pub.kasb.com
ssh rac2pvt.kasb.com
ssh rac1pub
ssh rac1pvt
ssh rac2pub
ssh rac2pvt


On Node 2:
ssh rac1pub.kasb.com
ssh rac2pub.kasb.com
ssh rac1pvt.kasb.com
ssh rac2pvt.kasb.com
ssh rac1pub
ssh rac1pvt
ssh rac2pub
ssh rac2pvt


I put two practical example for your more uderstanding that what I am trying to say in Gather ssh fingerprints of all RAC nodes.
============================================================================
[oracle@rac1pub .ssh]$ ssh rac1pub.kasb.com

The authenticity of host 'rac1pub.kasb.com (192.168.1.191)' can't be established.
RSA key fingerprint is 97:b4:a8:13:a1:76:57:44:e2:0b:60:c1:b8:13:db:27.
Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'rac1pub.kasb.com,192.168.1.191' (RSA) to the list of known hosts.
[oracle@rac1pub ~]$ exit
logout
Connection to rac1pub.kasb.com closed.

[oracle@rac1pub .ssh]$ ssh rac1pvt.kasb.com
The authenticity of host 'rac1pvt.kasb.com (10.0.0.1)' can't be established.
RSA key fingerprint is 97:b4:a8:13:a1:76:57:44:e2:0b:60:c1:b8:13:db:27.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'rac1pvt.kasb.com,10.0.0.1' (RSA) to the list of known hosts.
Last login: Sun Oct 16 23:34:57 2011 from rac1pub.kasb.com

[oracle@rac1pub ~]$ exit
logout

=================================================================================

Verfication of Passwordless SSH connection
Here your passwordless connection established between both node

ON NODE 1You can see date of both nodes will be appeared without password prompt

[oracle@rac1pub ~]$ ssh rac1pub date
Sun Oct 16 23:41:29 PKT 2011
[oracle@rac1pub ~]$ ssh rac2pub date
Sun Oct 16 23:41:03 PKT 2011
[oracle@rac1pub ~]$ ssh rac2pvt date
Sun Oct 16 23:41:20 PKT 2011

ON Node 2
[oracle@rac2pub ~]$ ssh rac1pub date
Sun Oct 16 23:42:18 PKT 2011
[oracle@rac2pub ~]$ ssh rac1pvt date
Sun Oct 16 23:42:26 PKT 2011
[oracle@rac2pub ~]$ ssh rac2pvt date
Sun Oct 16 23:41:59 PKT 2011
[oracle@rac2pub ~]$ ssh rac2pub date
Sun Oct 16 23:42:06 PKT 2011
[oracle@rac2pub ~]$ ssh 192.168.1.191 date
Sun Oct 16 23:42:52 PKT 2011


Congratualtion your SSH have now Configured for Oracle Rac 10g.




The Best AI Apps for Android That Make Your Smartphone Smarter

The Best AI Apps for Android That Make Your Smartphone Smarter   Introduction: In today's digital age, artificial intelligence (AI) ...