There're many articles that described how to install Oracle on the Linux, so this article is a work log. I wrote it because I met several problems, one of them is I can't create the DB via dbca. I installed Oracle on the real box and the virtual box more than 3 times to find out where's wrong, but I got nothing. So I have no choice except to create the DB manually.
My real server is headless which runs Ubuntu 7.0.4 server. And I want to install the oracle remotely, so ssh + x11-forward is the best choice.
Install software
0. software
oracle 10g for linux ubuntu server 7.0.4 xming putty
1. Update ubuntu
sudo apt-get update sudo apt-get upgrade
2. install the development environment and libraries
sudo apt-get install build-essential sudo apt-get install xauth libxp6 libxt6 libxtst6 sudo apt-get install libaio1
sudo apt-get install libstdc++5
The whole x-windows is not necessary, some articles said that we should install the x-windows and WM, it's probably not a good idea to install these software only for installing another software. Note: xauth makes x11-forward work, libaio1 makes sqlplus work, libstdc++5 makes liborasdkbase.so.10.2 work(ubuntu 8.04.1).
3. add user oracle and group dba
sudo groupadd dba sudo useradd -m -g dba oracle sudo passwd oracle su - oracle cat > .bash_profile << EOF export ORACLE_HOME=/home/oracle/product/10.2.0 export ORACLE_SID=orcl export PATH=$PATH:$ORACLE_HOME/bin EOF exit
4. set the system parameters
sudo cat > /etc/sysctl.conf << EOF kernel.shmmax = 3147483648 kernel.shmmni = 4096 kernel.shmall = 2097152 kernel.sem = 250 32000 100 128 fs.file-max = 65536 net.ipv4.ip_local_port_range = 1024 65000 EOF sudo sysctl -p sudo cat > /etc/security/limits.conf << EOF oracle soft nofile 65536 oracle hard nofile 65536 oracle soft nproc 16384 oracle hard nproc 16384 EOF
5. upload the oracle 10g to the server and unpack.
6. configure the putty to enable x11-forward. The next lines should be uncommented in /etc/ssh/sshd_config:
X11Forwarding yes X11DisplayOffset 10
7. connect the server, the environment variable DISPLAY shoule be set
DISPLAY=localhost:10.0
8. run installer
su - oracle $ /where_oracle_media/runInstaller
choice custom install, not create DB. Maybe there's an error: libagtsh.so: undefined reference to 'nnfyboot', run the next commands:
export ORACLE_HOME=/home/oracle/product export LD_LIBRARY_PATH=$ORACLE_HOME/lib sudo ln -s /usr/bin/basename /bin/basename sudo ln -s $ORACLE_HOME/lib/libclient10.a $ORACLE_HOME/lib/libagtsh.a sudo $ORACLE_HOME/bin/genagtsh $ORACLE_HOME/lib/libagtsh.so 1.0
9. create the startup file of oracle
sudo cat > /etc/init.d/oracle << EOF # startup of oracle 10.2.0 ORA_OWNR=oracle ORACLE_HOME=/home/oracle/product case "$1" in start) # Oracle listener and instance startup echo -n "Starting Oracle: " su - $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl start" su - $ORA_OWNR -c $ORACLE_HOME/bin/dbstart ;; stop) # Oracle listener and instance shutdown echo -n "Shutdown Oracle: " su - $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop" su - $ORA_OWNR -c $ORACLE_HOME/bin/dbshut ;; reload|restart) $0 stop $0 start ;; *) echo "Usage: `basename $0` start|stop|restart|reload" exit 1 esac exit 0 EOF sudo chmod +x /etc/init.d/oracle sudo ln -s /etc/init.d/oracle /etc/rc3.d/S99oracle sudo ln -s /etc/init.d/oracle /etc/rc1.d/K09oracle sudo ln -s /etc/init.d/oracle /etc/rc0.d/K09oracle
Create DB
1. become user oracle
su - oracle mkdir oradata/orcl
2. make a copy of init.ora in $ORACLE_HOME/dbs
cp $ORACLE_HOME/dbs/init.ora $ORACLE_HOME/dbs/initorcl.ora vi $ORACLE_HOME/dbs/initorcl.ora
change db_name to oracle_sid such as orcl
change shared_pool_size to 64M
change control_files to the absolute path such as /home/oracle/oractl/control1, two files at least
add the next line:
undo_management=auto
3. run sql script to create DB
# connect SYS/change_on_install as SYSDBA connect SYS/admin as SYSDBA set echo on spool CreateDB.log startup nomount pfile="/home/oracle/product/dbs/initorcl.ora" CREATE DATABASE orcl USER SYS IDENTIFIED BY admin USER SYSTEM IDENTIFIED BY admin LOGFILE GROUP 1 ('/home/oracle/oradata/orcl/redo01a.log') SIZE 10M, GROUP 2 ('/home/oracle/oradata/orcl/redo02a.log') SIZE 10M, GROUP 3 ('/home/oracle/oradata/orcl/redo03a.log') SIZE 10M MAXINSTANCES 1 MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 3276 MAXDATAFILES 100 MAXLOGHISTORY 1 CHARACTER SET ZHS16GBK NATIONAL CHARACTER SET AL16UTF16 DATAFILE '/home/oracle/oradata/orcl/system_01.dbf' SIZE 512M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SYSAUX DATAFILE '/home/oracle/oradata/orcl/sysaux_01.dbf' SIZE 120M REUSE AUTOEXTEND OFF DEFAULT TEMPORARY TABLESPACE temp TEMPFILE '/home/oracle/oradata/orcl/temp_01.dbf' SIZE 512M REUSE AUTOEXTEND OFF DEFAULT TABLESPACE users DATAFILE '/home/oracle/oradata/orcl/users_01.dbf' SIZE 64M REUSE AUTOEXTEND OFF EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO UNDO TABLESPACE undo DATAFILE '/home/oracle/oradata/orcl/undo_01.dbf' SIZE 1024M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED; spool off exit;
4. initialize DB
connect SYS/admin as SYSDBA @$ORACLE_HOME/rdbms/admin/catalog.sql @$ORACLE_HOME/rdbms/admin/catproc.sql exit
5. create a test user
connect SYS/admin as SYSDBA CREATE USER ora IDENTIFIED BY pwd DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp; GRANT CONNECT, RESOURCE TO ora; CONNECT ora/pwd CREATE TABLE test(name varchar(32)); INSERT INTO test VALUES('ora'); SELECT * FROM test; exit;
Finished!