Oracle Data Access Component for Database Programming
If you need to connect to Oracle in Visual Studio to program Oracle databases, you just need to download Oracle.ManagedDataAccess.dll, a dynamic link library file, without installing the full Oracle client as instructed below. You can then include the DLL file into your project by going to Project --> Add References --> Browse menu choices.
Oracle Instant Client for Windows
If you need to connect to Oracle database in R to import data, you need to install Oracle instant client (without installing the full client as instructed below). Here are the simple steps to follow:
- Download either 32-bit or 64-bit oracle instant client packages, both basic package and optional SQL Plus package from https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html
- Unzip the file to one place such as c:\Program Files\Oracle\instantclient
- Go the system control panel and set a path variable pointing to c:\Program Files\Oracle\instantclient (follow https://www.ecourse.org/news.asp?which=5822 on how to setup or change environment variables)
- In order to setup alias for connections to database servers, create network\admin subdirectories inside c:\Program Files\Oracle\instantclient and download or copy tnsnames.ora (get a copy from your DB admin of something like tnsnames.zip or create your own with the content as follows) file into the admin directory.
# tnsnames.ora Network Configuration File loation:c:\Program Files\Oracle\instantclient\NETWORK\ADMIN\tnsnames.ora
ecourse.org =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ecourse.org)(PORT = 1521)))
(CONNECT_DATA =(SERVICE_NAME = ol8.ecourse.org) )
)
COB19C =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ism.uakron.edu)(PORT = 1521)))
(CONNECT_DATA =(SERVICE_NAME = cob19c.uanet.edu) )
)
- To test the installation, run CMD from windows Start button and type sqlplus to run SQLPLUS. Type scott@COB19C as user and tiger as password to see if you can login.
Instant Client for Mac OS (for R Programming class)
Oracle does not have binary client for Mac OS. However, we can use its instant client to run SQL PLUS or simply connect to an Oracle server. It is a bit more complicated, and here are the steps:
1. Download and unzip four files from oracle.com into one folder instantclient10 inside the user's Downloads folder
instantclient-basic-macosx-10.1.0.3.zip
instantclient-sqlplus-macosx-10.1.0.3.zip
instantclient-sdk-macosx-10.1.0.3.zip
instantclient-jdbc-macosx-10.1.0.3.zip
2. Create two symbolic links for the files that have the version appended. This is so the Ruby OCI8 driver can find what it’s looking for.
cd instantclient10
ln -s libclntsh.dylib.10.1 libclntsh.dylib
ln -s libocci.dylib.10.1 libocci.dylib
cd ..
3. Create directory /usr/local/oracle and then copy instantclient10 into it (assume your user name is xyz)
sudo mkdir /usr/local/oracle
sudo mv /users/xyz/Downloads/instantclient10 /usr/local/oracle/instantclient10
4. Open the system /etc/profile
sudo pico /etc/profile
Add these lines to /etc/profile to the end of the file:
DYLD_LIBRARY_PATH="/usr/local/oracle/instantclient10"
export DYLD_LIBRARY_PATH ORACLE_HOME="/usr/local/oracle/instantclient10" export ORACLE_HOME PATH=$ORACLE_HOME:$PATH
Then save it and reload your profile
source /etc/profile
Test it out with the sqlplus command line app.
sqlplus scott/tiger@//cobismcourses.uakron.edu:1521/cob19c.uanet.edu
If you can connect with that, then you're good to go.
5. (optional) Create network/admin subfolder inside /usr/local/oracle/instantclient10 folder and copy tnsnames.ora file: either by downloading tnsnames.zip or creating your own with the content as below
# tnsnames.ora Network Configuration File loation:c:\Program Files\Oracle\instantclient\NETWORK\ADMIN\tnsnames.ora
ecourse.org =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ecourse.org)(PORT = 1521)))
(CONNECT_DATA =(SERVICE_NAME = ol8.ecourse.org) )
)
COB19C =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = cobismcourses.uakron.edu)(PORT = 1521)))
(CONNECT_DATA =(SERVICE_NAME = cob19c.uanet.edu) )
)
and put the file into the folder using the following commands:
sudo mkdir /usr/local/oracle/instantclient10/network
sudo mkdir /usr/local/oracle/instantclient10/network/admin
sudo mv tnanames.ora /usr/local/oracle/instantclient10/network/admin
chmod 755 /usr/local/oracle/instantclient10/network/admin/tnsnames.ora
Now we can use server alias such as cob19c to make connections.
Full Oracle Client Installations and Setup
(Note: you may need to follow VPN Setup to Connect to a test database server on Campus):
Go to https://www.oracle.com/database/technologies/oracle19c-windows-downloads.html and download Oracle database 19C client (see below, choose the second one to download):
Additional Commands for Teachers (with admin):
CREATE PROFILE student LIMIT
FAILED_LOGIN_ATTEMPTS 6
PASSWORD_LIFE_TIME 180
PASSWORD_REUSE_TIME 60
PASSWORD_REUSE_MAX 5
PASSWORD_LOCK_TIME 2
PASSWORD_GRACE_TIME 14;
drop role student;
create role student;
grant create session to student;
grant CREATE CLUSTER to student;
grant CREATE INDEXTYPE to student;
grant CREATE OPERATOR to student;
grant CREATE PROCEDURE to student;
grant CREATE SEQUENCE to student;
grant CREATE TABLE to student;
grant CREATE TRIGGER to student;
grant CREATE TYPE to student;
grant create view to student;
grant CREATE DATABASE LINK to student;
grant CREATE DIMENSION to Student;
grant create any index to Student;
grant CREATE JOB to student;
grant CREATE LIBRARY to student;
grant CREATE MATERIALIZED VIEW to student;
grant CREATE SYNONYM to student;
grant unlimited tablespace to student;
drop role teacher;
create role teacher;
grant create user, alter user to teacher;
grant student to teacher with admin option;
create user SCOTT identified by TIGER
default tablespace users
temporary tablespace temp
profile student;
revoke student from scott;
grant student to SCOTT; --student account
|