Ubuntu安裝Oracle XE

來源:互聯網
上載者:User

Ubuntu不支援Oracle,網上教程太複雜,總是出錯.後來找到個能裝XE的就裝了,Oracle Database 10g Express Edition requires 1006 MB of swap space

  1. echo "deb http://oss.oracle.com/debian/ unstable main non-free" >> /etc/apt/sources.list   
  2. apt-get update   
  3. apt-get install oracle-xe-client    
  4. apt-get install oracle-xe   
  5. sh /etc/init.d/oracle-sh configure   
  6. vim /etc/default/oracle-xe  

You can always disable Oracle XE startup in boot time with (no update-rc.d method here ;-) ):

chmod -x /etc/init.d/oracle-xe  

The alernative way to the same is to edit /etc/default/oracle-xe and change:

  1. #ORACLE_DBENABLED=true  
  2. ORACLE_DBENABLED=false  

Web console management
- If you have installed OracleXE database on remote *nix server, you can easily setup a ssh tunnel in order to gain access to a web administration console (since web console is bound to loopback device and therefore unavailable outside to the network):

$ ssh oracle-xe-server -L 8081:localhost:8080

While keeping this proces running (or keep it on background via `screen` or `nohup`), you may now login to Oracle XE web administrations console on your local computer: http://localhost:8081/apex/. Please notice that your ssh daemon on your local computer should allow TCP forwarding: AllowTcpForwarding yes in your sshd configuration file.
SQL Remote connection management
- By default OracleXe installation does not allow sql network connections to your XE database. To enable it, logon to web management console and enable "Remote connections": "Administration->enable "Available from local server and remote clients"-> press "Apply Changes". The same procedure can also be done from the commandline:

$ sqlplus -S system/password@//localhost/XE <<!
EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
EXIT;
/
!

If your SQL client uses a Oracle Instant client installation, the SQL connection can be obtained by entering:

[atrakic@adm2-43 ~]$ sqlplus username/password@//oraclexe.hostname.or.ip//XE

If somewhat connection is refused (due to firewall restrictions) you can use same ssh trick as done previously:

$ ssh oracle-xe-server -L 1512:localhost:1512  

where your sql connection should be like this:

atrakic@adm2-43 ~]$ sqlplus username/password@//localhost//XE  

User management
Add user
- In order to add single sql user with non-dba privilages to OracleXE execute following commands:

  1. --   
  2. -- Contents of: this_script.sql   
  3. --   
  4. CREATE USER myuser IDENTIFIED BY the_password DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON users;   
  5. CREATE ROLE myconnection;   
  6. GRANT CREATE session, CREATE table, CREATE view, CREATE procedure, CREATE synonym TO myconnection;   
  7. GRANT myconnection TO myuser;   
  8. /  

You can run this SQL script with:

  1. # su - oracle    
  2. oracle@server:~$ sqlplus / as sys   
  3. SQL> @this_script.sql   
  4. SQL> exit;  

Alternatively use web managment console to add new Oracle XE users accordingly.
Delete user
- For deleting a sql users from OracleXE use web management console or execute following commands from the commandline:

  1. # su - oracle    
  2. oracle@server:~$ sqlplus / as sys   
  3. SQL> drop user myuser cascade;   
  4. SQL>exit;  

ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/
可在命令列建立資料表空間。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.