Friday, January 24, 2014

Kill session on specific node of RAC

How to kill a user session on specific node of Oracle RAC


SQL> select INST_ID,  username, sid, serial#, osuser, status from gv$session where username in ('TEST');

   INST_ID USERNAME       SID    SERIAL# OSUSER          STATUS
---------- ----------- ------ ---------- --------------- --------
         1 TEST           597       1901 oraem           ACTIVE
         8 TEST           695       5391 oradba          ACTIVE

2 rows selected.

When we try to kill the session as we do in a single instance database it throws a error.

SQL> alter system kill session '695,5391' immediate;
alter system kill session '695,5391' immediate
*
ERROR at line 1:
ORA-00030: User session ID does not exist.


Solution: We need to provide the Instance ID along with the kill session command. i.e.

alter system kill session 'SID,SERIAL#,@<INST_ID>' immediate;

SQL> alter system kill session '695,5391,@8' immediate;

System altered.

Elapsed: 00:00:07.02
SQL> select INST_ID,  username, sid, serial#, osuser, status from gv$session where username in ('TEST');

   INST_ID USERNAME       SID    SERIAL# OSUSER          STATUS
---------- ----------- ------ ---------- --------------- --------
         1 TEST           597       1901 oraem           ACTIVE

1 row selected.

Thursday, January 23, 2014

Repository Creation Utility - Warning | ORA-01450: maximum key length (6398) exceed


Issue: While trying to create repository schema using rcu, we were getting the following error

Repository Creation Utility - Warning | ORA-01450: maximum key length (6398) exceed


Solution: The NLS_LENGTH_SEMANTICS parameter was set to a value of CHAR. Change the value to BYTE and again invoke the rcu, it will go through.

SQL> show parameter NLS_LENGTH_SEMANTICS

NAME                     TYPE        VALUE
------------------------ ----------- -------
nls_length_semantics     string      CHAR

SQL> alter system set nls_length_semantics=BYTE;

System altered.

SQL> show parameter NLS_LENGTH_SEMANTICS

NAME                     TYPE        VALUE
------------------------ ----------- -------
nls_length_semantics     string      BYTE


Note: Though this parameter is system modifiable, in one of the scenario, after setting this parameter still it was not working, when I bounced the database.. it worked.

Wednesday, January 15, 2014

mount: mount to NFS server failed: RPC Error: Program not registered.


Issue:
[root@linux01 ~]# mount -t nfs linux02:/u01/app /u01/app
mount: mount to NFS server 'linux02' failed: RPC Error: Program not registered.

[root@linux02 ~]# showmount
mount clntudp_create: RPC: Program not registered

Solution:
the nfs service was down on the source server so started the same and able to mount the drive successfully in the destination server.

[root@linux02 ~]# service nfs start
Starting NFS services:                           [  OK  ]
Starting NFS daemon:                             [  OK  ]
Starting NFS mountd:                             [  OK  ]

[root@linux01 ~]# mount -t nfs linux02:/u01/app /u01/app

Friday, January 10, 2014

Oracle 12c Express EM Configuration

Oracle 12c doesn't have the same EM which was used to be till 11g. The 12c comes with express EM.

How to configure a express EM in 12c.
Login to the database and execute the below command to verify whether Express EM is configured or not.
select dbms_xdb_config.gethttpsport () from dual;

If the above statement returns any row(that will be the port number), that means the Express EM is configured. Use that port number to connect to EM(use https) as
https://<hostname>:<port_number>/em

Else on the server first verify which port is free using the below mentioned command. If for a port number no output is returned that may mean its free and can be used(please verify that other applications are not using that port)
netstat -an|grep <port number> (We can use any port e.g. 1158)

Then connect to the database as sys user and execute the below command;
exec dbms_xdb_config.sethttpsport (1158);

select dbms_xdb_config.gethttpsport () from dual;

You can use the above port to connect to the Express EM.

The following points you must remember while configuring the Express EM
1. It uses https 
2. The parameter DISPATCHERS must be set.

SQL> show parameter dispatchers

NAME               TYPE        VALUE
------------------ ----------- ------------------------------
dispatchers        string      (PROTOCOL=TCP)(SERVICE=orclXDB)

If its not set, we need to set it 
e.g. for my SID orcl I have set using the below command
alter system set dispatchers='(PROTOCOL=TCP)(SERVICE=orclXDB)' scope=both;