Oracle XE on Debian

本文详细介绍了如何在Debian系统上安装Oracle Database 10g Express Edition (XE),包括配置源、解决Swap空间不足的问题、配置数据库参数及运行示例SQL脚本。

Article came from
有时间我会翻译的
----------------------------------------------------------------------


たまには、
debianでもいじろうかな。

何がええかなぁ?と考えた末、Oracleにした。またインストールのみかよ!(笑)


Oracle Database 10g Express Editionというのがある。こいつは商用にも使えるOracle初の無料版DBで、制限はあれども最新の10gが体験できるのである。すごい世の中になったものだ。


Oracle Database 10g XE無料配布へ - HTML DBも同梱、小規模組織での利用に | エンタープライズ | マイコミジャーナル


で、なんとOracle XEには、Debianのパッケージがある。御丁寧にapt-lineまである。まずは、以下を/etc/apt/sourcelistに追加する。

# oracle xe
deb http://oss.oracle.com/debian/ unstable main non-free
deb-src http://oss.oracle.com/debian/ unstable main

そして、apt-getするだけ。

$ sudo apt-get install oracle-xe-universal

すごいパスにインストールされてしまうが、とりあえずこれで動くようになる。もし、Swap領域が足りない場合は、以下のエラーが出る。

This system does not meet the minimum requirements for swap space.  Based on
the amount of physical memory available on the system, Oracle Database 10g
Express Edition requires 1004 MB of swap space. This system has 919 MB
of swap space.  Configure more swap space on the system and retry the installati
on.
dpkg: /var/cache/apt/archives/oracle-xe-universal_10.2.0.1-1.1_i386.deb の処理中
にエラーが発生しました (--unpack):
 サブプロセス pre-installation script はエラー終了ステータス 1 を返しました
以下のパッケージの処理中にエラーが発生しました:
 /var/cache/apt/archives/oracle-xe-universal_10.2.0.1-1.1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

この場合、Swap領域の追加が必要だ。現在のSwap容量は、以下のコマンドで分かる。

$ /sbin/swapon -s
Filename                        Type            Size    Used    Priority
/dev/hdb2                       partition       1012084 191924  -1
/dev/hda2                       partition       506036  0       -3

追加は、fdiskでパーティションを切って、mkswapで初期化、swapon で追加すればOK。正常にインストールされたら、お次ぎはconfigurationする。ここで、/etc/sysconfigディレクトリが無い場合、エラーになるので、事前に作成しておく。

sudo mkdir /etc/sysconfig

では、実行。

$ sudo /etc/init.d/oracle-xe configure

HTTP portやListener portなど、いくつかの質問に答えましょう。

Oracle Database 10g Express Edition Configuration
-------------------------------------------------
This will configure on-boot properties of Oracle Database 10g Express
Edition.  The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts.  Press <Enter> to accept the defaults.
Ctrl-C will abort.

Specify the HTTP port that will be used for Oracle Application Express [8080]:

Specify a port that will be used for the database listener [1521]:

Specify a password to be used for database accounts.  Note that the same
password will be used for SYS and SYSTEM.  Oracle recommends the use of
different passwords for each database account.  This can be done after
initial configuration:
Confirm the password:

Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:

Starting Oracle Net Listener...Done
Configuring Database...Done
Starting Oracle Database 10g Express Edition Instance...Done
Installation Completed Successfully.
To access the Database Home Page go to "http://127.0.0.1:8080/apex"

これで、おしまい。http://127.0.0.1:8080/apexアクセスすれば、ブラウザベースの管理ツールが使える。私の貧弱サーバ(PIII 800MHz)でも、なかなか軽快に動くのでoemよりも使い勝手がいい。次は、お約束のScott/Tigerを入れよう。これは、以下でBuildスクリプトを入手。


http://www.oracle.com/technology/sample_code/tech/sql_plus/htdocs/demobld.html


ユーザScottを作成して、demobld.sqlを実行すればOKなんだけど、どうもクライアントのNLS_LANGが日本系のようで、このままではTO_DATEがエラーになる。以下をdemobld.sqlの頭に入れれば、OK。

ALTER SESSION SET NLS_DATE_LANGUAGE='AMERICAN';

では、実行。

$ . /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh
$ sqlplus scott/tiger

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 10 01:49:34 2006

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL> start demobld.sql
Building demonstration tables.  Please wait.
Demonstration table build is complete.
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

どれどれ、出来たかな?

$ sqlplus scott/tiger

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Dec 10 01:50:57 2006

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

SQL> set pagesize 100
SQL> select empno,ename from emp;

     EMPNO ENAME
---------- ----------
      7369 SMITH
      7499 ALLEN
      7521 WARD
      7566 JONES
      7654 MARTIN
      7698 BLAKE
      7782 CLARK
      7788 SCOTT
      7839 KING
      7844 TURNER
      7876 ADAMS
      7900 JAMES
      7902 FORD
      7934 MILLER

14 rows selected.

SQL> 

素晴らしい!今日はここまで。次回は、Tomcatを入れてServletDBをつっつく予定。こう御期待?

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值