1.軟件環境
OS:ubuntu-10.04-server-amd64(在線升級安裝了GNOME基本版本,詳見
Ubuntu Server 安裝圖形桌面環境
)
DB:10201_database_linux_x86_64.cpio.gz linux
apt-get install build-essential libaio1 gawk ksh libmotif3 alien libtool lsb-rpm x-window-system-core gdm ubuntu-desktop gnome-core xinit x11-utils
c++
2.ORACLE安裝環境準備
獲取root權限:
sudo su -
執行以下代碼:
apt-get install gcc gcc-multilib libaio1 libaio-dev lesstif2 lesstif2-dev libc6 libc6-dev-i386 libc6-dev-i386 libc6-i386 ia32-libs libelf-dev lsb-cxx make rpm build-essential unixODBC unixODBC-dev pdksh expat sysstat elfutils binutils binutils-dev binutils-source lesstif2 libc6 libc6-dev libmotif3 libstdc++6 alien
解決安裝過程當中出現"ctx/lib/ins_ctx.mk.."錯誤:
執行以下代碼: sql
http://security.ubuntu.com/ubuntu/pool/universe/g/gcc-3.3/
shell
cd /tmp
wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-17ubuntu1_amd64.deb
dpkg-deb -x libstdc++5_3.3.6-17ubuntu1_amd64.deb ia64-libs
cp ia64-libs/usr/lib/libstdc++.so.5.0.7 /usr/lib64/
cd /usr/lib64/
ln -s libstdc++.so.5.0.7 libstdc++.so.5
cd /tmp
wget http://mirrors.kernel.org/ubuntu/pool/universe/i/ia32-libs/ia32-libs_2.7ubuntu6.1_amd64.deb
dpkg-deb -x ia32-libs_2.7ubuntu6.1_amd64.deb ia32-libs
cp ia32-libs/usr/lib32/libstdc++.so.5.0.7 /usr/lib32/
cd /usr/lib32
ln -s libstdc++.so.5.0.7 libstdc++.so.5
cd /tmp
rm *.deb
rm -r ia64-libs
rm -r ia32-libs
3.創建軟連接解決一些安裝過程當中的錯誤信息
避免調用編譯文件時idg4odbc出現錯誤:
ln -s /usr/bin/basename /bin/basename
避免執行腳本root.sh出錯:
ln -s /usr/bin/awk /bin/awk
其餘太多相關的腳本以下:
ln -s /usr/bin/rpm /bin/rpm
ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so
4.更改配置
備份sysctl.conf
cp /etc/sysctl.conf /etc/sysctl.original
nano /etc/sysctl.conf
添加如下行到/etc/sysctl.conf中
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
vm.swappiness=5
更新系統運行:
sysctl -p
備份limits.conf
cp /etc/security/limits.conf /etc/security/limits.conf.original
nano /etc/security/limits.conf
添加如下行到/etc/security/limits.con中
#Oracle 10gR2 shell limits:
oracle soft nproc 2048
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
5.設置用戶和用戶組
咱們須要爲安裝程序建立一個oracle用戶和兩個組。
groupadd oinstall
groupadd dba
useradd -m -g oinstall -G dba oracle
usermod -s /bin/bash oracle
passwd oracle
groupadd nobody
usermod -g nobody nobody
執行以下代碼:
id oracle
顯示以下代碼:
uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1002(dba)
裏面的數字因系統緣由不必定相同
6.ORACLE安裝目錄準備及環境準備
咱們使得/opt/oracle爲安裝目錄
mkdir -p /opt/oracle
mkdir -p /opt/oraInventory
chown oracle:oinstall /opt/oracle
chown oracle:oinstall /opt/oraInventory
chmod 750 /opt/oracle
chmod 750 /opt/oraInventory
經過建立一個新文件/etc/redhat-release並添加如下行,欺騙安裝程序讓它覺得咱們
的系統是RedHat:
Red Hat Linux release 4.1
修改oracle環境
nano /home/oracle/.bashrc
增長以下代碼:
ORACLE_BASE=/opt/oracle
ORACLE_HOME=/opt/oracle/product/10.2.0/db_1
ORACLE_SID=km
export ORACLE_BASE ORACLE_HOME ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH:.
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export LD_LIBRARY_PATH CLASSPATH
alias sqlplus='rlwrap sqlplus'
7.ORACLE的安裝
將oracle安裝文件解壓獲得database文件夾,若是解壓詳見
linux下.cpio.gz文件的解壓
執行以下代碼:
chown -R oracle:oinstall /opt/soft/database
改變目錄權限前提是oracle爲文件同樣。若是不同使用你本身的目錄
退出系統以oracle用戶登錄進GDM環境,打開終端:
export LANG=en_CN
cd /opt/soft/database
./runInstaller
只要安裝軟件就好了。不要安裝示例數據庫
若是安裝過程當中出現以下錯誤:
引用
Error in invoking target 'collector' of makefile '/opt/oracle/10g/product/10.2.0/db_1/sysman/lib/ins_emdb.mk'.
請跳過.
安裝完成後,咱們完成後來解決上一錯誤:
cd $ORACLE_HOME/bin
mv oracle oracle.bin
cat >oracle <<"EOF"
#!/bin/bash
export DISABLE_HUGETLBFS=1
exec $ORACLE_HOME/bin/oracle.bin $@
EOF
chmod +x oracle
8.設置自啓動
建立自啓動腳本 建立 oracledb 腳本到/etc/init.d/oracledb,內容以下
獲取root權限:
sudo su -
nano /etc/init.d/oracledb
#!/bin/bash
#
# /etc/init.d/oracledb
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface
export ORACLE_HOME=/opt/oracle/product/10.2.0/db_1
export ORACLE_SID=km
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display
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"
touch /var/lock/oracle
su $ORA_OWNR -c "$ORACLE_HOME/bin/emctl start dbconsole"
echo "OK"
;;
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"
rm -f /var/lock/oracle
su $ORA_OWNR -c "$ORACLE_HOME/bin/emctl stop dbconsole"
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0
設置權限,放到啓動腳本中去
chmod 755 /etc/init.d/oracledb
update-rc.d oracledb defaults 99
還須要編輯一下/etc/oratab,把其中的N改爲Y,否則上述腳本中所調用的$ORACLE_HOME/bin/dbstart在執行時不會自動啓動相應的數據庫實例