linux下安装oracle

资源

下载自己操作系统对应的软件包:官网下载地址

配置内核参数

编辑  /etc/sysctl.conf 添加如下内容

fs.file-max = 6815744

kernel.sem = 250 32000 100 128

kernel.shmmni = 4096

kernel.shmall = 1073741824

kernel.shmmax = 4398046511104

kernel.panic_on_oops = 1

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

net.ipv4.conf.all.rp_filter = 2

net.ipv4.conf.default.rp_filter = 2

fs.aio-max-nr = 1048576

net.ipv4.ip_local_port_range = 9000 65500

更改当前内核参数

[root@localhost heweiwei]# sysctl -p

net.ipv4.ip_forward = 1

net.ipv4.conf.default.rp_filter = 1

net.ipv4.conf.default.accept_source_route = 0

kernel.sysrq = 0

kernel.core_uses_pid = 1

net.ipv4.tcp_syncookies = 1

error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key

error: "net.bridge.bridge-nf-call-iptables" is an unknown key

error: "net.bridge.bridge-nf-call-arptables" is an unknown key

kernel.msgmnb = 65536

kernel.msgmax = 65536

kernel.shmmax = 68719476736

kernel.shmall = 4294967296

fs.file-max = 6815744

kernel.sem = 250 32000 100 128

kernel.shmmni = 4096

kernel.shmall = 1073741824

kernel.shmmax = 4398046511104

kernel.panic_on_oops = 1

net.core.rmem_default = 262144

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 1048576

net.ipv4.conf.all.rp_filter = 2

net.ipv4.conf.default.rp_filter = 2

fs.aio-max-nr = 1048576

net.ipv4.ip_local_port_range = 9000 65500

限制oracle用户资源使用

编辑 /etc/security/limits.conf 添加如下内容

oracle  soft  nofile    1024

oracle  hard  nofile    65536

oracle  soft  nproc    16384

oracle  hard  nproc    16384

oracle  soft  stack    10240

oracle  hard  stack    32768

oracle  hard  memlock    134217728

oracle  soft  memlock    134217728

安装所有依赖

可以写个安装脚本

#!/bin/bash

yum install binutils -y

yum install compat-libcap1 -y

yum install compat-libstdc++-33 -y

yum install compat-libstdc++-33.i686 -y

yum install glibc -y

yum install glibc.i686 -y

yum install glibc-devel -y

yum install glibc-devel.i686 -y

yum install ksh -y

yum install libaio -y

yum install libaio.i686 -y

yum install libaio-devel -y

yum install libaio-devel.i686 -y

yum install libX11 -y

yum install libX11.i686 -y

yum install libXau -y

yum install libXau.i686 -y

yum install libXi -y

yum install libXi.i686 -y

yum install libXtst -y

yum install libXtst.i686 -y

yum install libgcc -y

yum install libgcc.i686 -y

yum install libstdc++ -y

yum install libstdc++.i686 -y

yum install libstdc++-devel -y

yum install libstdc++-devel.i686 -y

yum install libxcb -y

yum install libxcb.i686 -y

yum install make -y

yum install nfs-utils -y

yum install net-tools -y

yum install smartmontools -y

yum install sysstat -y

yum install unixODBC -y

yum install unixODBC-devel -y

创建oracle用户组

[root@localhost heweiwei]# groupadd -g 54321 oinstall

[root@localhost heweiwei]# groupadd -g 54322 dba

[root@localhost heweiwei]# groupadd -g 54323 oper

[root@localhost heweiwei]# useradd -u 54321 -g oinstall -G dba,oper oracle

修改设置SELINUX

将/etc/selinux/config 中 `SELINUX` 修改为permissive

[root@localhost oracle]# vim /etc/selinux/config

[root@localhost oracle]# setenforce Permissive

setenforce: SELinux is disabled

关闭防火墙

[root@localhost oracle]# service iptables stop

创建Oracle安装目录

[root@localhost oracle]# mkdir -p /usr/local/products/oracle12c

[root@localhost oracle]# chown -R oracle:oinstall /usr/local/products/

[root@localhost oracle]# chmod -R 775 /usr/local/products/

配置Oracle环境变量并验证

oracle用户名下,配置oracle用户下环境变量

[oracle@localhost ~]$ vim .bash_profile

export TMP=/tmp

export TMPDIR=$TMP

export ORACLE_HOSTNAME=localhost  // 注意要换成 /etc/hosts 中的用户

export ORACLE_UNQNAME=cdb1

export ORACLE_BASE=/usr/local/products

export ORACLE_HOME=$ORACLE_BASE/oracle12c

export ORACLE_SID=cdb1

export PATH=/usr/sbin:/usr/local/bin:$PATH

export PATH=$ORACLE_HOME/bin:$PATH

export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

[oracle@localhost ~]$ source .bash_profile

[oracle@localhost ~]$ echo $ORACLE_HOME

/usr/local/products/oracle12c

安装

我的目录/home下空间不够 所以我创建了/oracle目录(实际应该为/home/oracle目录),将官网下载的文件包解压

unzip linuxx64_12201_database.zip 我这里采用静态安装

./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion \

-showProgress -silent -responseFile/oracle/database/response/db_install.rsp\

oracle.install.option=INSTALL_DB_SWONLY \

UNIX_GROUP_NAME=oinstall \

INVENTORY_LOCATION=/usr/local/products/oracle12c/oraInventory \

ORACLE_HOME=/usr/local/products/oracle12c \

ORACLE_BASE=/usr/local/products \

oracle.install.db.InstallEdition=EE \

oracle.install.db.OSDBA_GROUP=dba \

oracle.install.db.OSBACKUPDBA_GROUP=dba \

oracle.install.db.OSDGDBA_GROUP=dba \

oracle.install.db.OSKMDBA_GROUP=dba \

oracle.install.db.OSRACDBA_GROUP=dba

[oracle@localhost database]$ ./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion -showProgress -silent -responseFile /oracle/database/response/db_install.rsp oracle.install.option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/usr/local/products/oracle12c/oraInventory ORACLE_HOME=/usr/local/products/oracle12c ORACLE_BASE=/usr/local/products oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSBACKUPDBA_GROUP=dba oracle.install.db.OSDGDBA_GROUP=dba oracle.install.db.OSKMDBA_GROUP=dba oracle.install.db.OSRACDBA_GROUP=dba

Starting Oracle Universal Installer...

Checking Temp space: must be greater than 500 MB.  Actual 36281 MB    Passed

Checking swap space: must be greater than 150 MB.  Actual 7107 MB    Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-10-22_10-58-44AM. Please wait ...[WARNING] [INS-32016] The selected Oracle home contains directories or files.

  ACTION: To start with an empty Oracle home, either remove its contents or choose another location.

[WARNING] [INS-32055] The Central Inventory is located in the Oracle base.

  ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.

You can find the log of this install session at:

/usr/local/products/oracle12c/oraInventory/logs/installActions2018-10-22_10-58-44AM.log

Prepare in progress.

..................................................  8% Done.

Prepare successful.

Copy files in progress.

..................................................  17% Done.

..................................................  22% Done.

..................................................  27% Done.

..................................................  32% Done.

..................................................  40% Done.

..................................................  45% Done.

..................................................  50% Done.

..................................................  55% Done.

..................................................  60% Done.

..................................................  65% Done.

..................................................  70% Done.

..................................................  75% Done.

..................................................  80% Done.

....................

Copy files successful.

Link binaries in progress.

..........

Link binaries successful.

Setup files in progress.

..............................

Setup files successful.

Setup Inventory in progress.

Setup Inventory successful.

Finish Setup successful.

The installation of Oracle Database 12c was successful.

Please check '/usr/local/products/oracle12c/oraInventory/logs/silentInstall2018-10-22_10-58-44AM.log' for more details.

Setup Oracle Base in progress.

Setup Oracle Base successful.

..................................................  95% Done.

As a root user, execute the following script(s):

1. /usr/local/products/oracle12c/oraInventory/orainstRoot.sh

2. /usr/local/products/oracle12c/root.sh

..................................................  100% Done.

Successfully Setup Software.

根据提示运行脚本

[root@localhost database]# /usr/local/products/oracle12c/oraInventory/orainstRoot.sh

Changing permissions of /usr/local/products/oracle12c/oraInventory.

Adding read,write permissions for group.

Removing read,write,execute permissions for world.

Changing groupname of /usr/local/products/oracle12c/oraInventory to oinstall.

The execution of the script is complete.

[root@localhost database]# /usr/local/products/oracle12c/root.sh

Check /usr/local/products/oracle12c/install/root_localhost.localdomain_2018-10-22_11-05-52-854397878.log for the output of root script

[root@localhost database]#

[root@localhost oracle]# su oracle

[oracle@localhost ~]$

安装成功

测试如下:

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Mon Oct 22 11:11:14 2018

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to an idle instance.

SQL>

数据库创建

执行下列命令:OraPasswd1 是自己的密码,包含大小写及数字

dbca -silent -createDatabase \

-templateName /usr/local/products/oracle12c/assistants/dbca/templates/General_Purpose.dbc \

-gdbname cdb1 -sid cdb1 -responseFile /home/oracle/database/response/dbca.rsp \

-characterSet AL32UTF8 \

-sysPassword OraPasswd1 \

-systemPassword OraPasswd1 \

-createAsContainerDatabase true \

-numberOfPDBs 1 \

-pdbName pdb1 \

-pdbAdminPassword OraPasswd1 \

-automaticMemoryManagement false \

-ignorePreReqs

[oracle@localhost ~]$ dbca -silent -createDatabase -templateName /usr/local/products/oracle12c/assistants/dbca/templates/General_Purpose.dbc -gdbname cdb1 -sid cdb1 -responseFile /oracle/database/response/dbca.rsp -characterSet AL32UTF8 -sysPassword OraPasswd1 -systemPassword OraPasswd1 -createAsContainerDatabase true -numberOfPDBs 1 -pdbName pdb1 -pdbAdminPassword OraPasswd1 -automaticMemoryManagement false -ignorePreReqs

Copying database files

1% complete

13% complete

25% complete

Creating and starting Oracle instance

26% complete

30% complete

31% complete

35% complete

38% complete

39% complete

41% complete

Completing Database Creation

42% complete

43% complete

44% complete

46% complete

49% complete

50% complete

Creating Pluggable Databases

55% complete

75% complete

Executing Post Configuration Actions

100% complete

Look at the log file "/usr/local/products/cfgtoollogs/dbca/cdb1/cdb1.log" for further details.

[oracle@localhost ~]$

dbca -silent -createDatabase \

-templateName /usr/local/products/oracle12c/assistants/dbca/templates/General_Purpose.dbc \

-gdbname cdb1 -sid cdb1 -responseFile /home/oracle/database/response/dbca.rsp \

-characterSet AL32UTF8 \

-sysPassword OraPasswd1 \

-systemPassword OraPasswd1 \

-createAsContainerDatabase true \

-numberOfPDBs 1 \

-pdbName pdb1 \

-pdbAdminPassword OraPasswd1 \

-automaticMemoryManagement false \

-ignorePreReqs

数据库监听配置

使用默认的netca.rsp文件  执行netca -silent -responseFile /home/oracle/database/response/netca.rsp

netca -silent -responseFile /oracle/database/response/netca.rsp  // 因为/home空间不足 所以安装时创建了/oracle 来安装

启动

[oracle@localhost ~]$ lsnrctl start

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 22-OCT-2018 17:16:26

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Starting /usr/local/products/oracle12c/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production

System parameter file is /usr/local/products/oracle12c/network/admin/listener.ora

Log messages written to /usr/local/products/diag/tnslsnr/localhost/listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1539)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1539)))

STATUS of the LISTENER

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

Alias                    LISTENER

Version                  TNSLSNR for Linux: Version 12.2.0.1.0 - Production

Start Date                22-OCT-2018 17:16:26

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level              off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File  /usr/local/products/oracle12c/network/admin/listener.ora

Listener Log File        /usr/local/products/diag/tnslsnr/localhost/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1539)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

The listener supports no services

The command completed successfully

查看状态

[oracle@localhost ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 22-OCT-2018 17:18:59

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1539)))

STATUS of the LISTENER

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

Alias                    LISTENER

Version                  TNSLSNR for Linux: Version 12.2.0.1.0 - Production

Start Date                22-OCT-2018 17:16:26

Uptime                    0 days 0 hr. 2 min. 33 sec

Trace Level              off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File  /usr/local/products/oracle12c/network/admin/listener.ora

Listener Log File        /usr/local/products/diag/tnslsnr/localhost/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1539)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

The listener supports no services

The command completed successfully

参考

Linux命令行安装Oracle12c

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 205,132评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,802评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,566评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,858评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,867评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,695评论 1 282
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,064评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,705评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 42,915评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,677评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,796评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,432评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,041评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,992评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,223评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,185评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,535评论 2 343

推荐阅读更多精彩内容