Updates from June, 2017 Toggle Comment Threads | Keyboard Shortcuts

  • Anıl Akduygu 22:33 on 24 June 2017 Permalink | Reply
    Tags: , , , , , ,   

    Connect Oracle from Python in Windows 

    Python is a  very popular programming language that can be used for general purposes. It is an interpreted language with object-oriented features. At my blog I will give some information about Python how you can use it for database security subjects. at this note I will explain how you can connect Oracle from Python . I assume that you already installed Python to your PC. In the future at another note I will explain how you can install and run Python at your Windows Client.

    In order to connect Oracle from Python in Windows  ; you need to downloads and install Python interface to Oracle from this website

    https://pypi.python.org/pypi/cx_Oracle

    According to your installation choose 32 bit or 64 bit module.

    Capture

    Put this interface into Scripts directory  ( C:\Python361\Scripts )  and run pip program with install option

    pip install cx_Oracle-6.0rc1-cp36-cp36m-win32.whl

    Now you installed Oracle interface for Python. The second operation is to make reachable oci.dll from Python to call Oracle libraries.

    For this reason you need to install Oracle instant client. You can download Oracle instant client from below websites.

    http://www.oracle.com/technetwork/topics/winx64soft-089540.html  ( 64 bit )

    or

    http://www.oracle.com/technetwork/topics/winsoft-085727.html  ( 32 bit)

    At this website you can see many packages to download but only Oracle Instant Client package is enough for Python.

    I download both of them and I put them in different directories. You have to just unzip these packages like below.

    Capture

     

    Capture

     

    Now you have to add the directory of the instant package into PATH environment variable like below. To change PATH variable follow below steps

    In Control  Panels choose System;

    Capture

    From this page choose Advanced system settings

    Capture

    choose Environment Variables;

    In Environment Variables; choose PATH and add Oracle Instant Client path.

    Capture

    After changing PATH variable I advice to restart your client.

    Now you can use Python module cx_Oracle to connect  Oracle database. I wrote below program to check cx_Oracle module. This program connects to an Oracle database and shows its version. At the same time It executes a small query to get database name

     

    Capture

    you can get the source of this code from github

    https://github.com/yusufanilakduygu/Wordpress-Posts/blob/master/connect-oracle-from-python-in-windows

    Check the program. Simply run it. You should get below result.

    Capture

    Now you installed and configured Oracle package in Python. You can use it your projects.

     

     
  • Anıl Akduygu 21:51 on 17 June 2017 Permalink | Reply  

    Oracle DB Vault New Features in Oracle 12c Release 1 – Part 4 : New Realms 

    Now we continue to work on changes in  Oracle Database Vault  in 12c Release 1 version. Three new Realms are added in this release . These are;

    • Oracle Default Schema Protection Realm
    • Oracle System Privilege and Role Management Realm
    • Oracle Default Component Protection Realm

     

    Let’s check these new Realms with the query.

     

    SELECT

    *

    FROM

    DVSYS.DBA_DV_REALM;

    null

    What objects are protected in  these new Realms ? Let’s start with Oracle Default Schema Protection Realm;

    SELECT

    • FROM

    DVSYS.DBA_DV_REALM_OBJECT

    WHERE

    REALM_NAME = ‘Oracle Default Schema Protection Realm’;

    null

    This realm protects roles and schemas in Oracle OLAP, Oracle Spatial, and Oracle Text. (CTXSYS, MDDATA and MDSYS)

     

    SELECT

    *

    FROM

    DVSYS.DBA_DV_REALM_AUTH

    WHERE

    REALM_NAME = ‘Oracle Default Schema Protection Realm’;

    null

    Oracle System Privilege and Role Management realm. This realm protects sensitive roles which are given below. Some import and export roles , Java roles , audit management roles, catalog operation roles..

    null

     

    Oracle Default Component Protection Realm ;  This realm protects the SYSTEM and OUTLN schemas.

    null

    You can get the SQL queries in this note at github

     

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel