安裝Oracle 11g

來源:互聯網
上載者:User

標籤:oracle資料庫

前提:

1. yum 源

2. 保證網上的ip地址為靜態

3. ip地址與主機名稱寫入/etc/hosts

vim /etc/hosts-->192.168.159.129? ? centos6

4. oracle安裝包database解壓並放置到/root下。

軟體包:p13390677_112040_Linux-x86-64_1of7.zip,p13390677_112040_Linux-x86-64_2of7.zip,pdksh-5.2.14-30.x86_64.rpm,rlwrap-0.37-1.el6.x86_64.rpm

1、安裝VMware Tools

掛載/media/VMware Tools,df查看

cd /media/VMware\ Tools/-->ls

tar xvf?VMwareTools-10.0.0-2977863.tar.gz -C /tmp? #解壓縮

cd /tmp/vmware-tools-distrib/

./vmware-install.pl? #運行指令碼

reboot? ? ?#重啟

2、安裝oracle

①unzip p13390677_112040_Linux-x86-64_1of7.zip;unzip p13390677_112040_Linux-x86-64_2of7.zip? #解壓縮

②vim orainst_11g.sh

#!/bin/bash

PKG="

unixODBC

unixODBC-devel

binutils

compat-libstdc++-33

elfutils-libelf

elfutils-libelf-devel

elfutils-libelf-devel-static

gcc

gcc-c++

glibc

glibc-common

glibc-devel

glibc-headers

kernel-headers

ksh

libaio

libaio-devel

libgcc

libgomp

libstdc++

libstdc++-devel

make

numactl-devel

sysstat

"

PACKINSTALL=

for PACKAGE in $PKG ;do

? ? rpm -q $PACKAGE || PACKINSTALL="$PACKINSTALL $PACKAGE"

done

echo

if [ -z "$PACKINSTALL" ];then

? ? ? ? ?true

? ?else

? ?echo "The followling packages will be install: $PACKINSTALL "

? ?read -p "Continue? (y/N): " answer

? ?case $answer in

? ? ? ? ([yY]|[Yy][Ee][Ss])

? ? ? ? ? ? ?echo 1

? ? ? ? ? ? ?yum -y install $PACKINSTALL ;;

? ? ? ? (*);;

? ?esac

fi

cat /etc/group |grep oinstall &> /dev/null || /usr/sbin/groupadd oinstall

cat /etc/group |grep dba &> /dev/null || /usr/sbin/groupadd dba

id oracle &> /dev/null?

? ? ? ? if [ $? = 0 ];then

? ? ? ? ?groups oracle | grep dba &> /dev/null || /usr/sbin/usermod -g oinstall -G dba oracle

? ? ? ? else

? ? ? ? ?/usr/sbin/useradd -g oinstall -G dba oracle

? ? ? ? ?echo oracle |passwd --stdin oracle

? ? ? ? fi

KELNUM=$(cat /etc/sysctl.conf |grep -v ^# |grep -v ^$ |grep -E "fs.aio-max-nr|fs.file-max|kernel.shmall|kernel.shmmax|kernel.shmmni|kernel.sem|net.ipv4.ip_local_port_range|net.core.rmem_default|net.core.rmem_max|net.core.wmem_default|net.core.wmem_max" |awk ‘{print $1}‘ |sort -u |wc -l )

if [ $KELNUM -lt 11 ];then

cat >> /etc/sysctl.conf <<EOF

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 = 1048586

EOF

/sbin/sysctl -p

fi

grep oracle /etc/security/limits.conf &> /dev/null?

? if [ $? != 0 ];then

cat >> /etc/security/limits.conf << EOF

oracle? ? ? ? ? ? ? soft? ? nproc? ?2047

oracle? ? ? ? ? ? ? hard? ? nproc? ?16384

oracle? ? ? ? ? ? ? soft? ? nofile? 1024

oracle? ? ? ? ? ? ? hard? ? nofile? 65536

oracle? ? ? ? ? ? ? soft? ? stack? ?1024

EOF

?fi

grep pam_limits.so /etc/pam.d/login &> /dev/null

? if [ $? != 0 ];then

cat >> /etc/pam.d/login <<EOF

session required pam_limits.so

EOF

? fi

[ -d /u01/app ] || ( mkdir -p /u01/app/ ; chown -R oracle:oinstall /u01/app/ ; chmod -R 775 /u01/app )

grep -i oracle ~oracle/.bash_profile &> /dev/null

? if [ $? != 0 ];then

cat >> ~oracle/.bash_profile <<EOF

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=\$ORACLE_BASE/11.2.0/db_1

export ORACLE_SID=orcl

export PATH=\$PATH:\$ORACLE_HOME/bin

EOF

? fi

xhost +

[ -d ~oracle/database ] || mv /root/database ~oracle?

cd ~oracle;su - oracle -c ‘database/runInstaller‘

bash ./orainst_11g.sh

③進入Oracle安裝介面

去掉I wish to receive security updates via My Oracle Surrport選項,點擊Next。

?


選擇Install database software only,點擊Next。

選擇Single instance database installation,點擊Next。

在Available Languages中點選English、Simplified Chinese,點擊兩個框中間的>,將選中的語言加入到右邊的Selected Languages中,然後點擊Next。

選擇企業版本。

填寫oracle的軟體路徑和基本路徑,如:

選擇dba組。

在這步驟之前,需要修改實體記憶體和安裝rpm -ivh?pdksh-5.2.14-30.x86_64.rpm,按照提示修改。

調整核心參數:vim /etc/sysctl.conf-->kernel.shmmax = 536870912-->sysctl -p 使其生效?

執行兩個指令碼,close結束。

④進入資料庫,進行建立

安裝需要在圖形介面(在控制台或者用CRT工具軟體)。開啟一個終端視窗,執行如下命令:dbca,如所示:

Database Configuration Assistant圖形介面啟動,如:

建立資料庫。

選擇第一個,下一步NEXT。

設定使用者名稱。

開啟1521監聽連接埠。

Enable Archiving?根據是否歸檔日誌的實際需求決定是否選擇。預設勾選。




之後點擊OK按鈕,開始建立資料庫,如所示:

資料庫建立完畢。


3、簡單驗證

sqlplus / as sysdba? #進入oracle資料庫

conn /as sysdba;? ? #串連使用者

alter user scott identified by tiger account unlock; #解鎖使用者

conn scott/tiger

SQL> select * from dept;? ?#列出所有列

? ? DEPTNO DNAME? ? ? ? ? LOC

---------- -------------- -------------

? ? ? ? 10 ACCOUNTING? ? ?NEW YORK

? ? ? ? 20 RESEARCH? ? ? ?DALLAS

? ? ? ? 30 SALES? ? ? ? ? CHICAGO

? ? ? ? 40 OPERATIONS? ? ?BOSTON


查看使用者下有哪些表

SQL> select * from tab;

TNAME? ? ? ? ? ? ? ? ? ? ? ? ? TABTYPE? CLUSTERID

------------------------------ ------- ----------

COUNTRIES? ? ? ? ? ? ? ? ? ? ? TABLE

DEPARTMENTS? ? ? ? ? ? ? ? ? ? TABLE

EMPLOYEES? ? ? ? ? ? ? ? ? ? ? TABLE

EMP_DETAILS_VIEW? ? ? ? ? ? ? ?VIEW

JOBS? ? ? ? ? ? ? ? ? ? ? ? ? ?TABLE

JOB_HISTORY? ? ? ? ? ? ? ? ? ? TABLE

LOCATIONS? ? ? ? ? ? ? ? ? ? ? TABLE

REGIONS? ? ? ? ? ? ? ? ? ? ? ? TABLE


8 rows selected.


安裝Oracle 11g

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.