Moneycontrol Brokerage Recos

Thursday, April 9, 2015

ORA-12162 TNS:net service name is incorrectly specified

I just setup Orale 11g R2 ASM based on ASMLib and it went fine during installation and was working well.

When I rebooted my system then I was not able to connect to ASM Instance since it's PMON service was up and running.


[grid@ora11gsrv grid]$ ps -ef | grep pmon
grid     10957     1  0 09:47 ?        00:00:00 asm_pmon_+ASM
grid     11890 11866  0 10:12 pts/1    00:00:00 grep pmon


[grid@ora11gsrv grid]$ crs_stat
NAME=ora.DATA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE
STATE=ONLINE on ora11gsrv

NAME=ora.LISTENER.lsnr
TYPE=ora.listener.type
TARGET=ONLINE
STATE=ONLINE on ora11gsrv

NAME=ora.asm
TYPE=ora.asm.type
TARGET=ONLINE
STATE=ONLINE on ora11gsrv

NAME=ora.cssd
TYPE=ora.cssd.type
TARGET=ONLINE
STATE=ONLINE on ora11gsrv

NAME=ora.diskmon
TYPE=ora.diskmon.type
TARGET=ONLINE
STATE=ONLINE on ora11gsrv



So, this problem was all about related to environment variables so nothing to do with listener, ASM instance and database, all we need to do is to just set the proper env variables.


Just go to the user's home directroy installed ASM and set the following:


[grid@ora11gsrv grid]$ vi /home/grid/.bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

ORACLE_SID=+ASM

export ORACLE_SID

ORACLE_HOME=/u01/app/grid/product/11.2.0/grid

export ORACLE_HOME

PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

export PATH
~        

:wq!



Now go back to your terminal and walk with following steps:



[grid@ora11gsrv grid]$ ps -ef | grep pmon
grid     10957     1  0 09:47 ?        00:00:00 asm_pmon_+ASM
grid     11890 11866  0 10:12 pts/1    00:00:00 grep pmon



[grid@ora11gsrv grid]$ . oraenv
ORACLE_SID = [grid] ? +ASM
The Oracle base for ORACLE_HOME=/u01/app/grid/product/11.2.0/grid is /u01/app/grid




[grid@ora11gsrv grid]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 9 10:13:14 2015

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Automatic Storage Management option

SQL> set linesize 220
SQL> select * from v$instance;

INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME                                                        VERSION           STARTUP_T STATUS       PAR    THREAD# ARCHIVE LOG_SWITCH_WAIT LOGINS     SHU DATABASE_STATUS
--------------- ---------------- ---------------------------------------------------------------- ----------------- --------- ------------ --- ---------- ------- --------------- ---------- --- -----------------
INSTANCE_ROLE      ACTIVE_ST BLO
------------------ --------- ---
              1 +ASM             ora11gsrv                                                        11.2.0.1.0        09-APR-15 STARTED      NO           0 STOPPED        ALLOWED    NO  ACTIVE
UNKNOWN            NORMAL    NO

 

Now, I'm able to connect to ASM instance.

No comments:

Post a Comment