meetup.html
2008-06-26 Thursday
Dan Bikle
bikle@bikle.com
http://bikle.com

Oracle database features/concepts of interest to RoR Developers:
  - Propagating data from RoR Sessions into Oracle Sessions
  - What is end-to-end tracing?
  - Enabling Data security at Oracle kernel level AND RoR application level
  - Giving priority to valuable end-users
  - Connecting RoR to Oracle Workload Services
  - What in Oracle RAC is of interest to the RoR developer?
  - Raimonds Simanovskis: ruby-plsql gem: simple Ruby API for PL/SQL procedures
  - Raimonds Simanovskis: ActiveRecord Oracle enhanced adapter


Propagating data from RoR Sessions into Oracle Sessions:
  - http://bikle.com/protected/roracle_session
  - RoR Session Data values:
    - RoR login name
    - Shopping cart contents
  - Oracle Session keys (and values):
    http://www.google.com/search?q=oracle+v$session
    oracle username:
      - useful for seeing separate RoR installations
    module
      - useful for holding controller name
    action
      - useful for holding controller method
    client_info
      - useful for holding interesting data like shopping cart
    client_identifier
      - useful for holding RoR login name
    service_name
      - AKA: database door
      - http://www.google.com/search?q=oracle+workload+services
      - useful for seeing separate RoR installations
      - useful for tracing, resource constraint, security
    machine
      - useful for seeing separate RoR installations

End-to-end tracing:
  - http://www.google.com/search?q=oracle+end+to+end+tracing
  - Scenario1:
    - Auditing (Report on resource usage by controller and method)
    - Auditing (Report on resource usage by RoR login name)
  - Scenario2:
    - The site is slow!
    - Please "look" at the database
    - Good Oracle tool: Enterprise Manager
    - If it is the database, expect to see:
      - Database very busy or
      - Database quiet
      - If Database not busy or quiet, probably not Database:
        - ex: Reverse DNS lookup
        - ex: NFS
      - If Database very busy:
        - we want to trace resource hogs back to an application
        - Enterprise Manager very good for this (if sessions are tagged)
      - If Database quiet:
        - Database server is probably starved for something
        - I/O problem?
        - Network go down?
        - Out of disk space?
        - Enterprise Manager somewhat helpful here

Enabling Data security at Oracle kernel level AND RoR application level:
  Security at RoR level:
    - Maybe code it into controller
    - Demo: http://hpricot.com/ then browser search "repel_them"
  Security at Oracle level:
    - http://www.google.com/search?q=oracle+vpd
    - main idea: Enforce security policies based on session attributes
    - Ex: 
      - Only I should see my credit card #
      - My SSN (hash actually) could be in client_identifier
      - client_identifier value could then be used in policy implementation (PL/SQL)
      - PL/SQL: http://www.bikle.com/old_site.html then browser search "PL/SQL"
 

Giving priority to valuable end-users:
  - http://www.google.com/search?q=oracle+resource+manager
  - Main idea: Constrain end users by matching their session values to implemented policies
  - Demo Policy:
    - A user with books in his cart and is "checking-out" should not be constrained
    - A user with books in his cart should get more resources than a user with no books in his cart
    - A user with no books in his cart should get more resources than a bot which is crawling the site
    - A bot crawling the site should get more resources than batch programs which create BI reports.

Connecting RoR to Oracle Workload Services:
  - http://www.google.com/search?q=oracle+workload+services
  - Main idea: A workload service (AKA "service") is like a door
  - Once you walk through that dooor, you are implicitly tagged
  - Implicit means convenient:
    - No RoR coding required!
    - Session is tagged so Resource Manager could be used
    - Session is tagged so VPD could be used
    - Session is tagged so End-to-end tracing could be used
  - Demo, Accounting Application:
    - service1: GL
    - service2: Acct Payable
    - service3: Acct Receivable
    - service4: Order Entry
  - Question: Resource Manager Policy should be ...?

What in Oracle RAC is of interest to the RoR developer:
  - RAC Archictecture:
    - 1 database (shared everything)
    - Several servers AKA instances all connected by "bus"
  - Features:
    - Redundancy
    - Throughput
    - Implicit (effective and low-tech) workload management
  - Implementation Details:
    - Use workload services to span instances:
      - RAC workload services features:
        - Load Balancing if instance busy
        - Failover       if instance dies
    - Service can be: Preferred, Available, NotUsed

Homework:
  - Raimonds Simanovskis: ruby-plsql gem: simple Ruby API for PL/SQL procedures
  - Raimonds Simanovskis: ActiveRecord Oracle enhanced adapter