Showing 31 - 40 of 698 Postings (
summary)
Created by Monika Andergassen, last modified by Monika Andergassen 10 Jun 2023, at 02:34 PM
Effective Date: June 10, 2023
This Privacy Policy describes how OpenACS.org collects, uses, and shares your personal data when you use our website, forums, wiki, and other services.
- Data We Collect
- Data You Provide to Us
When you use our Services, you may provide us with data about yourself, such as your name, email address, and any other data you choose to provide. This can occur, for example, when you register for an account, post on our forums, or contribute to our wiki.
- Data We Collect Automatically
We may automatically collect certain data about you when you use our Services, such as your IP address, device information, browser type, and data about your interactions with our Services.
- Cookies and Similar Technologies
We use cookies to collect data about your use of our Services and to remember your login state and preferences. You can control the use of cookies at the individual browser level.
- How We Use Your Data
We use the data we collect to provide, maintain, and improve our Services, to communicate with you, to monitor and analyze usage and trends, and to personalize and improve your experience with our Services.
- How We Share Your Data
We do not sell your personal data. We may share your data with third-party service providers who perform services on our behalf, such as hosting providers and analytics providers. We may also share your data to comply with the law, to protect the rights and safety of our users and third parties, or as part of a business transaction like a merger or sale of assets.
- Your Choices
You may update, correct, or delete your account data at any time by logging into your account. You may also contact us to request access to, correct, or delete any personal data that you have provided to us.
- Security
We take reasonable measures to protect your personal data from loss, theft, misuse, unauthorized access, disclosure, alteration, and destruction. However, the internet is not 100% secure, and we cannot guarantee the security of your data.
- Children's Privacy
Our Services are not intended for individuals under the age of 13. We do not knowingly collect personal data from children under 13. If we become aware that a child under 13 has provided us with personal data, we will take steps to delete such data.
- Changes to This Privacy Policy
We may update this Privacy Policy from time to time. If we make changes, we will notify you by revising the date at the top of the policy and, in some cases, we may provide you with additional notice.
- Contact Us
If you have any questions about this Privacy Policy, please contact us at oct@openacs.org.
Created by Michael Aram, last modified by Vlad V 01 May 2023, at 01:02 PM
Caveat: Page under construction
rl_json
Example Installation for NaviServer under Ubuntu (for rl_json version until 11.5)
cd /var/tmp
git clone https://github.com/RubyLane/rl_json.git
cd rl_json
autoconf
./configure --prefix=/usr/local/ns && make && sudo make install
After rl_json version 11.5 (see issue):
git clone --recurse-submodules --depth 1 --branch 0.12.2 https://github.com/RubyLane/rl_json.git rl_json-0.12.2
cd rl_json-0.12.2
autoconf
./configure
./make
./make install
Created by Malte Sussdorff, last modified by Gustaf Neumann 06 Feb 2023, at 04:48 PM
Current documentation for ACS Mail Lite, the standard API for inbound and outbound email is at https://openacs.org/doc/acs-mail-lite/.
Recommendation
The current recommendation for sending outgoing mail is via the NaviServer module nssmtpd, since this handles well large outgoing mails and works as well with >1000 file descriptors open. In OpenACS 5.10, set the package parameter "EmailDeliveryMode" in the acs-mail-lite package to "nssmtpd".
Older Discussion
Outgoing E-Mail at the moment in acs-mail-lite is split in a multitude of procedures, some doubling the efforts of the other. To clean this up, I propose the following (in general):
- Replace acs-mail-lite::send with acs-mail-lite::complex_send, making it a wrapper for complex_send or the other way round (rename complex_send to send and so on).
- Only support sending of e-mails via SMTP. Use smtp::sendmessage from TCLLIB for it (as does complex_send).
- Daveb suggested splitting up complex_send to make it easier to test parts of it. Here are some ideas:
- Sub procedure to generate "to/cc/bcc/_lists" which are used in the respective TO/CC/BCC header. This will also clean up the sending of individual emails.
- Have only one call to smtp::sendmessage and one hook for the complex_send callback.
- Sub-procedure to append file tokens. Not sure if this is useful as we need to do upvar for the tokens and could not do automated tests on them anyway. So I'd not do it.
- Have only one sweeper (the complex_sweeper) with support for multiple mail sending servers (so you can have multiple mail senders in the cluster instead of only one).
- Split of incoming email handing into a separate file
- Delete acs-mail-lite-procs.tcl :-). Just kidding, but deprecate most of the procedures.
Sadly, it is not a straightforward approach, as there is a catch. Using smtp::sendmessage forces us to figure out a new way for setting the bounce-email address header, as the old approach will not work any more (using the SMTP command "FROM" set to the bounce address). Another option is to use the non-standard "Errors-To" Header instead.
Created by Gustaf Neumann, last modified by Gustaf Neumann 02 Nov 2022, at 06:06 PM
Many users tend to click twice on links/and forms, causing therefore multiple identical requests, that can kill the performance of a server, especially when these are expensive requests. On one site, we saw users firing up to several hundred identical requests, probably via a “rapid fire” function available for some mice, coming from the gaming world.
There are essentially two generic ways to handle double clicks in OpenACS:
- Server-side double click handling: The xotcl-request-monitor has since a long time the feature to block (optionally) multiple identical requests from the same client. The user will receive for subsequent identical requests the message “Repeated Operation, please resubmit”, which as some “educative” value. It has several heuristics built in to allow certain double requests (e.g., for embedded resources).
- Client-side double click handling: Via HTML markup, one can disable the same requests for a certain time on the client side (i.e., in the browser). For this time, double-clicks are blocked (the button/link is disabled), such that the true double-click, or “rapid fire” functions are mitigated. The request is only one time executed. Potential problems are potential confusion, when a user wants to open the same page in rapid sequence in multiple tabs, windows. Furthermore, repeated requests from bots are not mitigated. This is a new feature which will part of the OpenACS 5.10.1 release.
The client-side double click handling is activated by a content developer for a link prone to this concern by adding the CSS class “prevent-double-click” to the HTML anchor or button. The double click prevention deactivates a button or an anchor element after clicking for a short time (per default for 2s) and ignores in this time window further clicks. The default time window can be specified via the package parameter DefaultPreventDoubleClickTimeoutMs of acs-templating. The time window can be specified for every occurrence via the data element “oacs-timeout”. When a double click occurs, the duplicate click is determined at the client side (in the browser) such that the first request will continue to run and will render its result when finished. Without double click prevention (or with the double click-prevention on the server side), the results of the first request are lost for the client, although these are still computed at the server side.
Usage Example:
<p>text with a <a class="prevent-double-click" href="/slow.tcl?t=10s">link</a>
<p>
<form action="/slow.tcl">
<input class="btn prevent-double-click" data-oacs-timeout="4000" type="submit" value="Submit">
...
</form>
Created by roc@, last modified by Gustaf Neumann 27 Oct 2022, at 10:32 AM
These instructions describe, how to obtain OpenACS, either as a released distribution (a .tar.gz file) or from CVS.
Obtain a released version of OpenACS via .tar file:
Download from OpenACS.org: //projects/openacs/download/?versions=all
Unpack the OpenACS tarball. Usually something like this works:
tar zxvf openacs-5.10.0.tgz
Obtain OpenACS from CVS (a certain release with potential patches, or the HEAD version):
If you want to track fresh code developments between releases, or you are an OpenACS core developer, you may want to install from CVS. This is identical to downloading a distribution, except that you get the files from CVS instead of the tarball. The following commands are used to obtain the newest version of the OpenACS 5.10 branch from CVS:
cvs -d:pserver:anonymous@cvs.openacs.org:/cvsroot login
# press enter for password
cvs -d:pserver:anonymous@cvs.openacs.org:/cvsroot checkout -r oacs-5-10 acs-core
The command above checks out the core packages of OpenACS in a directory named openacs-4. For the entire OpenACS version 5.10 branch, you can use the following commands (adjust as required going forward):
cvs -d:pserver:anonymous@cvs.openacs.org:/cvsroot checkout -r oacs-5-10 openacs-4
If the branch name (like oacs-5-10) is omitted, the leading edge developer version (the HEAD release) is obtained
cvs -d:pserver:anonymous@cvs.openacs.org:/cvsroot checkout openacs-4
In order to check out a single package (e.g. the package cronjob) from e.g. the leading edge developer version (HEAD), use
cvs -d:pserver:anonymous@cvs.openacs.org:/cvsroot checkout openacs-4/packages/cronjob
For most OpenACS packages, CVS aliases are defined. In order to check out e.g. the forums package from OpenACS 5.10, just use:
cvs -d:pserver:anonymous@cvs.openacs.org:/cvsroot checkout -r oacs-5-10 forums
Depending, from which directory you are performing the checkout, you might have to move the checked-out package directory to the main "packages" directory of your installation.
More info here: https://openacs.org/test-doc/using-cvs-with-openacs
Looking for README instructions or installers? View the OpenACS Installation instructions: en:openacs-system-install, otherwise continue by setting up the OpenACS distribution:
Set up the file system for one or more OpenACS sites
According to the Linux Filesystem Hierarchy Standard is currently not strict, where the files of web servers should be stored. Common places are /var/www/ or /srv/www/. Sticking to common names eases the maintenance of systems. This name is called SERVERROOT belwo. In case, multiple OpenACS installations are on a single system, it is recommended to use e.g. domain name of the system as a path, like e.g. /var/www/openacs.org/. We use here the conventions to name the installation based on the version number /var/www/oacs-5-10/. This folder is called OPENACS_SERVICE_NAME. All the files in each OpenACS site are stored in a subdirectory (see also: en:openacs-reference-platform). The first time you install an OpenACS site on a server, you must create the parent directory and set its permissions:
While logged in as root:
mkdir -p /var/www/oacs-5-10
chgrp web /var/www/oacs-5-10
chmod 770 /var/www/oacs-5-10
Move the uncompressed code to SERVERROOT and rename the directory to $OPENACS_SERVICE_NAME:
mv openacs-4 /var/www/oacs-5-10/$OPENACS_SERVICE_NAME
Created by Rocael Hernández Rizzardini, last modified by Gustaf Neumann 28 Sep 2022, at 11:32 AM
- Use namespace
Define your procs with a namespace like mypackage::foo_proc. Here is a discussion about [this]. Check many examples in the code, example:
namespace eval auth {}
ad_proc -public auth::require_login {
{-level ok}
{-account_status ok}
} {
doc...
@return something
@see ad_script_abort
} {
... proc body
}
- Use procs safely and their safer variations to help keep code robust and avoid security issues.
Particularly in cases, where user_input is processed, be sure to avoid executing unwanted code. Use the Tcl expand operator {*} instead of eval. Use
{*}$cmd
instead of
eval $cmd
For legacy code, you might use util::safe_eval instead of eval in such cases; subst_safe precedes meta characters with backslashes.
- Use named parameters whenever possible
Define named parameters on your procs such that parameters will not be mixed up if somebody makes a mistake on passing the order of parameters. Also, this makes the proc easier to add additional parameters in the future if needed.
Use:
ad_proc proc_name { {-parent_id pid} {-child_id cid} } ...
and not
ad_proc proc_name {pid cid} ...
This way, developers will need to call proc stating explicitly which parameter are passed. This is especially useful when some parameters are optional.
Also, when calling a proc in your Tcl script, it is recommended to write one parameter per line like this:
set my_var [proc_name \
-parent_id $pid \
-child_id $cid]
Rather than:
set my_var [proc_name -parent_id $pid -child_id cid]
Again, this helps to make the code more clean and readable.
- Use ad_proc to define your Tcl procs
Make use of ad_proc. And make use of the self documentation facility of ad_proc.
ad_proc foo {}
Use this area to document
}
# .... your implementation of proc foo
}
This way, the API browser will pick up your documentation automatically. Is encouraged to use automatic api-doc documentation that ad_provides, such as: @author, @return, @see
-
Use "ad_proc -private ..." always when a proc is used only in one package
This reduces the size of the public API and improves the flexibility of the package maintainers.
-
Use "ad_proc -deprecate ..." when removing definitions from the public API
When deprecated code is called, the error.log of the site will show its usage. This way, a site maintainer can update with code with the new replacement call.
Don't move deprecated calls immediately to the long-range backward compatibility procs (tcl/deprecated-procs.tc). When OpenACS is configured to omit loading of long deprecated code (WithDeprecatedCode set to 0) these files are not loaded to reduce the every growing blueprint bloat. Therefore, these files should only contain code, which was deprecated at LEAST ONE RELEASE EARLIER, such that site admins have one release time to fix calls to deprecated code.
- Avoid using "upvar"
Try to avoid using "upvar". If needed, pass in a parameter that specifies the "upvar" name. This way, the one using your proc has the option to name his/her variable. Example:
ad_proc upvaring {-upvar_name:required} {
upvar $upvar_name local_var
}
-
Use modern Tcl idioms
Do not use "==" in comparing strings. Using "if {$string == "foo"}" tries to make a numeric comparison first. Instead, make use of "if {"foo" eq $string}" or if you need the negation "if {"foo" ne $string}".
Do not use "if {[lsearch -exact $list $element] > -1}", but use "if {$element in $list}" instead, or "if {$element ni $list}" in case a "not in" test is required.
-
Always "return" at the end of your proc
And if you have to return more than one variable, use associative arrays, which can be extended by additional fields without breaking code
So instead of this:
ad_proc ... {
.....
return [list $creation_status $creation_message ...]
}
use key/value pairs or Tcl arrays to group related information:
ad_proc ... {
array set creation_info {
creation_status {}
creation_message {}
element_messages {}
account_status {}
account_message {}
}
.....
return [array get creation_info]
}
- ... or even better: use Tcl dicts
ad_proc proc ... {} {
set creation_info [dict create \
creation_status {} \
creation_message {} \
element_messages {} \
account_status {} \
account_message {} ]
....
return $creation_info
}
- Read the Tcl Style guide
This is the Tcl style guide (PDF), try to apply relevant guidelines. In particular chapter 4,5 and 7
Created by Gustaf Neumann Vlad V, last modified by Vlad V 22 Sep 2022, at 11:20 PM
Basic installation
A quick way to install and test-drive OpenACS is via docker. The s6 docker images were developed by Vlad and use the docker overlay structures as supported by docker-compose, which is a tool for defining and running multi-container Docker applications.
The minimal setup for testing is to get the repository
git clone https://github.com/oupfiz5/openacs-s6
cd openacs-s6/src
and to run it there, e.g.
docker compose up
This command installs OpenACS (oacs-5-10) from GitHub, PostgreSQL (14.1) and NaviServer 4.99.23 and starts the server on port 8080. We are planning to merge and probably move this repository to the OpenACS project on GitHub.
More advanced installations
In some cases, a developer might need more control over versions used, running multiple different OpenACS versions and instances in parallel, etc. Docker allows composing newly configured setups more or less on the fly via specifying more command line options, or via .env files. Such a setup can be provided by creating the docker-compose setup on a common place on the machine and by creating multiple .env files.
git clone https://github.com/oupfiz5/openacs-s6 /var/www/openacs/docker-s6
cd /var/www/openacs/docker-s6/src
Create in this directory e.g. a file named oacs1.env with the following content:
# * Define port and project name
COMPOSE_PROJECT_NAME="${COMPOSE_PROJECT_NAME:-oacs-8071}"
# * Using potentially different compose files
COMPOSE_FILE="${COMPOSE_FILE:-docker-compose.yaml}"
# * Common
TZ="${TZ:-UTC}"
# * Postgres
PGDATABASE="${PGDATABASE:-openacs}"
PGHOST="${PGHOST:-postgres}"
PGPASSWORD="${PGPASSWORD:-testing}"
PGPORT="${PGPORT:-5432}"
PGUSER="${PGUSER:-openacs}"
POSTGRES_DB="${PGDATABASE}"
POSTGRES_PASSWORD="${PGPASSWORD}"
POSTGRES_REPOSITORY="postgres"
POSTGRES_TAG="14.1-alpine"
POSTGRES_USER="${PGUSER}"
# * OpenACS
NS_CONF="${NS_CONF:-/usr/local/ns/conf/openacs-config.tcl}"
OACS_REPOSITORY="${OACS_REPOSITORY:-oupfiz5}"
OACS_IMAGE_NAME="${OACS_IMAGE_NAME:-openacs-s6}"
OACS_IMAGE_TAG="${OACS_IMAGE_TAG:-v3-oacs-5-10}"
OACS_LISTEN_PORT="${OACS_LISTEN_PORT:-8071}"
oacs_httpport='8000'
oacs_db_user="${PGUSER}"
oacs_db_passwod="${PGPASSWORD}"
oacs_db_name="${PGDATABASE}"
oacs_db_host="${PGHOST}"
oacs_db_port="${PGPORT}"
oacs_ipaddress='0.0.0.0'
Important variables are the listen port (OACS_LISTEN_PORT), the project name (COMPOSE_PROJECT_NAME) for running multiple instances at the same time without conflicting. In order to install other versions than the default (v3-oacs-5-10), the variable OACS_TAG can be used. See for more details the README file on GitHub (openacs-s6). For multiple instances, multiple such .env-files can be created.
To use an .env file oacs1.env one can run it as follows
(cd /var/www/openacs/docker-s6/src; docker compose up --env-file oacs1.env)
or run it in daemon mode by adding a “-d” after up.
Preliminaries
To use this setup, recent versions of docker and docker-compose are needed. There is a constant development, especially on docker-compose. The setup is tested with docker-compose 1.27 (as provided by macPorts on macOS) and with docker compose v2.10.2 under Linux. For docker compose under Linux, it is usually sufficient to get the binary (single file) from the docker download pages.
https://docs.docker.com/
https://docs.docker.com/compose/
Created by OpenACS community, last modified by Gustaf Neumann 26 Jun 2022, at 04:43 PM
Installing Oracle is optional, if you are installing PostgreSQL.
If you are using new versions of the oacs-5-10 branch of OpenACS 5.10.1, read oacs-5-10-on-oracle-19c for the installation of Oracle 19c and the improved support in the oacs-core packages. The description below is for earlier versions.
An excellent guide for installing Oracle 10g on Linux can be found at www.puschitz.com.
OpenACS 5.2.x will install with Oracle 9i but has not been extensively tested so may still have bugs or tuning issues.
This installation guide attempts to present all of the information necessary to complete an OpenACS installation. We try hard to make all of the steps possible in one pass, rather than having a step which amounts to "go away and develop a profound understanding of software X and then come back and, in 99% of all cases, type these two lines." The exception to our rule is Oracle production systems. This page describes a set of steps to get a working Oracle development server, but it is unsuitable for production systems. If you will be using OpenACS on Oracle in a production environment, you will experience many problems unless you develop a basic understanding of Oracle which is outside the scope of this document.
This document assumes that you are installing Oracle on the same box as AOLserver. For more details on a remote Oracle installation, see Daryl Biberdorf's document.
Defaults
We use the following defaults while installing Oracle.
| Variable |
Value |
Reason |
| ORACLE_HOME |
/ora8/m01/app/oracle/product/8.1.7 |
This is the default Oracle installation directory. |
| ORACLE_SERVICE |
ora8 |
The service name is a domain-qualified identifier for your Oracle server. |
| ORACLE_SID |
ora8 |
This is an identifier for your Oracle server. |
| ORACLE_OWNER |
oracle |
The user who owns all of the oracle files. |
| ORACLE_GROUP |
dba |
The special oracle group. Users in the dba group are authorized to do a connect internal within svrmgrl to gain full system access to the Oracle system. |
Get Oracle
You can register and download Oracle (for free) from Oracle Downloads. You need this if you want to use an Oracle database.
Production Oracle systems should run on certified platforms. Follow the metalink note 223718.1to find certified platforms. If you don't have metalink access, take a look at the Oracle on Linux FAQ: http://www.oracle.com/us/technologies/027617.pdf. In summary, free and inexpensive Linux distributions are not certified.
If you don't have an account at OTN get one: you can download the Oracle software from the Oracle Downloads page.
Each Oracle release comes with extensive and usually quite well-written documentation. Your first step should be to thoroughly read the release notes for your operating system and your Oracle version. Find the docs here:
It is generally useful to run a particular Oracle version with its latest patch-set. At the time of writing these were 8.1.7.4 and 9.2.0.5, both of which are considered to be very stable.
To be able to download a patch-set, you need an account on Metalink (not free). You may find the appropriate patch-set by following Andrew's suggestion.
Things to Keep in Mind
Oracle is very well-documented software, the online documentation comes with printable PDFs and full-text search. Altogether there is more than 20.000 pages of documentation, so do not expect to understand Oracle within in a few hours. The best starting pointing into Oracle is the Concepts book. Here's the 8i version and the 9.2 version.
To give you an idea of how configurable Oracle is and how much thought you may need to put into buying the proper hardware and creating a sane setup, you should thoroughly read Cary Millsap's Configuring Oracle Server for VLDB and the Optimal Flexible Architecture standard.
Throughout these instructions, we will refer to a number of configurable settings and advise certain defaults. With the exception of passwords, we advise you to follow these defaults unless you know what you are doing. Subsequent documents will expect that you used the defaults, so a change made here will necessitate further changes later. For a guide to the defaults, please see the section called “Defaults”.
In order for OpenACS to work properly you need to set the environment appropriately.
export ORACLE_BASE=/ora8/m01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/8.1.7
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=ora8
export ORACLE_TERM=vt100
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
umask 022
open_cursors = 500
nls_date_format = "YYYY-MM-DD"
For additional resources/documentation, please see this thread and Andrew Piskorski's mini-guide.
Pre-Installation Tasks
Though Oracle 8.1.7 has an automated installer, we still need to perform several manual, administrative tasks before we can launch it. You must perform all of these steps as the root user. We recommend entering the X window system as a normal user and then doing a su -. This command gives you full root access.
-
Login as a non-root user and start X by typing startx
[joeuser ~]$ startx
-
Open a terminal window type and login as root
[joeuser ~]$ su -
Password: ***********
[root ~]#
-
Create and setup the oracle group and oracle account
We need to create a user oracle, which is used to install the product, as well as starting and stopping the database.
[root ~]# groupadd dba
[root ~]# groupadd oinstall
[root ~]# groupadd oracle
[root ~]# useradd -g dba -G oinstall,oracle -m oracle
[root ~]# passwd oracle
You will be prompted for the New Password and Confirmation of that password.
-
Setup the installation location for Oracle. While Oracle can reside in a variety of places in the file system, OpenACS has adopted /ora8 as the base directory.
Note: the Oracle install needs about 1 GB free on /ora8 to install successfully.
[root ~]# mkdir /ora8
root:/ora8# cd /ora8
root:/ora8# mkdir -p m01 m02 m03/oradata/ora8
root:/ora8# chown -R oracle.dba /ora8
root:/ora8# exit
-
Set up the oracle user's environment
-
Log in as the user oracle by typing the following:
[joeuser ~]$ su - oracle
Password: ********
-
Use a text editor to edit the .bash_profile file in the oracle account home directory.
[oracle ~]$ emacs .bash_profile
You may get this error trying to start emacs:
Xlib: connection to ":0.0" refused by server
Xlib: Client is not authorized to connect to Server
emacs: Cannot connect to X server :0.
Check the DISPLAY environment variable or use `-d'.
Also use the `xhost' program to verify that it is set to permit
connections from your machine.
If so, open a new terminal window and do the following:
[joeuser ~]$ xhost +localhost
Now, back in the oracle terminal:
[oracle ~]$ export DISPLAY=localhost:0.0
[oracle ~]$ emacs .bash_profile
Try this procedure anytime you get an Xlib connection refused error.
-
Add the following lines (substituting your Oracle version number as needed) to .bash_profile:
export ORACLE_BASE=/ora8/m01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/8.1.7
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=ora8
export ORACLE_TERM=vt100
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
umask 022
Save the file by typing CTRL-X CTRL-S and then exit by typing CTRL-X CTRL-C. Alternatively, use the menus.
Make sure that you do not add any lines like the following
# NLS_LANG=american
# export NLS_LANG
These lines will change the Oracle date settings and will break OpenACS since OpenACS depends on the ANSI date format, YYYY-MM-DD dates.
-
Log out as oracle
[oracle ~]$ exit
-
Log back in as oracle and double check that your environment variables are as intended. The env command lists all of the variables that are set in your environment, and grep shows you just the lines you want (those with ORA in it).
[joeuser ~]$ su - oracle
[oracle ~]$ env | grep ORA
If it worked, you should see:
ORACLE_SID=ora8
ORACLE_BASE=/ora8/m01/app/oracle
ORACLE_TERM=vt100
ORACLE_HOME=/ora8/m01/app/oracle/product/8.1.7
ORA_NLS33=/ora8/m01/app/oracle/product/8.1.7/ocommon/nls/admin/data
If not, try adding the files to ~/.bashrc instead of .bash_profile. Then logout and log back in again. Also, be certain you are doing su - oracle and not just su oracle. The - means that .bashrc and .bash_profile will be evaluated.
Make sure that /bin, /usr/bin, and /usr/local/bin are in your path by typing:
[oracle ~]$ echo $PATH
/bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin:/home/oracle/bin:/ora8/m01/app/oracle/product/8.1.7/bin
If they are not, then add them to the .bash_profile by changing the PATH statement above to PATH=$PATH:/usr/local/bin:$ORACLE_HOME/bin
Installing Oracle 8.1.7 Server
-
Log in as oracle and start X if not already running. Start a new terminal:
[joeuser ~]$ xhost +localhost
[joeuser ~]$ su - oracle
Password: **********
[oracle ~]$ export DISPLAY=localhost:0.0
-
Find the runInstaller script
-
If you are installing Oracle from a CD-ROM, it is located in the install/linux path from the cd-rom mount point
[oracle ~]$ su - root
[root ~]# mount -t iso9660 /dev/cdrom /mnt/cdrom
[root ~]# exit
[oracle ~]$ cd /mnt/cdrom
-
If you are installing from the tarball, the install script is located in the Oracle8iR2 directory that was created when you expanded the archive.
[oracle ~]$ cd /where/oracle/Disk1
Check to make sure the file is there.
oracle:/where/oracle/Disk1$ ls
doc index.htm install runInstaller stage starterdb
If you don't see runInstaller, you are in the wrong directory.
-
Run the installer
oracle:/where/oracle/Disk1$ ./runInstaller
A window will open that welcomes you to the 'Oracle Universal Installer' (OUI). Click on "Next"
Note
Some people have had trouble with this step on RedHat 7.3 and 8.0. If so, try the following steps before calling ./runInstaller:
-
Execute the following command: /usr/i386-glibc21-linux/bin/i386-glibc21-linux-env.sh
-
Type export LD_ASSUME_KERNEL=2.2.5
-
The "File Locations" screen in the OUI:
-
"Source" path should have been prefilled with "(wherever you mounted the CDROM)/stage/products.jar"
-
"destination" path says "/ora8/m01/app/oracle/product/8.1.7"
If the destination is not correct it is because your environment variables are not set properly. Make sure you logged on as oracle using su - oracle. If so, edit the ~/.bash_profile as you did in the section called “Pre-Installation Tasks”
-
Click "Next" (a pop up window will display Loading Product information).
-
The "Unix Group Name" screen in the OUI:
-
The Unix Group name needs to be set to 'oinstall' ( we made this Unix group earlier ).
-
Click "Next"
-
A popup window appears instantly, requesting you to run a script as root:
-
-
Open a new terminal window, then type:
[joeuser ~]$ su -
[root ~]# cd /ora8/m01/app/oracle/product/8.1.7
[root ~]# ./orainstRoot.sh
; You should see:
Creating Oracle Inventory pointer file (/etc/oraInst.loc)
Changing groupname of /ora8/m01/app/oracle/oraInventory to oinstall.
[root ~]# mkdir -p /usr/local/java
[root ~]# exit
[joeuser ~]$ exit
-
Click "Retry"
-
The "Available Products" screen in the OUI:
-
The "Installation Types" screen
-
The "Available Product Components" screen
-
In addition to the defaults, make sure that "Oracle SQLJ 8.1.7.0," "Oracle Protocol Support 8.1.7.0.0," and "Linux Documentation 8.1.7.0.0" are also checked.
-
Click "Next"
-
A progress bar will appear for about 1 minute.
-
The "Component Locations" screen in the OUI
-
The "Privileged Operation System Groups" screen in the OUI
-
Enter "dba" for "Database Administrator (OSDBA) Group"
-
Enter "dba" for the "Database Operator (OSOPER) Group"
-
Click "Next"
-
A progress bar will appear for about 1 minute.
-
The "Authentication Methods" screen
-
The next screen is "Choose JDK home directory"
-
The "Create a Database" screen in the OUI
-
The next screen is "Oracle Product Support"
-
The "Summary" screen in the OUI
-
Check the "Space Requirements" section to verify you have enough disk space for the install.
-
Check that "(144 products)" is in the "New Installations" section title.
-
Click "Install"
-
A progress bar will appear for about 20 - 30 minutes. Now is a good time to take a break.
-
A "Setup Privileges" window will popup towards the end of the installation asking you to run a script as root
-
Run the script. Switch to the oracle user first to set the environment appropriately and then do su to get root privileges, while keeping the oracle user's environment.
[joeuser ~]$ su - oracle
Password: *********
[oracle ~]$ su
Password: *********
[root ~]# /ora8/m01/app/oracle/product/8.1.7/root.sh
; You should see the following.
Creating Oracle Inventory pointer file (/etc/oraInst.loc)
Changing groupname of /ora8/m01/app/oracle/oraInventory to oinstall.
# /ora8/m01/app/oracle/product/8.1.7/root.sh
Running Oracle8 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /ora8/m01/app/oracle/product/8.1.7
ORACLE_SID= ora8
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Press ENTER here to accept default of /usr/local/bin
Creating /etc/oratab file...
Entry will be added to the /etc/oratab file by
Database Configuration Assistants when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
IMPORTANT NOTE: Please delete any log and trace files previously
created by the Oracle Enterprise Manager Intelligent
Agent. These files may be found in the directories
you use for storing other Net8 log and trace files.
If such files exist, the OEM IA may not restart.
-
Do not follow the instructions on deleting trace and log files, it is not necessary.
[root ~]# exit
[joeuser ~]$ exit
-
Go back to the pop-up window and click "OK"
-
The "Configuration Tools" screen in the OUI
-
The "Welcome" screen in the "net 8 Configuration Assistant"
-
The "Listener Configuration, Listener Name" screen in the "Net 8 Configuration Assistant"
-
The "Listener Configuration, Select Protocols" screen in the "Net 8 Configuration Assistant"
-
The "Listener Configuration TCP/IP Protocol" screen in the "Net 8 Configuration Assistant"
-
The "Listener Configuration, More Listeners" screen in the "Net 8 Configuration Assistant"
-
The "Listener Configuration Done" screen in the "Net 8 Configuration Assistant"
-
The "Naming Methods Configuration" screen in the "Net 8 Configuration Assistant"
-
The "Done" screen in the "Net 8 Configuration Assistant"
-
The "End of Installation" screen in the OUI
Congratulations, you have just installed Oracle 8.1.7 Server! However, you still need to create a database which can take about an hour of non-interactive time, so don't quit yet.
Creating the First Database
This step will take you through the steps of creating a customized database. Be warned that this process takes about an hour on a Pentium II with 128 MB of RAM.
Note
RedHat 7.3 and 8.0 users: Before running dbassist, do the following.
-
Download the glibc patch from Oracle Technet into /var/tmp.
-
cd $ORACLE_HOME
-
tar xzf /var/tmp/glibc2.1.3-stubs.tgz
-
./setup_stubs
-
Make sure you are running X. Open up a terminal and su to oracle and then run the dbassist program.
[joeuser ~]$ xhost +localhost
[joeuser ~]$ su - oracle
Password: *********
[oracle ~]$ export DISPLAY=localhost:0.0
[oracle ~]$ dbassist
-
The "Welcome" screen in the Oracle Database Configuration Agent (ODCA)
-
The "Select database type" screen in the ODCA
-
Select "Custom"
-
Click "Next"
-
The "Primary Database Type" window in ODCA
-
Select "Multipurpose"
-
Click "Next"
-
The "concurrent users" screen of the ODCA
-
Select "Dedicated Server Mode", click "Next"
-
Accept all of the options, and click Next Oracle Visual Information Retrieval may be grayed out. If so, you can ignore it; just make sure that everything else is checked.
-
For "Global Database Name", enter "ora8"; for "SID", also enter "ora8" (it should do this automatically). Click "Change Character Set and select UTF8. Click "Next".
-
Accept the defaults for the next screen (control file location). Click "Next"
-
Go to the "temporary" and "rollback" tabs, and change the Size (upper-right text box) to 150MB. Click "Next"
-
Increase the redo log sizes to 10000K each. Click "Next"
-
Use the default checkpoint interval & timeout. Click "Next"
-
Increase "Processes" to 100; "Block Size" to 4096 (better for small Linux boxes; use 8192 for a big Solaris machine).
-
Accept the defaults for the Trace File Directory. Click "Next"
-
Finally, select "Save information to a shell script" and click "Finish" (We're going to examine the contents of this file before creating our database.)
-
Click the "Save" button. Oracle will automatically save it to the correct directory and with the correct file name. This will likely be /ora8/m01/app/oracle/product/8.1.7/assistants/dbca/jlib/sqlora8.sh
-
It will alert you that the script has been saved successfully.
-
Now we need to customize the database configuration a bit. While still logged on as oracle, edit the database initialization script (run when the db loads). The scripts are kept in $ORACLE_HOME/dbs and the name of the script is usually initSID.ora where SID is the SID of your database. Assuming your $ORACLE_HOME matches our default of /ora8/m01/app/oracle/product/8.1.7, the following will open the file for editing.
[oracle ~]$ emacs /ora8/m01/app/oracle/product/8.1.7/dbs/initora8.ora
-
Add the following line to the end:
nls_date_format = "YYYY-MM-DD"
-
Now find the open_cursors line in the file. If you're using emacs scroll up to the top of the buffer and do CTRL-S and type open_cursors to find the line. The default is 100. Change it to 500.
open_cursors = 500
-
Save the file. In emacs, do CTRL-X CTRL-S to save followed by CTRL-X CTRL-C to exit or use the menu.
-
At this point, you are ready to initiate database creation. We recommend shutting down X to free up some RAM unless you have 256 MB of RAM or more. You can do this quickly by doing a CRTL-ALT-BACKSPACE, but make sure you have saved any files you were editing. You should now be returned to a text shell prompt. If you get sent to a graphical login screen instead, switch to a virtual console by doing CRTL-ALT-F1. Then login as oracle.
-
Change to the directory where the database creation script is and run it:
[oracle ~]$ cd /ora8/m01/app/oracle/product/8.1.7/assistants/dbca/jlib
oracle:/ora8/m01/app/oracle/product/8.1.7/assistants/dbca/jlib$ ./sqlora8.sh
In some instances, Oracle will save the file to /ora8/m01/app/oracle/product/8.1.7/assistants/dbca Try running the script there if your first attempt does not succeed.
-
Your database will now be built. It will take > 1 hour - no fooling. You will see lots of errors scroll by (like: "ORA-01432: public synonym to be dropped does not exist") Fear not, this is normal.
Eventually, you'll be returned to your shell prompt. In the meantime, relax, you've earned it.
Acceptance Test
For this step, open up a terminal and su to oracle as usual. You should be running X and Netscape (or other web browser) for this phase.
-
You need to download the "Oracle Acceptance Test" file. It's available here and at http://philip.greenspun.com/wtr/oracle/acceptance-sql.txt. Save the file to /var/tmp
-
In the oracle shell, copy the file.
[oracle ~]$ cp /var/tmp/acceptance-sql.txt /var/tmp/acceptance.sql
-
Once you've got the acceptance test file all set, stay in your term and type the following:
[oracle ~]$ sqlplus system/manager
SQL*Plus should startup. If you get an ORA-01034: Oracle not Available error, it is because your Oracle instance is not running. You can manually start it as the oracle user.
[oracle ~]$ svrmgrl
SVRMGR> connect internal
SVRMGR> startup
-
Now that you're into SQL*Plus, change the default passwords for system, sys, and ctxsys to "alexisahunk" (or to something you'll remember):
SQL> alter user system identified by alexisahunk;
SQL> alter user sys identified by alexisahunk;
SQL> alter user ctxsys identified by alexisahunk;
-
Verify that your date settings are correct.
SQL> select sysdate from dual;
If you don't see a date that fits the format YYYY-MM-DD, please read the section called “Troubleshooting Oracle Dates”.
-
At this point we are going to hammer your database with an intense acceptance test. This usually takes around 30 minutes.
SQL> @ /var/tmp/acceptance.sql
; A bunch of lines will scroll by. You'll know if the test worked if
; you see this at the end:
SYSDATE
----------
2000-06-10
SQL>
Many people encounter an error regarding maximum key length:
ERROR at line 1:
ORA-01450: maximum key length (758) exceeded
This error occurs if your database block size is wrong and is usually suffered by people trying to load OpenACS into a pre-existing database. Unfortunately, the only solution is to create a new database with a block size of at least 4096. For instructions on how to do this, see the section called “Creating the First Database” above. You can set the parameter using the dbassist program or by setting the DB_BLOCK_SIZE parameter in your database's creation script.
If there were no errors, then consider yourself fortunate. Your Oracle installation is working.
Automating Startup & Shutdown
You will want to automate the database startup and shutdown process. It's probably best to have Oracle spring to life when you boot up your machine.
-
Oracle includes a script called dbstart that can be used to automatically start the database. Unfortunately, the script shipped in the Linux distribution does not work out of the box. The fix is simple. Follow these directions to apply it. First, save dbstart to /var/tmp. Then, as oracle, do the following:
[oracle ~]$ cp /var/tmp/dbstart.txt /ora8/m01/app/oracle/product/8.1.7/bin/dbstart
[oracle ~]$ chmod 755 /ora8/m01/app/oracle/product/8.1.7/bin/dbstart
-
While you're logged in as oracle, you should configure the oratab file to load your database at start. Edit the file /etc/oratab:
-
You will see this line.
ora8:/ora8/m01/app/oracle/product/8.1.7:N
By the way, if you changed the service name or have multiple databases, the format of this file is:
service_name:$ORACLE_HOME:Y || N (for autoload)
-
Change the last letter from "N" to "Y". This tells Oracle that you want the database to start when the machine boots. It should look like this.
ora8:/ora8/m01/app/oracle/product/8.1.7:Y
-
Save the file & quit the terminal.
-
You need a script to automate startup and shutdown. Save oracle8i.txt in /var/tmp. Then login as root and install the script. (Debian users: substitute /etc/init.d for /etc/rc.d/init.d throughout this section)
[oracle ~]$ su -
[root ~]# cp /var/tmp/oracle8i.txt /etc/rc.d/init.d/oracle8i
[root ~]# chown root.root /etc/rc.d/init.d/oracle8i
[root ~]# chmod 755 /etc/rc.d/init.d/oracle8i
-
Test the script by typing the following commands and checking the output. (Debian Users: as root, do mkdir /var/lock/subsys first)
[root ~]# /etc/rc.d/init.d/oracle8i stop
Oracle 8i auto start/stop
Shutting Oracle8i:
Oracle Server Manager Release 3.1.7.0.0 - Production
Copyright (c) 1997, 1999, Oracle Corporation. All
Rights Reserved.
Oracle8i Enterprise Edition Release 8.1.7.0.1 -
Production
With the Partitioning option
JServer Release 8.1.7.0.1 - Production
SVRMGR> Connected.
SVRMGR> Database closed.
Database dismounted.
ORACLE instance shut down.
SVRMGR>
Server Manager complete.
Database "ora8" shut down.
[root ~]# /etc/rc.d/init.d/oracle8i start
Oracle 8i auto start/stop
Starting Oracle8i:
SQL*Plus: Release 8.1.7.0.0 - Production on Wed Mar 6 17:56:02 2002
(c) Copyright 2000 Oracle Corporation. All rights reserved.
SQL> Connected to an idle instance.
SQL> ORACLE instance started.
Total System Global Area 84713632 bytes
Fixed Size 73888 bytes
Variable Size 76079104 bytes
Database Buffers 8388608 bytes
Redo Buffers 172032 bytes
Database mounted.
Database opened.
SQL> Disconnected
Database "ora8" warm started.
Database "ora8" warm started.
-
If it worked, then run these commands to make the startup and shutdown automatic.
-
Red Hat users:
[root ~]# cd /etc/rc.d/init.d/
[root ~]# chkconfig --add oracle8i
[root ~]# chkconfig --list oracle8i
; You should see:
oracle8i 0:off 1:off 2:off 3:on 4:on 5:on 6:off
-
Debian users:
[root ~]# update-rc.d oracle8i defaults
Adding system startup for /etc/init.d/oracle8i ...
/etc/rc0.d/K20oracle8i -> ../init.d/oracle8i
/etc/rc1.d/K20oracle8i -> ../init.d/oracle8i
/etc/rc6.d/K20oracle8i -> ../init.d/oracle8i
/etc/rc2.d/S20oracle8i -> ../init.d/oracle8i
/etc/rc3.d/S20oracle8i -> ../init.d/oracle8i
/etc/rc4.d/S20oracle8i -> ../init.d/oracle8i
/etc/rc5.d/S20oracle8i -> ../init.d/oracle8i
-
SuSE users:
[root ~]# cd /etc/rc.d/init.d
root:/etc/rc.d/init.d# ln -s /etc/rc.d/init.d/oracle8i K20oracle8i
root:/etc/rc.d/init.d# ln -s /etc/rc.d/init.d/oracle8i S20oracle8i
root:/etc/rc.d/init.d# cp K20oracle8i rc0.d
root:/etc/rc.d/init.d# cp S20oracle8i rc0.d
root:/etc/rc.d/init.d# cp K20oracle8i rc1.d
root:/etc/rc.d/init.d# cp S20oracle8i rc1.d
root:/etc/rc.d/init.d# cp K20oracle8i rc6.d
root:/etc/rc.d/init.d# cp S20oracle8i rc6.d
root:/etc/rc.d/init.d# cp K20oracle8i rc2.d
root:/etc/rc.d/init.d# cp S20oracle8i rc2.d
root:/etc/rc.d/init.d# cp K20oracle8i rc3.d
root:/etc/rc.d/init.d# cp S20oracle8i rc3.d
root:/etc/rc.d/init.d# cp K20oracle8i rc4.d
root:/etc/rc.d/init.d# cp S20oracle8i rc4.d
root:/etc/rc.d/init.d# cp K20oracle8i rc5.d
root:/etc/rc.d/init.d# cp S20oracle8i rc5.d
root:/etc/rc.d/init.d# rm K20oracle8i
root:/etc/rc.d/init.d# rm S20oracle8i
root:/etc/rc.d/init.d# cd
[root ~]# SuSEconfig
Started the SuSE-Configuration Tool.
Running in full featured mode.
Reading /etc/rc.config and updating the system...
Executing /sbin/conf.d/SuSEconfig.gdm...
Executing /sbin/conf.d/SuSEconfig.gnprint...
Executing /sbin/conf.d/SuSEconfig.groff...
Executing /sbin/conf.d/SuSEconfig.java...
Executing /sbin/conf.d/SuSEconfig.kdm...
Executing /sbin/conf.d/SuSEconfig.pcmcia...
Executing /sbin/conf.d/SuSEconfig.perl...
Executing /sbin/conf.d/SuSEconfig.postfix...
Executing /sbin/conf.d/SuSEconfig.sendmail...
Executing /sbin/conf.d/SuSEconfig.susehilf...
Executing /sbin/conf.d/SuSEconfig.susehilf.add...
Executing /sbin/conf.d/SuSEconfig.susewm...
Executing /sbin/conf.d/SuSEconfig.tetex...
Executing /sbin/conf.d/SuSEconfig.ypclient...
Processing index files of all manpages...
Finished.
-
You also need some scripts to automate startup and shutdown of the Oracle8i listener. The listener is a name server that allows your Oracle programs to talk to local and remote databases using a standard naming convention. It is required for Intermedia Text and full site search.
Download these three scripts into /var/tmp
Now issue the following commands (still as root).
[root ~]# su - oracle
[oracle ~]$ cp /var/tmp/startlsnr.txt /ora8/m01/app/oracle/product/8.1.7/bin/startlsnr
[oracle ~]$ cp /var/tmp/stoplsnr.txt /ora8/m01/app/oracle/product/8.1.7/bin/stoplsnr
[oracle ~]$ chmod 755 /ora8/m01/app/oracle/product/8.1.7/bin/startlsnr
[oracle ~]$ chmod 755 /ora8/m01/app/oracle/product/8.1.7/bin/stoplsnr
[oracle ~]$ exit
[root ~]# cp /var/tmp/listener8i.txt /etc/rc.d/init.d/listener8i
[root ~]# cd /etc/rc.d/init.d
root:/etc/rc.d/init.d# chmod 755 listener8i
Test the listener automation by running the following commands and checking the output.
root:/etc/rc.d/init.d# ./listener8i stop
Oracle 8i listener start/stop
Shutting down Listener for 8i:
LSNRCTL for Linux: Version 8.1.7.0.0 - Production on 06-MAR-2002 18:28:49
(c) Copyright 1998, Oracle Corporation. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))
The command completed successfully
root:/etc/rc.d/init.d# ./listener8i start
Oracle 8i listener start/stop
Starting the Listener for 8i:
LSNRCTL for Linux: Version 8.1.7.0.0 - Production on 06-MAR-2002 18:28:52
(c) Copyright 1998, Oracle Corporation. All rights reserved.
Starting /ora8/m01/app/oracle/product/8.1.7/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 8.1.7.0.0 - Production
System parameter file is /ora8/m01/app/oracle/product/8.1.7/network/admin/listener.ora
Log messages written to /ora8/m01/app/oracle/product/8.1.7/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 8.1.7.0.0 - Production
Start Date 06-MAR-2002 18:28:53
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File /ora8/m01/app/oracle/product/8.1.7/network/admin/listener.ora
Listener Log File /ora8/m01/app/oracle/product/8.1.7/network/log/listener.log
Services Summary...
PLSExtProc has 1 service handler(s)
ora8 has 1 service handler(s)
The command completed successfully
This test will verify that the listener is operating normally. Login into the database using the listener naming convention.
sqlplus username/password/@SID
[root ~]# su - oracle
[oracle ~]$ sqlplus system/alexisahunk@ora8
SQL> select sysdate from dual;
SYSDATE
----------
2002-02-22
SQL> exit
[oracle ~]$ exit
[root ~]#
-
RedHat users:
Now run chkconfig on the listener8i script.
[root ~]# cd /etc/rc.d/init.d/
root:/etc/rc.d/init.d# chkconfig --add listener8i
root:/etc/rc.d/init.d# chkconfig --list listener8i
listener8i 0:off 1:off 2:off 3:on 4:on 5:on 6:off
-
Debian users:
Now run update-rc.d on the listener8i script.
[root ~]# update-rc.d listener8i defaults 21 19
Adding system startup for /etc/init.d/listener8i ...
/etc/rc0.d/K19listener8i -> ../init.d/listener8i
/etc/rc1.d/K19listener8i -> ../init.d/listener8i
/etc/rc6.d/K19listener8i -> ../init.d/listener8i
/etc/rc2.d/S21listener8i -> ../init.d/listener8i
/etc/rc3.d/S21listener8i -> ../init.d/listener8i
/etc/rc4.d/S21listener8i -> ../init.d/listener8i
/etc/rc5.d/S21listener8i -> ../init.d/listener8i
-
Test the automation
As a final test, reboot your computer and make sure Oracle comes up. You can do this by typing
[root ~]# /sbin/shutdown -r -t 0 now
Log back in and ensure that Oracle started automatically.
[joeuser ~]$ su - oracle
[oracle ~]$ sqlplus system/alexisahunk@ora8
SQL> exit
Congratulations, your installation of Oracle 8.1.7 is complete.
ref: https://openacs.org/doc/current/oracle.html
Created by Gustaf Neumann, last modified by Gustaf Neumann 25 Mar 2022, at 02:14 PM
The xooauth package support a basic interface for the Microsoft Graph API, which can be used e.g. with Microsoft Teams.
These interface classes support conversion from/to JSON and to the url-encoded calling patterns on the fly, just by specifying the Tcl variable names with minor annotations (somewhat similar to the export_vars interface). Furthermore, the interface supports pagination: some Microsoft Graph API calls return per default just a partial number of results (e.g. first 100). To obtain all results, multiple REST calls have to be issued to get the full result set. Over this interface, one can specify the desired maximum number of entries.
Furthermore, the API supports async operations (create/clone/archive/unarchive teams), where the behavior can be tailored via the options "-wait" and "-donecallback".
To use the Microsoft Graph API, an "app" has to be registered/configured/authorized/...[1,2,3] by an administrator of the organization before an access token [4] can be obtained token from the Microsoft identity platform. The access token contains information about your app and the permissions it has for the resources and APIs available through Microsoft Graph. This interface is based on access tokens [4] and the /token endpoint [1] ("Get access without a user") and assumes, one has already obtained the client_id and client_secret to configure this service this way. In theory, this API will allow later to switch to newer versions of the Graph API when newer versions (currently post 1.0) of the Microsoft Graph API will come out.
The interface is written in an ensemble style where commands with the same kind of objects share a common prefix (examples are "group", "team", "user", "application", ... see below for more details). It follows strictly to the Microsoft naming conventions and makes it straightforward to extend the interface in the future. The implementation is part of the
xooauth package (see also [5]).
[1] https://docs.microsoft.com/en-us/graph/auth-v2-service
[2] https://docs.microsoft.com/en-us/graph/auth/auth-concepts
[3] https://docs.microsoft.com/en-us/graph/auth-register-app-v2
[4] https://oauth.net/id-tokens-vs-access-tokens/
[5] https://openacs.org/api-doc/package-view?version_id=5659574&public_p=1&about_package_key=&kind=procs
===========================================================================
ms::app pp ?-list? ?-prefix /value/? /dict/
ms::app application get /application_id/ ?-select /value/?
ms::app application list ?-count /value/? ?-expand /value/? ?-filter /value/? ?-orderby /value/? ?-search /value/? ?-select /value/? ?-top /integer/?
ms::app chat get /chat_id/
ms::app chat messages /chat_id/ ?-top /integer/?
ms::app group deleted ?-count /value/? ?-expand /value/? ?-filter /value/? ?-orderby /value/? ?-search /value/? ?-select /value/? ?-top /integer/?
ms::app group get /group_id/ ?-select /value/?
ms::app group list ?-count /value/? ?-expand /value/? ?-filter /value/? ?-orderby /value/? ?-search /value/? ?-select /value/? ?-max_entries /value/? ?-top /integer/?
ms::app group member add /group_id/ /principals/
ms::app group member list /group_id/ ?-count /value/? ?-filter /value/? ?-search /value/? ?-max_entries /value/? ?-top /integer/?
ms::app group member remove /group_id/ /principal/
ms::app group memberof /group_id/ ?-count /value/? ?-filter /value/? ?-orderby /value/? ?-search /value/?
ms::app group owner add /group_id/ /principal/
ms::app group owner list /group_id/
ms::app group owner remove /group_id/ /user_id/
ms::app team archive /team_id/ ?-shouldSetSpoSiteReadOnlyForMembers /value/? ?-donecallback /value/? ?-wait?
ms::app team channel list /team_id/ ?-filter /value/? ?-select /value/? ?-expand /value/?
ms::app team clone /team_id/ ?-classification /value/? ?-description /value/? -displayName /value/ ?-mailNickname /value/? -partsToClone /value/ ?-visibility /value/? ?-donecallback /value/? ?-wait?
ms::app team create ?-description /value/? -displayName /value/ ?-visibility /value/? -owner /value/ ?-donecallback /value/? ?-wait?
ms::app team delete /team_id/
ms::app team get /team_id/ ?-expand /value/? ?-select /value/?
ms::app team member add /team_id/ /principal/ ?-roles /value/?
ms::app team member list /team_id/ ?-filter /value/? ?-select /value/?
ms::app team member remove /team_id/ /principal/
ms::app team unarchive /team_id/ ?-donecallback /value/? ?-wait?
ms::app user get /principal/ ?-select /value/?
ms::app user list ?-select /value/? ?-filter /value/? ?-max_entries /value/? ?-top /value/?
ms::app user me ?-select /value/? ?-token /value/?
ms::app user memberof /principal/ ?-count /value/? ?-filter /value/? ?-orderby /value/? ?-search /value/?
ms::app run_donecallback /location/ /callback/
ms::app schedule_donecallback /secs/ /location/ /callback/
ms::app token ?-grant_type /value/? ?-scope /value/? ?-assertion /value/? ?-requested_token_use /value/?
Example Usage
#
# Create the interface object for a tenant (named here ms::app).
# For interacting with multiple tenant, define multiple application
# interface objects.
#
::ms::Graph create ms::app \
-tenant ... \
-client_id ... \
-client_secret ... \
-version v1.0
#
# get the Teams UID for a user (here via email, actual userPrincipalName)
#
set user_info [ms::app user get gustaf.neumann@wu.ac.at]
set user_id [dict get $user_info id]
: ba34495a-fd40-4c82-bc7b-1f7c778fec34
#
# Get information about a user. We use for output formatting a
# pretty-printer to provide a more readable format pf the dict
# structures returned by the Microsoft graph API:
#
ms::app pp [ms::app user get gustaf.neumann@wu.ac.at]
: @odata.context: https://graph.microsoft.com/v1.0/$metadata#users/$entity
: businessPhones: {...}
: displayName: Neumann, Gustaf
: givenName: Gustaf
: jobTitle: null
: mail: Gustaf.Neumann@wu.ac.at
: mobilePhone: ....
: officeLocation: D2.2.034
: preferredLanguage: null
: surname: Neumann
: userPrincipalName: gustaf.neumann@wu.ac.at
: id: ba34495a-fd40-4c82-bc7b-1f7c778fec34
#
# One can get more information by specifying additional "select"
# attributes, such as e.g. "department" and others (for details, see
# https://docs.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0#properties)
ms::app pp [ms::app user get gustaf.neumann@wu.ac.at -select id,department,companyName,identities,mySite,streetAddress]
: @odata.context: https://graph.microsoft.com/v1.0/$metadata#users(id,department,companyName,identities,mySite,streetAddress)/$entity
: id: ba34495a-fd40-4c82-bc7b-1f7c778fec34
: department: Wirtschaftsinformatik und Neue Medien
: companyName: WU-WIEN
: streetAddress: Welthandelsplatz 1
: mySite: https://wu-my.sharepoint.com/personal/gustaf_neumann_wu_ac_at/
: identities: {signInType userPrincipalName issuer wu.onmicrosoft.com issuerAssignedId gustaf.neumann@wu.ac.at}
#
# Get a list of certain users. We use for output formatting a
# pretty-printer to provide a more readable format of the dict
# structures returned by the Microsoft graph API:
#
ms::app pp [ms::app user list -select id,displayName,userPrincipalName -filter "startsWith(displayName,'Neumann')"]
: @odata.context: https://graph.microsoft.com/v1.0/$metadata#users(id,displayName,userPrincipalName)
: value:
: id: ba34495a-fd40-4c82-bc7b-1f7c778fec34
: displayName: Neumann, Gustaf
: userPrincipalName: gustaf.neumann@wu.ac.at
:
: id: 4e2b2b37-6c50-4367-9209-bd7392f2e115
: displayName: Neumann, Lore
: userPrincipalName: lore.neumann@wu.ac.at
#
# Return the first 10 users. Per default, Microsoft Graph returns the
# first 100 entries. By specifying -max_entries, the interface issues
# potentially several requests for returning the desired amount.
#
ms::app pp [ms::app user list -select id,displayName,userPrincipalName -max_entries 10]
#
# List the first 10 teams/groups
#
ms::app pp [ms::app group list -select id,displayName -max_entries 10]
#
# Get some attributes about a set of teams
#
ms::app pp [ms::app group list -select id,displayName -filter "startsWith(displayName,'TLF')"]
:
: @odata.context: https://graph.microsoft.com/beta/$metadata#groups(id,displayName)
: value:
: id: b78e7642-...
: displayName: TLF-TEAM
#
# Get detail info from a team
#
set team_id b78e7642-...
ms::app pp [ms::app team get $team_id]
#
# Get members of a team
#
ms::app pp [ms::app group member list $team_id]
#
# Get owners of a team
#
ms::app pp [ms::app group owner list $team_id]
#
# Add member to a team
#
ms::app group member add $team_id gustaf.neumann@wu.ac.at
#
# Get channels of a team
#
ms::app pp [ms::app team channel list $team_id]
#
# Delete a team
#
ms::app team delete 85f3d2d2-c2d3-...
#
# List deleted groups/teams
#
ms::app pp [ms::app group deleted -filter "startsWith(displayName,'Testing community')"]
: @odata.context: https://graph.microsoft.com/v1.0/$metadata#groups(id,displayName,deletedDateTime)
: value:
: id: c0030714-656d-4bbe-8d4e-507e73d6f643
: displayName: Testing community 3
: deletedDateTime: 2021-10-22T09:14:08Z
Created by Gustaf Neumann, last modified by Gustaf Neumann 10 Mar 2022, at 09:34 AM
Scheduled for OpenACS 5.10.1, there is a new interface available that provides several improvements over the current solutions:
The new interface ...
- is significantly faster than the existing official OpenACS interface (package_exec_plsql) and easier to use by supporting a standard calling interface (not the special "var_list" which has to be assembled for package_exec_plsql)
- is about the same performance as the "::xo::db::sql::*" interface without sharing its disadvantages (being a separate pattern, just one backend, ...)
- is more secure (thorough argument checking on the Tcl and bind-vars level), and
- more flexible (works with multiple databases and multiple driver types), and
- much more feature-complete (e.g. support for functions returning tables, etc.)
For more details, check below. The plan is to replace the "::xo::db::sql::*" interface in a first step and replace calls to package_exec_plsql in the supported packages, and to mark the obsolete functions as deprecated. In the near future, more features of the xo::db interface will be added. The plain ugly old interface of OpenACS of calling db-functions where the highest priority.
Implemented features:
-
SQL function can be called for multiple database connection types (driver types nsdb and nsdbi, backend types PostgreSQL and Oracle) with less overhead (in essence, a value added, better performing replacement of "package_exec_plsql"). The interface provided via xo::db supported just a single combination of the above.
-
Support for PostgreSQL and Oracle
-
Ability to talk to multiple databases from the same OpenACS instance. These databases can be
- multiple databases of the same driver and backend (e.g. multiple PostgreSQL databases)
- multiple databases using different drivers (e.g. nsdb and nsdbi)
- multiple databases with different backends vendors (e.g. PostgreSQL and Oracle).
The selection of the backed happens of via the standard "-dbn" parameter. For the nsdb driver, one can use e.g., "-dbn legacy", an example for nsdbi is "-dbn dbi1", where the value provided via "-dbn" is passed for uniformity to the "-db" option of the nsdbi API.
-
Support for functions returning composite SQL types (SQL type "record" in PostgreSQL or "table" in Oracle). Results are returned as lists of lists. This feature is implemented and tested for PostgreSQL connected via nsdb and nsdbi drivers and Oracle via nsdb.
-
SQL functions returning "void" can be called as well. In the Oracle cases, these are "procedures" which have to be called differently.
-
Additional (Tcl-level) argument checking is provided before calling into SQL for improved security and documentation. The API handles among other types the SQL types "integer" and "bigint".
-
Arguments of SQL functions are passed to the database via bind variables (implemented for PostgreSQL with nsdb and nsdbi). This is a security improvement over the previous implementation in xotcl-core.
-
Standard default handling (argument default values like for all Tcl procs, although the way how defaults are handled is different in PostgreSQL and Oracle).
-
Optional arguments passed in as empty strings are treated as NULL values (standard behavior in OpenACS)
-
Dropped shortcomings of xo::db interface (naming and calling conflicts).
-
Independent of xotcl-core
Possible further extensions:
- Argument types could/should be displayed in the API browser (general feature request, not specific to the new DB interface)
Usage:
At startup, a single database interface is creates, which is named "::acs::dc", which takes the parameters from the default setup of the OpenACS configuration.
The following command creates a second database interface based on the "nsdbi" driver and define the interface stubs for the nsdbi driver.
::acs::db::require_dc -driver nsdbi -name ::acs::dc2
::acs::dc2 create_db_function_interface
For specifying a different backend, one could use e.g.:
::acs::db::require_dc -backend oracle -name ::acs::dc3
SQL query to a second DB (db pool called "legacy") via nsdb interface:
::acs::dc list_of_lists -dbn legacy get_list {select 1 from dual}
Call database function from a second DB (db pool called "legacy") via nsdb driver:
::acs::dc call content_item get_latest_revision -dbn legacy -item_id 33357
Call database function from a second DB via nsdbi driver named "dbi1"
::acs::dc2 call content_item get_latest_revision -dbn dbi1 -item_id 33357
Return multiple records via nsdb
::acs::dc call content_item get_children -item_id 169303
Return multiple records via nsdbi
::acs::dc2 call content_item get_children -item_id 169303
Some calls with performance data (for ds/shell):
lappend _ [package_exec_plsql -var_list {{item_id 33357}} content_item get_latest_revision]
lappend _ [::xo::db::sql::content_item get_latest_revision -item_id 33357]
lappend _ [::acs::dc call content_item get_latest_revision -item_id 33357]
lappend _ [::acs::dc2 call content_item get_latest_revision -item_id 33357]
lappend _ [time {package_exec_plsql -var_list {{item_id 33357}} content_item get_latest_revision} 1000]
lappend _ [time {::xo::db::sql::content_item get_latest_revision -item_id 33357} 1000]
lappend _ [time {::acs::dc call content_item get_latest_revision -item_id 33357} 1000]
lappend _ [time {::acs::dc2 call content_item get_latest_revision -item_id 33357} 1000]
join $_ \n
The results as displayed by ds/shell
33358
33358
33358
33358
402.096544 microseconds per iteration
190.805835 microseconds per iteration
187.885927 microseconds per iteration
171.99336300000002 microseconds per iteration