您好,登錄后才能下訂單哦!
Oracle安裝之簡單篇
安裝準(zhǔn)備包
linuxredhat5.8操作系統(tǒng)
oracle11g(以下是包名)
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
安裝準(zhǔn)備
配置IP,hosts,主機名。
備注hosts文件一定要與主機名對應(yīng)。(如下)
127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 192.168.66.249 dbserver.cjl.com
配置oracle環(huán)境腳本
#!/bin/bash #查看內(nèi)存大小 echo "Mem Check:swap >2G,MEM >2G" grep -i memtotal /proc/meminfo grep -i swaptotal /proc/meminfo #配置yum本地源 cat <<END >/etc/yum.repos.d/rhel.repo [local] [local]cal baseurl=file:///mnt/Server/ enabled=1 gpgcheck=0 END #掛載光盤并安裝插件 mount /dev/cdrom /mnt yum -y groupinstall "Development Tools" yum -y install binutils compat-libstdc++-33 elfutils-* gcc gcc-c++* glibc* kernel-headers ksh libaio* libgcc #配置路由 cat <<END >> /etc/sysctl.conf fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 536870912 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 END sysctl -p #創(chuàng)建用戶組和用戶并授權(quán) groupadd -g 500 oinstall groupadd -g 501 dba useradd -g oinstall -G dba oracle echo "123123" |passwd --stdin oracle mkdir /opt/oracle chown -R oracle:oinstall /opt/oracle chmod -R 775 /opt/oracle sudo mkdir /opt/tmp sudo chmod a+rw /opt/tmp #添加用戶環(huán)境變量 cat <<END >>/home/oracle/.bash_profile umask 022 export ORACLE_BASE=/opt/oracle export ORACLE_HOME=\$ORACLE_BASE/product/11.2/db_1 export ORACLE_SID=orcl export LANG=zh_CN.UTF-8 export NLS_LANG="AMERICAN_AMERICA".ZHS16GBK export PATH=\$PATH:\$ORACLE_HOME/bin export DISPLAY=:0.0 END #添加認(rèn)證模塊 cat <<END >>/etc/pam.d/login session required /lib64/security/pam_limits.so session required pam_limits.so END #設(shè)置oracle限制 cat <<END >>/etc/security/limits.conf oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 END #oracle軟堆棧限制 cat <<END >>/etc/profile if [ $USER = "oracle" ];then if [ \$SHELL = "/bin/ksh" ];then ulimit -p 16384 ulimit -p 65536 else ulimit -u 16384 -n 65536 fi fi END
解壓Oracle11g的包到oracle用戶的home目錄
unzip -d /home/oracle linux.x64_11gR2_database_1of2.zip && unzip -d /home/oraclelinux.x64_11gR2_database_2of2.zip
允許用戶oracle從本機訪問
[root@dbserver ~]# xhost + access control disabled, clients can connect from any host
切換用戶并進入解壓目錄運行安裝
[root@dbserver ~]# su - oracle [oracle@dbserver ~]$ ls database [oracle@dbserver ~]$ cd database/ [oracle@dbserver database]$ ./runInstaller
運行root用戶執(zhí)行提示腳本
[root@dbserver ~]# /opt/oracle/oraInventory/orainstRoot.sh 更改權(quán)限/opt/oracle/oraInventory. 添加組的讀取和寫入權(quán)限。 刪除全局的讀取, 寫入和執(zhí)行權(quán)限。 更改組名/opt/oracle/oraInventory 到 oinstall. 腳本的執(zhí)行已完成。 [root@dbserver ~]# /opt/oracle/product/11.2/db_1/root.sh Running Oracle 11g root.sh script... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /opt/oracle/product/11.2/db_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.sh script. Now product-specific root actions will be performed. Finished product-specific root actions. [root@dbserver ~]#
訪問以上地址測試https://dbserver.cjl.com:1158/em/
oracle用戶訪問測試
[oracle@dbserver database]$ sqlplus sys as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 18 05:28:47 2015 Copyright (c) 1982, 2009, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> show user; USER is "SYS" SQL>
圖形界面添加數(shù)據(jù)庫
如果重新啟動還需web訪問可用以下命令重新獲取網(wǎng)址
[oracle@dbserver ~]$ emctl start dbconsole Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0 Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved. https://dbserver.cjl.com:1158/em/console/aboutApplication Starting Oracle Enterprise Manager 11g Database Control ........ started. ------------------------------------------------------------------ Logs are generated in directory /opt/oracle/product/11.2/db_1/dbserver.cjl.com_orcl/sysman/log
如果發(fā)現(xiàn)不能使用dbca命令時試試它
[oracle@dbserver ~]$ /opt/oracle/product/11.2/db_1/bin/dbca Xlib: connection to ":0.0" refused by server Xlib: No protocol specified [root@dbserver ~]# xhost + access control disabled, clients can connect from any host
啟動數(shù)據(jù)庫先啟動監(jiān)聽
[oracle@dbserver ~]$ lsnrctl LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-SEP-2015 05:07:44 Copyright (c) 1991, 2009, Oracle. All rights reserved. Welcome to LSNRCTL, type "help" for information. LSNRCTL> start Starting /opt/oracle/product/11.2/db_1/bin/tnslsnr: please wait... TNSLSNR for Linux: Version 11.2.0.1.0 - Production System parameter file is /opt/oracle/product/11.2/db_1/network/admin/listener.ora Log messages written to /opt/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver.cjl.com)(PORT=1521))) Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production Start Date 18-SEP-2015 05:07:50 Uptime 0 days 0 hr. 0 min. 0 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /opt/oracle/product/11.2/db_1/network/admin/listener.ora Listener Log File /opt/oracle/diag/tnslsnr/dbserver/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver.cjl.com)(PORT=1521))) The listener supports no services The command completed successfully LSNRCTL> quit [oracle@dbserver ~]$ sqlplus sys as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Fri Sep 18 05:08:12 2015 Copyright (c) 1982, 2009, Oracle. All rights reserved. Enter password: Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 839282688 bytes Fixed Size 2217992 bytes Variable Size 541067256 bytes Database Buffers 289406976 bytes Redo Buffers 6590464 bytes Database mounted. Database opened. SQL> show user; USER is "SYS" SQL> alter database open; alter database open * ERROR at line 1: ORA-01531: a database already open by the instance SQL> quit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
關(guān)閉數(shù)據(jù)庫
shutdown immediate
shutdown abort (上一條關(guān)閉不能執(zhí)行,則執(zhí)行這條強制關(guān)機)
關(guān)閉監(jiān)聽
lsnrctl stop
本文如出現(xiàn)錯誤請留言!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。