oracle11g 最終版本11 2 0 4安裝詳細過程
--安裝背景
上次碰到問題,cursor:mutex S導致的load過高,參考原來剖析額過程記錄地址:http://blog.csdn.net/mchdba/article/details/51299062 , 有說可以升級到11.2.0.4就能避免這種問題,所以準備重新搭建新版本11.2.0.4。
安裝環境是:azure雲 linux centos6.5。
2017-11-22 補充:有很多網友留言、發站內訊息、以及email,要oracle11.2.0.4下載地址,這裡特提供下地址,大家可以下載:連結: https://pan.baidu.com/s/1dEFtcwp 密碼: 44yv
2018-09-21 補充:有很多網友留言說,上面的連線失效,特重新生成了分享連線地址,連結: https://pan.baidu.com/s/1S-c_DZcWwARO6-sxRUK3pQ 提取碼: w6zu
1,修改核心
1.1 修改sysctl.conf檔案
[[email protected] Downloads]# vim/etc/sysctl.conf
# add by tim.man kernel.shmmax = 277495689510912 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048586 fs.file-max = 6815744 # Controls the maximum number of shared memory segments, in pages kernel.shmall = 4294967296 net.ipv4.tcp_max_tw_buckets = 6000 net.ipv4.ip_local_port_range = 9000 65500 net.ipv4.tcp_tw_recycle = 0 net.ipv4.tcp_tw_reuse = 1 net.core.somaxconn = 262144 net.core.netdev_max_backlog = 262144 net.ipv4.tcp_max_orphans = 262144 net.ipv4.tcp_max_syn_backlog = 262144 net.ipv4.tcp_synack_retries = 2 net.ipv4.tcp_syn_retries = 1 net.ipv4.tcp_fin_timeout = 1 net.ipv4.tcp_keepalive_time = 30 net.ipv4.tcp_keepalive_probes = 6 net.ipv4.tcp_keepalive_intvl = 5 net.ipv4.tcp_timestamps = 0 fs.aio-max-nr = 1048576 |
1.2 使引數生效
[[email protected] Downloads]# sysctl –p
2,增加使用者和組
[[email protected]]# groupadd oinstall
[[email protected]]# groupadd dba
[[email protected]]# groupadd oper
[[email protected]]# useradd -g oinstall -G dba,oper oracle
[[email protected]]# passwd oracle
3,修改limits.conf限制
[[email protected]]# vim /etc/security/limits.conf
oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 |
4,修改/etc/pam.d/login
[[email protected]]# vim /etc/pam.d/login
session required/lib64/security/pam_limits.so
5,修改bash_profile檔案
(1)修改profile:
[[email protected] Downloads]# vim /etc/profile # add by tim.man if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi |
(2)修改bash_profile:
[[email protected] ~]$ vim .bash_profile export EDITOR=vi export ORACLE_SID=doea5db export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1 export INVENTORY_LOCATION=/oraInventory export LD_LIBRARY_PATH=$ORACLE_HOME/lib export NLS_LANG="American_america.zhs16gbk" export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss' export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:$PATH:$HOME/bin umask 022 |
使bash_profile生效:
[[email protected] ~]$ source .bash_profile
6,建立目錄
[[email protected]~]# mkdir /data/oracle
[[email protected]~]# chown oracle:oinstall /data
[[email protected]_earth_dbm1_3_112 app]# mkdir /data/oracle [[email protected]_earth_dbm1_3_112 app]# mkdir /data/oraInventory [root[email protected]_earth_dbm1_3_112 app]# cd /oracle/app [[email protected]_earth_dbm1_3_112 app]# ln -s /data/oracle oracle [[email protected]_earth_dbm1_3_112 app]# ln -s /data/oraInventory oraInventory [[email protected]_earth_dbm1_3_112 app]# chown -R oracle.oinstall /data [[email protected]_earth_dbm1_3_112 app]# chown -R oracle.oinstall /oracle [[email protected]_earth_dbm1_3_112 app]# [[email protected] azure_earth_dbm1_3_112 oracle]# mkdir -p /oracle/app/oracle [[email protected] azure_earth_dbm1_3_112 oracle]# chown -R oracle:oinstall /oracle/app/oracle [[email protected] azure_earth_dbm1_3_112 oracle]# chmod -R 775 /oracle/app/oracle [[email protected] azure_earth_dbm1_3_112 oracle]# |
7,安裝rpms包
Rpm包安裝:rpm -ivh *--force –nodeps
Rpms安裝有時候不一定保證有效,可以再用yum安裝:
# 採用yum安裝,如下: yum install -y binutils* yum install -y compat-libstdc* yum install -y elfutils-libelf* yum install -y gcc* yum install -y glibc* yum install -y ksh* yum install -y libaio* yum install -y libgcc* yum install -y libstdc* yum install -y make* yum install -y sysstat* yum install libXp* -y yum install -y glibc-kernheaders # 檢查下lib是否安裝齊全: [[email protected] ~]# rpm -q --queryformat %-{name}-%{version}-%{release}-%{arch}"\n" \ compat-libstdc++-33 glibc-kernheaders glibc-headers libaio libgcc glibc-devel xorg-x11-deprecated-libs 如果缺少,就繼續安裝缺失的元件包。 |
8,安裝vnc
9,解壓縮
Oracle官網一般下載不到,需要使用者名稱密碼登入,大家如果需要這款Oracle軟體下載,歡迎在下面留言區留下你的email地址,我看到了會及時發給你的。
這裡只是準備部署dataguard,所以只需要安裝1of7和2of7這2個zip包即可。
unzipp13390677_112040_Linux-x86-64_1of7.zip
unzip p13390677_112040_Linux-x86-64_2of7.zip
解壓縮完,會看到一個database目錄。
10,vnc viewer遠端安裝
[[email protected]_earth_dbm1_3_112 ~]# exportDISPLAY=10.254.3.112:1.0
[[email protected]_earth_dbm1_3_112 ~]# xhost +
access control disabled, clients canconnect from any host
[[email protected]_earth_dbm1_3_112 ~]#
[[email protected]_earth_dbm1_3_111 database]$./runInstaller
"You are attempting to install 64-bitOracle on a 32-bit operating system. This is not supported and will not work."
[[email protected]_earth_dbm1_3_111 database]$vim runInstaller
# 註釋掉exit 126即可
if [ `$UNAME` = "Linux" ]; then
if [ -e $GETCONF ]; then
value=`$GETCONF LONG_BIT`
if [ $value != 64 ]; then
echo "\"You are attempting to install 64-bit Oracle on a32-bit operating system. This is notsupported and will not work.\"";
#exit 126; #corresponding to the exit code of oui
fi
fi
fi
然後再執行./runInstaller,會有如下介面,正式開始介面安裝oracle資料庫,選擇忽略軟體更新的提示,點選next下一步,如下圖01.png:
之後選擇單例項資料庫安裝,如02.png所示:
從左面的可用語言裡面選擇UK、SC、TC,如下03.png所示:
之後選擇企業版本4.7GB,如下04.png所示:
下面的oraclebase根目錄以及軟體目錄,都預設不需要設定(當然如果你要改路徑也是可以的),預設後直接next下一步,如05.png:
接下來在oraInventorygroup name的時候選擇oinstall,如08.png所示next下一步:
在databaseadministrator group上選擇dba,在databaseoperator group上面選擇oper,然後net下一步,如009.png所示:
然後,執行checksoracle基礎元件,如果有libaio、compat的提示,直接IgnoreAll即可,next下一步如010.png所示:
然後選擇install安裝,開始安裝oracle軟體,如011.png所示:
之後進入安裝介面,會有進度條%顯示,如012.png所示:
如果安裝完成,會彈出ExecuteConfiguration scripts所示,選擇OK完成oracle軟體安裝,如013.png所示:
之後,看到oracle安裝到最好一步Finish,選擇close結束,如014.png所示:
11,執行dbca初始化指令碼:
以root身份執行orainstRoot.sh和root.sh指令碼(注:執行完指令碼以後,在點選“ok”):
# 查詢檔案路徑 [[email protected]_earth_dbm1_3_111 database]$ find /data/ -name orainstRoot.sh /data/oraInventory/orainstRoot.sh [[email protected]_earth_dbm1_3_111 database]$ find /data/ -name root.sh /data/oracle/product/11.2.0/dbhome_1/inventory/Templates/root.sh /data/oracle/product/11.2.0/dbhome_1/root.sh [[email protected]_earth_dbm1_3_111 database]$ # 開始執行指令碼 [[email protected]_earth_dbm1_3_111 soft]# sh /data/oraInventory/orainstRoot.sh Changing permissions of /oracle/app/oraInventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /oracle/app/oraInventory to oinstall. The execution of the script is complete. [[email protected]_earth_dbm1_3_111 soft]# [[email protected]_earth_dbm1_3_111 soft]# sh /data/oracle/product/11.2.0/dbhome_1/root.sh Performing root user operation for Oracle 11g The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /oracle/app/oracle/product/11.2.0/dbhome_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Finished product-specific root actions. [[email protected]_earth_dbm1_3_111 soft]# |
12,netca建立oracle監聽
在shell命令列sudo – oracle,然後執行netca命令,出現如下介面,選擇預設的listener configure配置,如下015.png:
然後選擇Add,新增新的監聽,如016.png:
預設監聽名字為LISTENER,然後next下一步如017.png所示
然後繼續next下一步,如018.png所示:
埠選擇預設的1521,然後next下一步如019.png所示:
Ok,listener新增完畢,點選cancel退出,如020.png所示:
13,vnc遠端dbca安裝oracle資料庫例項
[[email protected]_earth_dbm1_3_112 ~]# exportDISPLAY=192.168.3.112:1.0
[[email protected]_earth_dbm1_3_112 ~]# xhost +
access control disabled, clients canconnect from any host
[[email protected]_earth_dbm1_3_112 ~]#
[[email protected]_earth_dbm1_3_111 database]$ dbca
dbca後出現oracle例項安裝介面,如下所示,選擇第一個,然後next如021.png所示:
選擇建立資料庫,然後next下一步如022.jpg所示:
填寫全域性例項名和SID,這裡預設是一樣的powerdes,然後next如024.jpg所示:
之後下一步預設,如025.jpg所示:
設定統一的sys密碼,如026.jpg、027.png所示所示:
選擇用本地的資料檔案模版地址:如028.jpg所示:
之後配置快閃記憶體區和歸檔,如029.jpg所示:
選擇模版schemas,如030.jpg所示:
配置sga、pga,預設是40%,這裡因為是專用的db伺服器,可以調整到70%,如031.png所示:
然後選擇連線數,預設是150,基本不夠用,這裡可以設定為5000,如032.png所示:
然後選擇字符集,設定16GBK,如033.png所示:
然後出現Data Store,看到一些檔案以及儲存引數,如034.jpg所示:
然後選擇CreateDatabase和GenerateDatabase Creation Scripts,開始create,如035.jpg所示:
之後,跳出確認資訊介面,點選ok確認,如036.jpg所示:
之後看到配置介面,提示scripts建立成功了,點選ok,如037.jpg所示:
再之後出現的是建立db的介面,建立資料檔案,如038.jpg所示:
然後開始建立資料檔案,這個時間比較漫長,主要看磁碟寫入速度,如果是ssd磁碟,幾分鐘就結束了,如果是普通磁碟估計要至少一個小時左右吧,之後建立資料檔案結束後,oracle資料庫例項就建立完成了,如039.jpg所示:
14,修改啟動引數開啟歸檔和閃回
# 修改spfile引數 SQL> alter system set log_archive_dest_1='location=/doea5/arch'; SQL> alter system set log_archive_format='arch_%t_%s_%r.log' scope=spfile; SQL> alter system set db_recovery_file_dest_size=20G scope=spfile; SQL> alter system set db_recovery_file_dest='/oracle/app/oracle/flash_recovery'; SQL> alter system set db_flashback_retention_target=10080 scope=spfile; SQL> alter system set undo_retention=10800; # 開啟歸檔和閃回 SQL> shutdown immediate SQL> startup mount SQL> alter database archivelog ; SQL> alter database flashback on; SQL> alter database open; |
OK,至此,oracle11g2.0.4順利圓滿安裝完成了。
如果一直報“xhost: unable to open display”,而且沒有其它辦法解決,可以嘗試下面的途徑:
[[email protected] ~]# export DISPLAY=10.251.3.31:1.0[[email protected] ~]# xhost +xhost: unable to open display "10.251.3.31:1.0"[[email protected] ~]# [[email protected] ~]# [[email protected] ~]# export DISPLAY=pddbnew:1.0[[email protected] ~]# xhost +xhost: unable to open display "pddbnew:1.0"[[email protected] ~]#
解決方式:
執行命令: export DISPLAY=:1.0執行命令:xdpyinfo
(ps:xdpyinfo命令會出來一堆資訊)執行命令:xhost +