个人工具

“UbuntuHelp:Oracle10g”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(New page: {{From|https://help.ubuntu.com/community/Oracle10g}} {{Languages|php5}} == Oracle Express Edition / on Ubuntu Edgy 6.10 == I am using the Edgy Server, so I will show you how to set thi...)
 
 
(未显示2个用户的12个中间版本)
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/Oracle10g}}
 
{{From|https://help.ubuntu.com/community/Oracle10g}}
{{Languages|php5}}
+
{{Languages|UbuntuHelp:Oracle10g}}
 
+
<<Include(Tag/StyleCleanup)>>
 
+
 
+
 
== Oracle Express Edition / on Ubuntu Edgy 6.10 ==
 
== 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:
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.
+
{|border="1" cellspacing="0"
 
+
| '''Version''' || '''Release Name''' || '''Comments'''
 +
|-
 +
| 6.10 || Edgy ||
 +
|-
 +
| 8.04 || Hardy LTS ||
 +
|-
 +
| 9.10 || Karmic ||
 +
|-
 +
| 10.04|| Lucid ||
 +
|}
 
=== Requirements ===
 
=== 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 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
 
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
 
+
[[UbuntuHelp:Oracle10gDapper|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).
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 ====
 
==== 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:  
 
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:  
 
<pre><nowiki>
 
<pre><nowiki>
 
rw,nfsvers=3,noatime,rsize=32768,wsize=32768,hard,intr,nolock,tcp,async,noac,suid
 
rw,nfsvers=3,noatime,rsize=32768,wsize=32768,hard,intr,nolock,tcp,async,noac,suid
</nowiki></code>
+
</nowiki></pre>
 
+
 
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).
 
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 ===
 
=== Fundamentals ===
 
 
Add this line to /etc/apt/sources.list file:
 
Add this line to /etc/apt/sources.list file:
 
<pre><nowiki>
 
<pre><nowiki>
 
deb http://oss.oracle.com/debian unstable main non-free
 
deb http://oss.oracle.com/debian unstable main non-free
</nowiki></code>
+
</nowiki></pre>
 
+
Next, you will need to add the GPG key.
 +
<pre><nowiki>
 +
wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle  -O- | sudo apt-key add -
 +
</nowiki></pre>
 
As root, type:
 
As root, type:
 
<pre><nowiki>
 
<pre><nowiki>
第37行: 第39行:
 
apt-get install oracle-xe
 
apt-get install oracle-xe
 
/etc/init.d/oracle-xe configure
 
/etc/init.d/oracle-xe configure
</nowiki></code>
+
</nowiki></pre>
 
+
 
Edit your .bashrc file to include the lines:
 
Edit your .bashrc file to include the lines:
 
<pre><nowiki>
 
<pre><nowiki>
第47行: 第48行:
  
 
export PATH
 
export PATH
</nowiki></code>
+
</nowiki></pre>
 
Start a new bash shell for the changes to take effect.
 
Start a new bash shell for the changes to take effect.
 
 
To log in as a database administrator:
 
To log in as a database administrator:
 
<pre><nowiki>
 
<pre><nowiki>
 
sqlplus sys as sysdba
 
sqlplus sys as sysdba
</nowiki></code>
+
</nowiki></pre>
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.
+
It will then be possible for you to create and unlock user accounts using Oracle SQL commands.  The details of which are beyond the scope of this doc.
 
+
 
=== Testing the Oracle-supplied example database ===
 
=== 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.
 
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
 
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
 
<pre><nowiki>
 
<pre><nowiki>
第65行: 第62行:
 
alter user HR identified by $password ;
 
alter user HR identified by $password ;
 
exit
 
exit
</nowiki></code>
+
</nowiki></pre>
 
+
 
Now attempt to examine the database as user HR:
 
Now attempt to examine the database as user HR:
 
<pre><nowiki>
 
<pre><nowiki>
第74行: 第70行:
 
INSERT INTO REGIONS (REGION_ID, REGION_NAME) VALUES (666, 'Outer Mongolia') ;
 
INSERT INTO REGIONS (REGION_ID, REGION_NAME) VALUES (666, 'Outer Mongolia') ;
 
COMMIT ;
 
COMMIT ;
</nowiki></code>
+
</nowiki></pre>
 
+
 
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,  
 
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.
 
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 ===
 
=== 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.
 
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
 
Edit the file TNSNAMES.ORA, which may typically be found in the directory
 
C:\oracle\product\10.1.0\Db_1\NETWORK\ADMIN
 
C:\oracle\product\10.1.0\Db_1\NETWORK\ADMIN
第90行: 第81行:
 
$CONNID=
 
$CONNID=
 
   (DESCRIPTION =
 
   (DESCRIPTION =
     (ADDRESS == (PROTOCOL == TCP)(HOST == $IP)(PORT == 1521))
+
     (ADDRESS = (PROTOCOL = TCP)(HOST = $IP)(PORT = 1521))
 
     (CONNECT_DATA =
 
     (CONNECT_DATA =
 
       (SERVER = DEDICATED)
 
       (SERVER = DEDICATED)
第96行: 第87行:
 
     )
 
     )
 
   )
 
   )
</nowiki></code>
+
</nowiki></pre>
 
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.
 
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:
 
Start a DOS shell, and enter the command:
 
<pre><nowiki>
 
<pre><nowiki>
 
sqlplus HR@$CONNID
 
sqlplus HR@$CONNID
</nowiki></code>
+
</nowiki></pre>
 
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.
 
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
 
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
 
<pre><nowiki>
 
<pre><nowiki>
 
SELECT * FROM regions ;
 
SELECT * FROM regions ;
</nowiki></code>
+
</nowiki></pre>
 
you should see the 'Outer Mongolia' entry that you created.
 
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.
 
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 ==
 
== Tips ==
 
+
Some random tips which mostly appeared in [[UbuntuHelp:Oracle10gDapper|Oracle10gDapper]].  
Some random tips which mostly appeared in Oracle10gDapper.  
+
 
+
 
=== HTTP Interface ===
 
=== HTTP Interface ===
 
 
Now for creating users / schema / ... you have a nice http interface to do it :
 
Now for creating users / schema / ... you have a nice http interface to do it :
 
<pre><nowiki>
 
<pre><nowiki>
 
http://localhost:8080/apex/
 
http://localhost:8080/apex/
</nowiki></code>
+
</nowiki></pre>
 
No more need of java.
 
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  
 
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  
 
 
<pre><nowiki>
 
<pre><nowiki>
 
ssh -L 8080:localhost:8080 user@IP_of_your_server
 
ssh -L 8080:localhost:8080 user@IP_of_your_server
</nowiki></code>
+
</nowiki></pre>
 
+
Personally, I ([[UbuntuHelp:MarkCarter2|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
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
+
It is also possible to use the administration console remotely, even if it's not recommended for security reasons (better using SSH port forwarding as previously said):
 
+
<pre><nowiki>
 +
sqlplus sys as sysdba
 +
EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
 +
</nowiki></pre>
 
=== Packages ===
 
=== Packages ===
 
 
Apparently, here are 3 packages to select from:
 
Apparently, here are 3 packages to select from:
 
 
* oracle-xe - Oracle Database 10g Express Western European Edition
 
* oracle-xe - Oracle Database 10g Express Western European Edition
 
* oracle-xe-client - Oracle Client 10g Express Edition
 
* oracle-xe-client - Oracle Client 10g Express Edition
 
* oracle-xe-universal - Oracle Database 10g Express Universal Edition
 
* oracle-xe-universal - Oracle Database 10g Express Universal Edition
 
+
I copied the above information from [[UbuntuHelp:Oracle10gDapper|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.
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 ===
 
=== Installation Troubleshooting ===
 
 
NFS: see Requirements for NFS, above.
 
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.
 
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 ==
 
== See Also ==
 
Oracle How to Install on kubuntu : http://www.oracle.com/technology/tech/linux/install/xe-on-kubuntu.html
 
Oracle How to Install on kubuntu : http://www.oracle.com/technology/tech/linux/install/xe-on-kubuntu.html
 
+
[[UbuntuHelp:Oracle10gDapper|Oracle10gDapper]] - Oracle Express Edition 10g R2 / on Ubuntu Dapper 6.06 LTS
Oracle10gBreezy - Oracle 10g Enterprise / Standard Edition on Ubuntu 5.10 Breezy
+
RevTech Zero's Database Blog - Oracle 10g R2 / Enterprise / Standard on Ubuntu Gutsy Gibbon 7.10
 
+
http://revtech0.webonsites.com/blog.html
Oracle10gDapper - Oracle Express Edition 10g R2 / on Ubuntu Dapper 6.06 LTS
+
 
+
Dizwell's Installing 10g on Ubuntu Breezy and Dapper: http://www.dizwell.com/prod/node/52
+
Dizwell's guide was tested and worked on an AMD64 machine with Ubuntu Breezy (Server)
+
with small corrections related to 32bit libs 
+
 
+
 
http://mapopa.blogspot.com/2006/03/installing-oracle-on-ubuntu-breezy.html
 
http://mapopa.blogspot.com/2006/03/installing-oracle-on-ubuntu-breezy.html
 
+
Oracle FAQ, Forum, Wiki, etc. at http://www.orafaq.com/
CategoryDocumentation CategoryCleanup
+
[http://www.makina-corpus.org/blog/how-install-oracle-10g-full-64-bits-version-not-xe-and-tora-gnu-linux-ubuntu-karmic-910-64-bits Howto install Oracle 10g (enterprise or standard edition) on Ubuntu 64 bits]
 +
[http://www.excession.org.uk/blog/installing-oracle-on-ubuntu-karmic-64-bit.html Another Howto install Oracle 10g on Ubuntu Karmic 64 bits]
 +
[http://www.pythian.com/search/?cx=005457393276797549686%3Apirdakzaqhq&cof=FORID%3A10&ie=UTF-8&submit=Submit+your+search&q=ubuntu#875 Pythian Oracle and Ubuntu Howto]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2010年5月19日 (三) 23:49的最新版本

<<Include(Tag/StyleCleanup)>>

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:

Version Release Name Comments
6.10 Edgy
8.04 Hardy LTS
9.10 Karmic
10.04 Lucid

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. The 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 It is also possible to use the administration console remotely, even if it's not recommended for security reasons (better using SSH port forwarding as previously said):

sqlplus sys as sysdba
EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

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/ Howto install Oracle 10g (enterprise or standard edition) on Ubuntu 64 bits Another Howto install Oracle 10g on Ubuntu Karmic 64 bits Pythian Oracle and Ubuntu Howto