Storage Management (ASM ACFS DNFS ODM) (MOSC)

MOSC Banner

Connecting to ASM instance through cx_Oracle Python library

edited Apr 6, 2022 11:42PM in Storage Management (ASM ACFS DNFS ODM) (MOSC) 14 commentsAnswered

Hi,

I am trying to connect to an ASM instance through cx_Oracle python library & the code-snippet is like below :

<start>

#!/usr/bin/python

from pprint import pprint

import sys

import os

import cx_Oracle

SID = "+ASM1"

HOME= "/u01/app/gridhome"

INSTANCE_TYPE = "ASM"

os.environ['ORACLE_SID']= SID

os.environ['ORACLE_HOME']= HOME

os.environ['INSTANCE_TYPE']= INSTANCE_TYPE

conn = cx_Oracle.Connection("sys", "password", mode=cx_Oracle.SYSASM)

<end>

Manually if i try to login to ASM, after exporting SID, HOME, INSTANCE_TYPE, i am able to run ASM views, queries etc.

BUT After running python code, it's giving following error :

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center