[CalendarServer-changes] [15624] CalendarServer/trunk/doc

source_changes at macosforge.org source_changes at macosforge.org
Fri May 20 12:00:33 PDT 2016


Revision: 15624
          http://trac.calendarserver.org//changeset/15624
Author:   cdaboo at apple.com
Date:     2016-05-20 12:00:33 -0700 (Fri, 20 May 2016)
Log Message:
-----------
Documentation and scripts for using an Oracle DB VM.

Added Paths:
-----------
    CalendarServer/trunk/doc/OracleVM/
    CalendarServer/trunk/doc/OracleVM/ReadMe.md
    CalendarServer/trunk/doc/OracleVM/oracle-on-mac.py
    CalendarServer/trunk/doc/OracleVM/rebuild.sql

Added: CalendarServer/trunk/doc/OracleVM/ReadMe.md
===================================================================
--- CalendarServer/trunk/doc/OracleVM/ReadMe.md	                        (rev 0)
+++ CalendarServer/trunk/doc/OracleVM/ReadMe.md	2016-05-20 19:00:33 UTC (rev 15624)
@@ -0,0 +1,28 @@
+# Local Oracle Development
+
+## Setup
+
+* Get VirtualBox
+* Install OTN\_Developer\_Day\_VM\_12c.otn
+* Install instantclient locally
+
+## Run
+
+### VM
+* Run VirtualBox
+* Add the rebuild.sql script to the VM shell
+* Copy the current_oracle.sql to the VM shell
+* Run sqlplus (`user: hr` `pswd:oracle`)
+* In sqlplus: `@rebuild;`
+
+### CS
+* Configure the DB:
+
+    endpoint: tcp:192.168.56.101:1521
+    database: orcl
+    user: hr
+    password: oracle
+
+* Paths: ensure that `~/.oracle/instantclient_xxx` is in `LD_LIBRARY_PATH`, `DYLD_LIBRARY_PATH`, and `ORACLE_HOME`
+
+* Run server

Added: CalendarServer/trunk/doc/OracleVM/oracle-on-mac.py
===================================================================
--- CalendarServer/trunk/doc/OracleVM/oracle-on-mac.py	                        (rev 0)
+++ CalendarServer/trunk/doc/OracleVM/oracle-on-mac.py	2016-05-20 19:00:33 UTC (rev 15624)
@@ -0,0 +1,84 @@
+
+import webbrowser
+
+from pipes import quote as shellquote
+from textwrap import wrap, dedent
+from os.path import exists, expanduser, join as j
+from os import mkdir, symlink
+from errno import EEXIST, EISDIR
+from zipfile import ZipFile
+
+dlpage = "http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html"
+
+downloads = [
+    "instantclient-basic-macos.x64-11.2.0.4.0.zip",
+    "instantclient-sdk-macos.x64-11.2.0.4.0.zip",
+    "instantclient-sqlplus-macos.x64-11.2.0.4.0.zip",
+]
+
+ordir = expanduser("~/.oracle")
+
+
+
+def mkdirp(d):
+    try:
+        mkdir(d)
+    except OSError, ose:
+        if ose.errno not in (EEXIST, EISDIR):
+            pass
+mkdirp(ordir)
+
+
+
+def downloaded():
+    for download in downloads:
+        dl = j(expanduser("~/Downloads/OracleDB"), download)
+        if exists(dl):
+            ZipFile(dl).extractall(ordir)
+            continue
+        break
+    else:
+        return True
+    return False
+
+import fcntl
+import tty
+import struct
+th, tw, ign, ign = struct.unpack("4H", fcntl.ioctl(0, tty.TIOCGWINSZ, 'x' * 8))
+
+while not downloaded():
+    txt = "\n".join(wrap(" ".join("""
+ Please sanctify the files, which I cannot automatically download, with your
+ consent to abide by their respective license agreements via your web browser,
+ then hit 'enter' to continue.  You need:
+        """.split()), tw)) + "\n\n" + "\n".join(downloads)
+    webbrowser.open(dlpage)
+    raw_input(txt)
+
+instantclient = j(ordir, "instantclient_11_2")
+
+# # Oracle is for Professional Software Engineers only.  Don't look for any namby-
+# # pamby "user interface" or "working installation process" here!
+for pdest in ["libclntsh.dylib.11.2", "libclntsh.dylib.11.1"]:
+    pdestfull = j(instantclient, pdest)
+    psrcfull = j(instantclient, "libclntsh.dylib")
+    if exists(pdestfull) and not exists(psrcfull):
+        symlink(pdestfull, psrcfull)
+        break
+
+ldestfull = j(instantclient, "lib")
+if not exists(ldestfull):
+    symlink(".", ldestfull)
+
+with open(expanduser("~/.bash_profile"), "a") as f:
+    f.write(dedent(
+        """
+        function oracle_11 () {
+            export ORACLE_HOME="$HOME/.oracle/instantclient_11_2";
+
+            # make sure we can find the client libraries
+            export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ORACLE_HOME";
+            export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$ORACLE_HOME";
+        }
+        """))
+

Added: CalendarServer/trunk/doc/OracleVM/rebuild.sql
===================================================================
--- CalendarServer/trunk/doc/OracleVM/rebuild.sql	                        (rev 0)
+++ CalendarServer/trunk/doc/OracleVM/rebuild.sql	2016-05-20 19:00:33 UTC (rev 15624)
@@ -0,0 +1,54 @@
+
+SET FEEDBACK 1
+SET ECHO OFF
+
+
+Prompt Connecting as SYSTEM to create hr
+Connect system/oracle at localhost:1521/orcl
+
+spool cre_hr.log
+
+
+Prompt Dropping user hr
+DROP USER hr CASCADE;
+
+Prompt Creating user hr
+CREATE USER hr IDENTIFIED BY oracle
+ DEFAULT TABLESPACE users
+ TEMPORARY TABLESPACE temp
+ QUOTA UNLIMITED ON users;
+
+Prompt Setting permissions for user hr
+GRANT create session
+    , create table
+    , create procedure
+    , create sequence
+    , create trigger
+    , create view
+    , create synonym
+    , alter session
+    , create type
+    , create materialized view
+    , query rewrite
+    , create dimension
+    , create any directory
+    , alter user
+    , resumable
+    , ALTER ANY TABLE  -- These
+    , DROP ANY TABLE   -- five are
+    , LOCK ANY TABLE   -- needed
+    , CREATE ANY TABLE -- to use
+    , SELECT ANY TABLE -- DBMS_REDEFINITION
+TO hr;
+
+GRANT select_catalog_role
+    , execute_catalog_role
+TO hr;
+
+Prompt Connecting as user hr
+CONNECT hr/oracle at localhost:1521/orcl
+
+Prompt Installing current_oracle.sql
+ at current_oracle.sql
+
+spool off
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20160520/f353f481/attachment.html>


More information about the calendarserver-changes mailing list