`
eimhee
  • 浏览: 2160442 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

在ubuntu server下安装Oracle XE

阅读更多

以前都是在开发环境中使用oracle的轻量级服务器oracle xe。是在windows环境下,见适合开发人员的Oracle10g环境。

在linux上安装oracle是一件痛苦的事情。因为需要为安装做很多准备工作。另外,就是oracle的安装都是基于redhat版本的。

ubuntu server是很好的linux服务器版本,但是得到的企业支持较少,比如oracle,比如其他软件提供商。

公司需要移植以前oracle数据库的东西出来。为了应急,在ubuntu server上安装一个express edition(XE)。这个版本在ubuntu上安装十分容易。


首先需要设置oracle xe版本的源:

sudo vim /etc/apt/sources.list

在该文件中增加:
deb http://oss.oracle.com/debian unstable main non-free

然后需要将该源服务器的公钥添加在本地 apt 系统的密钥库中:
wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle  -O- | sudo apt-key add -

然后,更新apt库:
apt-get update

安装oracle xe服务器:
apt-get install oracle-xe

这样就安装好oracle服务器了。会有提示,启动前作配置。
sudo /etc/init.d/oracle-xe configure

比如配置web管理界面的端口号,oracle监听器的端口号,是否linux启动时启动和sys、system用户的密码等。

另外,需要设置环境变量:
sudo vim /etc/environment

增加:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:${ORACLE_HOME}/bin
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
TNS_ADMIN=/usr/lib/oracle

然后,使之生效:

source /etc/environment

这样,就可以直接运行sqlplus了。

sqlplus system/password@XE

需要在sqlplus中修改oracle配置,让web访问管理界面可以通过远程访问。

EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE)

另外,需要创建tnsname配置文件:

sudo vim /usr/lib/oracle/tnsnames.ora

文件内容:

XE =
   (DESCRIPTION =
      (ADDRESS_LIST =
         (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
      )
      (CONNECT_DATA =
         (SERVICE_NAME = XE)
      )
   )

 

然后,需要重启oracle:

sudo /etc/init.d/oracle-xe restart

参考文档:
http://www.oracle.com/technology/tech/linux/install/xe-on-kubuntu.html
http://www.cognovis.de/developer/en/oracle-xe-installation

 

分享到:
评论
2 楼 eimhee 2009-11-04  
Oracle Express Edition / on Ubuntu Edgy 6.10

I am using the Edgy Server, so I will show you how to set things up so that they work whether you have X-Windows installed or not. This has also been successfully tested on Hardy LTS.
[编辑]
Requirements

As usual, Oracle needs a lot of resources, with a minumum for the server of 512 MBytes of Ram and 1024 MBytes of Swap and 1.5 Gbytes of free disk space. This requirements are checked by the install package. As the amount of swap isn't the default value for a fresh install, be aware of that. A workaround for that is described in http://www.oracle.com/technology/tech/linux/install/xe-on-kubuntu.html Oracle10gDapper mentions a dependency on libaio1 and bc - but I don't recall it being a problem on my Edgy installation (the latest oracle-xe package lists them as dependencies inside the package and apt-get will install them for you should they not already be installed).
[编辑]
Requirements for NFS

If you are installing onto nfs (ie, if /usr/lib is on an nfs volume), oracle is very picky about the mount options you must use. You won't get any error message during the configure step - oracle just won't work. These mount options seem to make oracle happy:
rw,nfsvers=3,noatime,rsize=32768,wsize=32768,hard,intr,nolock,tcp,async,noac,suid

It's best to create a new oracle mountpoint (/usr/lib/oracle) and mount a separate nfs export to there (since you might not want all those options on the rest of your nfs mounted filesystem).
[编辑]
Fundamentals

Add this line to /etc/apt/sources.list file:
deb http://oss.oracle.com/debian unstable main non-free

Next, you will need to add the GPG key.
wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle  -O- | sudo apt-key add -

As root, type:
apt-get update
apt-get install oracle-xe
/etc/init.d/oracle-xe configure

Edit your .bashrc file to include the lines:
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME
export ORACLE_SID=XE

export PATH

Start a new bash shell for the changes to take effect. To log in as a database administrator:
sqlplus sys as sysdba

It will then be possible for you to create and unlock user accounts using Oracle SQL commands - they details of which are beyond the scope of this doc.
[编辑]
Testing the Oracle-supplied example database

Oracle have thoughtfully provided a dummy database for you to play with. There is a user called HR with some tables in them. It provides a good test to check that everything is up-and-running. Gain admin access using 'sqlplus sys as sydba' (shown above). Choose a password for user HR (which I will denote by $password) and then type
alter user HR account unlock ;
alter user HR identified by $password ;
exit

Now attempt to examine the database as user HR:
sqlplus HR/$password
SELECT table_name FROM user_tables;
SELECT * FROM regions ;
INSERT INTO REGIONS (REGION_ID, REGION_NAME) VALUES (666, 'Outer Mongolia') ;
COMMIT ;

The first SELECT statement should give you a list of user tables that you can play with (in this example, they are: REGIONS, LOCATIONS, DEPARTMENTS, JOBS, EMPLOYEES, JOB_HISTORY, COUNTRIES). The second SELECT statement shows a list of entries in the REGIONS table. Hopefully everything will show up fine. In the INSERT INTO line, I add a record to the database so that we can prove what database we are connected to. COMMIT just commits the new item.
[编辑]
Connecting via Windows

If the above works, we should be on the home straight. Let's try to connect to our Ubuntu box from Windows. I have assumed that you have set up Oracle on Windows. Edit the file TNSNAMES.ORA, which may typically be found in the directory C:\oracle\product\10.1.0\Db_1\NETWORK\ADMIN and add the following lines:
$CONNID=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = $IP)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

where $CONNID is whatever connection ID you want to use. You could use a name like UBUNTU; but I prefer to give it the name of the server that is running Oracle. $IP is the IP address of your Ubuntu box, typically something like 192.168.30.123 - but you'll have to decide the actual address for yourself (hint: run ifconfig , look at eth0 section, inet addr address). Save and exit. Start a DOS shell, and enter the command:
sqlplus HR@$CONNID

where, of course, you'll have to enter whatever connection ID $CONNID is. You will also need to supply the password that you created for HR. Examine what's in the database. See the "Testing ..." section above to see what tables are available. If you performed the actions specified in that section, then, if you type
SELECT * FROM regions ;

you should see the 'Outer Mongolia' entry that you created. And that's about it! Everything should now be set up, ready for you to do proper adminning of the database in accordance with standard procedures.
[编辑]
Tips

Some random tips which mostly appeared in Oracle10gDapper.
[编辑]
HTTP Interface

Now for creating users / schema / ... you have a nice http interface to do it :
http://localhost:8080/apex/

No more need of java. If like me you install this Oracle database on a server without a graphic X server, you may need to use a SSH port forwarding
ssh -L 8080:localhost:8080 user@IP_of_your_server

Personally, I (MarkCarter2), use Edgy Server, and use putty from Windows to connect to my Ubuntu box. I then do "sqlplus sys as sydba" to administer accounts that way. For me, it's much less fiddle than either method mentioned above
[编辑]
Packages

Apparently, here are 3 packages to select from:
oracle-xe - Oracle Database 10g Express Western European Edition
oracle-xe-client - Oracle Client 10g Express Edition
oracle-xe-universal - Oracle Database 10g Express Universal Edition

I copied the above information from Oracle10gDapper, but I am not sure of the significance of these. You can probably ignore this, as the method I have outlined on this page seems to be adequate anyway.
[编辑]
Installation Troubleshooting

NFS: see Requirements for NFS, above. Others: the directory /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/log contains the logfiles of the sql scripts run to initially set up the database. If you are having problems with oracle not starting up, check these files. ORA-27101: shared memory realm does not exist If this Error appears while connecting, check the following thing: If the command "bc" is installed. if not type
sudo apt-get install bc
aptitude purge oracle-xe-universal
apt-get install oracle-xe
or (apt-get install oracle-xe-universal)

If you now get an error saying that your Swap space is to small please look at the Swap Documentation Entry.
[编辑]
See Also

Oracle How to Install on kubuntu : http://www.oracle.com/technology/tech/linux/install/xe-on-kubuntu.html Oracle10gDapper - Oracle Express Edition 10g R2 / on Ubuntu Dapper 6.06 LTS RevTech Zero's Database Blog - Oracle 10g R2 / Enterprise / Standard on Ubuntu Gutsy Gibbon 7.10 http://revtech0.webonsites.com/blog.html http://mapopa.blogspot.com/2006/03/installing-oracle-on-ubuntu-breezy.html Oracle FAQ, Forum, Wiki, etc. at http://www.orafaq.com/
1 楼 eimhee 2009-11-04  
Oracle Express Edition / on Ubuntu Edgy 6.10

I am using the Edgy Server, so I will show you how to set things up so that they work whether you have X-Windows installed or not. This has also been successfully tested on Hardy LTS.
[编辑]
Requirements

As usual, Oracle needs a lot of resources, with a minumum for the server of 512 MBytes of Ram and 1024 MBytes of Swap and 1.5 Gbytes of free disk space. This requirements are checked by the install package. As the amount of swap isn't the default value for a fresh install, be aware of that. A workaround for that is described in http://www.oracle.com/technology/tech/linux/install/xe-on-kubuntu.html Oracle10gDapper mentions a dependency on libaio1 and bc - but I don't recall it being a problem on my Edgy installation (the latest oracle-xe package lists them as dependencies inside the package and apt-get will install them for you should they not already be installed).
[编辑]
Requirements for NFS

If you are installing onto nfs (ie, if /usr/lib is on an nfs volume), oracle is very picky about the mount options you must use. You won't get any error message during the configure step - oracle just won't work. These mount options seem to make oracle happy:
rw,nfsvers=3,noatime,rsize=32768,wsize=32768,hard,intr,nolock,tcp,async,noac,suid

It's best to create a new oracle mountpoint (/usr/lib/oracle) and mount a separate nfs export to there (since you might not want all those options on the rest of your nfs mounted filesystem).
[编辑]
Fundamentals

Add this line to /etc/apt/sources.list file:
deb http://oss.oracle.com/debian unstable main non-free

Next, you will need to add the GPG key.
wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle  -O- | sudo apt-key add -

As root, type:
apt-get update
apt-get install oracle-xe
/etc/init.d/oracle-xe configure

Edit your .bashrc file to include the lines:
ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_HOME
export ORACLE_SID=XE

export PATH

Start a new bash shell for the changes to take effect. To log in as a database administrator:
sqlplus sys as sysdba

It will then be possible for you to create and unlock user accounts using Oracle SQL commands - they details of which are beyond the scope of this doc.
[编辑]
Testing the Oracle-supplied example database

Oracle have thoughtfully provided a dummy database for you to play with. There is a user called HR with some tables in them. It provides a good test to check that everything is up-and-running. Gain admin access using 'sqlplus sys as sydba' (shown above). Choose a password for user HR (which I will denote by $password) and then type
alter user HR account unlock ;
alter user HR identified by $password ;
exit

Now attempt to examine the database as user HR:
sqlplus HR/$password
SELECT table_name FROM user_tables;
SELECT * FROM regions ;
INSERT INTO REGIONS (REGION_ID, REGION_NAME) VALUES (666, 'Outer Mongolia') ;
COMMIT ;

The first SELECT statement should give you a list of user tables that you can play with (in this example, they are: REGIONS, LOCATIONS, DEPARTMENTS, JOBS, EMPLOYEES, JOB_HISTORY, COUNTRIES). The second SELECT statement shows a list of entries in the REGIONS table. Hopefully everything will show up fine. In the INSERT INTO line, I add a record to the database so that we can prove what database we are connected to. COMMIT just commits the new item.
[编辑]
Connecting via Windows

If the above works, we should be on the home straight. Let's try to connect to our Ubuntu box from Windows. I have assumed that you have set up Oracle on Windows. Edit the file TNSNAMES.ORA, which may typically be found in the directory C:\oracle\product\10.1.0\Db_1\NETWORK\ADMIN and add the following lines:
$CONNID=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = $IP)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

where $CONNID is whatever connection ID you want to use. You could use a name like UBUNTU; but I prefer to give it the name of the server that is running Oracle. $IP is the IP address of your Ubuntu box, typically something like 192.168.30.123 - but you'll have to decide the actual address for yourself (hint: run ifconfig , look at eth0 section, inet addr address). Save and exit. Start a DOS shell, and enter the command:
sqlplus HR@$CONNID

where, of course, you'll have to enter whatever connection ID $CONNID is. You will also need to supply the password that you created for HR. Examine what's in the database. See the "Testing ..." section above to see what tables are available. If you performed the actions specified in that section, then, if you type
SELECT * FROM regions ;

you should see the 'Outer Mongolia' entry that you created. And that's about it! Everything should now be set up, ready for you to do proper adminning of the database in accordance with standard procedures.
[编辑]
Tips

Some random tips which mostly appeared in Oracle10gDapper.
[编辑]
HTTP Interface

Now for creating users / schema / ... you have a nice http interface to do it :
http://localhost:8080/apex/

No more need of java. If like me you install this Oracle database on a server without a graphic X server, you may need to use a SSH port forwarding
ssh -L 8080:localhost:8080 user@IP_of_your_server

Personally, I (MarkCarter2), use Edgy Server, and use putty from Windows to connect to my Ubuntu box. I then do "sqlplus sys as sydba" to administer accounts that way. For me, it's much less fiddle than either method mentioned above
[编辑]
Packages

Apparently, here are 3 packages to select from:
oracle-xe - Oracle Database 10g Express Western European Edition
oracle-xe-client - Oracle Client 10g Express Edition
oracle-xe-universal - Oracle Database 10g Express Universal Edition

I copied the above information from Oracle10gDapper, but I am not sure of the significance of these. You can probably ignore this, as the method I have outlined on this page seems to be adequate anyway.
[编辑]
Installation Troubleshooting

NFS: see Requirements for NFS, above. Others: the directory /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/config/log contains the logfiles of the sql scripts run to initially set up the database. If you are having problems with oracle not starting up, check these files. ORA-27101: shared memory realm does not exist If this Error appears while connecting, check the following thing: If the command "bc" is installed. if not type
sudo apt-get install bc
aptitude purge oracle-xe-universal
apt-get install oracle-xe
or (apt-get install oracle-xe-universal)

If you now get an error saying that your Swap space is to small please look at the Swap Documentation Entry.
[编辑]
See Also

Oracle How to Install on kubuntu : http://www.oracle.com/technology/tech/linux/install/xe-on-kubuntu.html Oracle10gDapper - Oracle Express Edition 10g R2 / on Ubuntu Dapper 6.06 LTS RevTech Zero's Database Blog - Oracle 10g R2 / Enterprise / Standard on Ubuntu Gutsy Gibbon 7.10 http://revtech0.webonsites.com/blog.html http://mapopa.blogspot.com/2006/03/installing-oracle-on-ubuntu-breezy.html Oracle FAQ, Forum, Wiki, etc. at http://www.orafaq.com/

相关推荐

    ubuntu下安装oracle-xe,并建立数据库脚本测试

    ### Ubuntu 下安装 Oracle-XE 并建立数据库脚本测试 #### 安装Oracle-XE 在 Ubuntu 系统上安装 Oracle-XE(Oracle Express Edition)并进行基础配置,需要完成以下步骤: 1. **设置 Oracle-XE 版本源** 首先...

    Ubuntu 12.04下安装Oracle Express 11gR2

    3. 安装预设条件:在安装Oracle XE之前,可能需要安装一些软件包作为预设条件,例如安装gcc、make等编译工具,以及安装一些必要的库文件,如libaio和libmotif3。 4. 下载和解压安装文件:Oracle XE 11g R2的安装...

    在Ubuntu Server(804,904)上安装Oracle 10g企业版

    ### 在Ubuntu Server(804,904)上安装Oracle 10g企业版 #### 安装准备与环境配置 本指南旨在为希望在Ubuntu Server 8.04或9.04版本上安装Oracle 10g企业版数据库的用户提供了详细的步骤和注意事项。Ubuntu Server...

    ubuntu16下安装oracle11g

    在安装Oracle11g之前,您可能会遇到虚拟机与宿主机之间无法共享文件的问题。这是因为Vmware Tools未安装或已经损坏。解决这个问题的步骤包括: - 在VMware中安装VMware Tools,通过菜单“VM”->“Install VMWare ...

    Ubuntu Server 12.04安装图解

    **Ubuntu Server 12.04安装图解** Ubuntu Server 12.04,代号"precise pangolin",是Ubuntu发行版的一个长期支持(LTS)版本,为服务器环境提供了稳定、安全且高效的操作系统。这个版本的生命周期长达五年,确保了...

    UBUNTU安装ORACLE11G

    在ubuntu上安装oracle11g,其中有些小细节,不注意是会出问题的,当时我费了不少力的。

    Ubuntu下oracle安装说明

    Ubuntu下oracle安装说明,比较经典的教材,亲自实验成功过。截图看技术博客:pm.htjs.cbb

    Ubuntu安装Oracle所需包

    在Ubuntu系统上安装Oracle数据库需要遵循一定的步骤,因为Oracle数据库对操作系统环境有一定的要求,并且需要安装一系列的依赖包来确保其稳定运行。本教程将详细解释如何在Ubuntu上准备环境并解决可能出现的问题。 ...

    ubuntu 8.0.4 server 安装oracle10.2成功

    ### Ubuntu 8.0.4 Server安装Oracle 10.2...通过以上步骤,可以确保在Ubuntu 8.0.4 Server上成功安装Oracle 10.2。这些步骤不仅覆盖了软件的安装与配置,还包括了系统级别的优化,以确保数据库能够在最佳状态下运行。

    ubuntu14、16安装Oracle数据库的详细文档

    安装Oracle数据库是在Linux操作系统上进行的一项常见任务,尤其适用于数据密集...由于Oracle数据库对系统资源的要求较高,因此在安装之前务必要充分评估服务器的硬件配置,确保满足安装后Oracle数据库稳定运行的要求。

    Ubuntu8.04_server安装oracle10g

    在 Ubuntu 8.04 Server 上安装 Oracle 10g 是一项技术性较强的任务,需要遵循一系列详细的步骤。以下是安装过程中的关键知识点: 1. **环境准备**: - Ubuntu 平台:Ubuntu 8.04 Server 是一个基于 Debian 的 ...

    Ubuntu 安装oracle

    ubuntu上装oracle确实挺复杂的,因为oracle不支持嘛,折腾了几天,装上之后也很爽。

    0racle 10g在ubuntu server上的安装.pdf

    介绍如何在ubuntu server上安装oracle10。在ubuntu server 上安装oracle 有两个原因:1 ubuntu server 发行版本仅一张光盘,而RHEL 要4 张光盘,比较起来安装时间成本会小很多。2 ubuntu server 不带图形界面占用...

    Oracle 11g for ubuntu 安装教程

    Oracle 11g 是一个功能强大的关系数据库管理系统,但是其在 Ubuntu 下的安装却存在一定的难度。以下是 Oracle 11g for ubuntu 安装教程的知识点总结: 安装前提条件 * Ubuntu 8.04 desktop (32 位) 操作系统 * ...

    Ubuntu 16.04(Ubuntu 16.04安装Oracle 11g及配置环境pdf)

    在本文中,我们将深入探讨如何在Ubuntu 16.04操作系统上安装Oracle 11g数据库,并进行必要的环境配置。Ubuntu 16.04是Linux发行版中的一款稳定且广泛使用的版本,而Oracle 11g是企业级的关系型数据库管理系统,适合...

    ubuntu下安装oracle10g

    在Ubuntu 8.04系统上安装Oracle 10g是一项技术性较强的任务,涉及到操作系统配置、依赖安装、用户权限...在文档“ubuntu下安装oracle1-g.doc”中,通常会有更具体的指导和解决常见问题的方法,建议仔细阅读并参照执行。

    Ubuntu_10安装Oracle_10g手记

    根据给定的文件信息,我们可以总结出在Ubuntu 9.10系统上安装Oracle 10g的关键步骤和注意事项,尽管标题与描述提及的是Ubuntu 10,但内容实际涉及的是Ubuntu 9.10。以下是详细的安装指南: ### 安装前的系统准备 ...

    Ubuntu 16.04安装Oracle 11gR2入门教程图文详解

    ### Ubuntu 16.04 安装 Oracle 11gR2 入门教程 #### 系统与版本信息 - Ubuntu版本:ubuntu-16.04.3-desktop-amd64 - Oracle数据库版本:linux.x64_11gR2_database #### 系统初始设置 - **修改root账户密码**:使用...

Global site tag (gtag.js) - Google Analytics