Linux版本CentOS 6.3OS環境VMware Workstation9.0.0 build-812388oracle安裝檔案位置: G:\Program Files\Red Hat Enterprise Linux 4\Exchange Data\ORACLE\oracle-xe-10.2.0.1-1.0.i386.rpm
1 Down Load RPM from following location
http://www.oracle.com/technetwork/products/express-edition/downloads/index.html
2 Installing oracle rpm package
rpm -ivh oracle-xe-10.2.0.1-1.0.i386.rpm
3 Configuring Oracle DB
#su root#/etc/init.d/oracle-xe configure
set up as following (set up port listener and so on)
Oracle Database 10g Express Edition Configuration-------------------------------------------------This will configure on-boot properties of Oracle Database 10g ExpressEdition. The following questions will determine whether the database shouldbe starting upon system boot, the ports it will use, and the passwords thatwill 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]:7070Specify a port that will be used for the database listener [1521]:Specify a password to be used for database accounts. Note that the samepassword will be used for SYS and SYSTEM. Oracle recommends the use ofdifferent passwords for each database account. This can be done afterinitial configuration:Password can't be null. Enter password:Confirm the password:Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:Starting Oracle Net Listener...DoneConfiguring Database...DoneStarting Oracle Database 10g Express Edition Instance...DoneInstallation Completed Successfully.To access the Database Home Page go to "http://127.0.0.1:7070/apex"
Oracle basic info:
ORACLE_BASE=/usr/lib/oracle/xe/app/oracle;ORACLE_HOME=$ORACLE_BASE/product/10.2.0/server;
--------------------------------------------
data檔案位置
/usr/lib/oracle/xe/oradata/XE
-rw-r----- 1 oracle dba 7061504 Feb 16 12:42 control.dbf
-rw-r----- 1 oracle dba 230694912 Feb 16 12:29 sysaux.dbf
-rw-r----- 1 oracle dba 356524032 Feb 16 12:34 system.dbf
-rw-r----- 1 oracle dba 20979712 Feb 16 05:03 temp.dbf
-rw-r----- 1 oracle dba 220209152 Feb 16 12:39 undo.dbf
-rw-r----- 1 oracle dba 104865792 Feb 16 04:30 users.dbf
把個人使用者home目錄下的.bashrc 和.bash_profile拷貝到ORACLE_BASE目錄下
cp /root/.bashrc /usr/lib/oracle/xe/app/oracle/.bashrc
cp /root/.bash_profile /usr/lib/oracle/xe/app/oracle/.bash_profile
改變檔案所屬
# chown oracle .bash_profile# chown oracle .bashrc# chmod 755 .bash_profile# chmod 755 .bashrc
設定環境變數
#vi /etc/profile # Oracle SettingsTMP=/tmp; export TMPTMPDIR=$TMP; export TMPDIRORACLE_BASE=/usr/lib/oracle/xe/app/oracle; export ORACLE_BASEORACLE_HOME=$ORACLE_BASE/product/10.2.0/server/bin/oracle; export ORACLE_HOMEORACLE_SID=XE; export ORACLE_SIDORACLE_TERM=xterm; export ORACLE_TERMPATH=/usr/sbin:$PATH; export PATHPATH=$ORACLE_HOME/bin:$PATH; export PATHTNS_ADMIN=$ORACLE_HOME/network/adminLD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATHCLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATHif [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fifi
初始化資料庫:
# su oraclecd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/dbs/cp init.ora initXE.oravi initXE.ora
db_name='XE'memory_target=1Gprocesses = 150audit_file_dest='/usr/lib/oracle/xe/app/oracle/admin/XE/adump'audit_trail ='db'db_block_size=8192db_domain=''#db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'#db_recovery_file_dest_size=2Gdiagnostic_dest='/usr/lib/oracle/xe/app/oracle'dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'open_cursors=300remote_login_passwordfile='EXCLUSIVE'undo_tablespace='UNDOTBS1'# You may want to ensure that control files are created on separate physical# devicescontrol_files = ('/usr/lib/oracle/xe/oradata', '/usr/lib/oracle/xe/oradata')compatible ='10.2.0'
#su oraclesqlplus /nolog
SQL> connect sys/cici123love as sysdba
SQL> startup mount
10g xe版本已經內建了一個設定好的資料庫 XE, 因此不許要手動建立資料庫,但是需要初始化資料庫結構
運行一下兩行代碼:
SQL> @/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/admin/catalog.sqlSQL> @/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/admin/catproc.sql
接下來建立使用者,初始資料庫中應當已經存在users表,因此直接插入資料就可以了:
SQL> create user cici identified by "xxxx";SQL> grant dba to cici;
以該使用者身份登入
SQL>existSQL>conn cici/cici123love
插表以及資料並且測試:
SQL> create table test_table (txt varchar2(100) not null);SQL> insert into test_table values('Hello world !');SQL> select * from test_table;
=====================Potential Issue==========================
1 database didn‘t open
則需要重新啟動並裝載資料庫
參見 http://www.cnblogs.com/cici-new/archive/2013/02/16/2913697.html
2 ora-01033 oracle initialization or shutdown in progressreferences
http://www.cnblogs.com/cici-new/archive/2013/02/16/2913689.html
====================參考文章==================================
http://blog.csdn.net/reda0821/article/details/7816562