静默安装oracle 11g r2

一、环境准备

系统版本

Oracle版本

Suse11SP3

Oracle11gr2

系统配置要求

1)物理内存1GB以上,交换空间大约为物理内存的2倍。

2)安装目录(/data/oracle)建议有8GB以上、/tmp目录建议有1GB以上可用空间。

3)提前配置好主机名、IP地址,完成安装以后不要再改主机名。

 

二、前期准备

2.1 创建oracle用户组、程序目录

1
2
3
4
5
mkdir  /data/oracle  -p
groupadd dba
groupadd oinstall
useradd  -g oinstall -G dba -m -d  /data/oracle  oracle
echo  'oracle'  | passwd  --stdin oracle

2.2 修改hosts文件(本机主机名 IP地址)

1
2
TEST: /home  # cat /etc/hosts
127.0.0.1  TEST

2.3 优化内核参数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
cat  >> /etc/sysctl .conf <<EOF
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
fs. file -max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
EOF
  
tail   -20  /etc/sysctl .conf
sysctl -p

2.4 调整会话限制

1
2
3
4
5
6
7
8
9
10
cat  >> /etc/security/limits .conf <<EOF
oracle        soft    nproc    8192
oracle        hard    nproc    16384
oracle        soft    nofile   32768
oracle        hard    nofile   65536
EOF
  
cat  >>  /etc/pam .d /login  <<EOF
session required pam_limits.so
EOF

2.5 调整用户环境变量

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
su  - oracle
cat  >> .bash_profile <<EOF
export  PATH=\$PATH: /data/oracle/product/11gr2/dbhome_1/bin
export  ORACLE_HOME= /data/oracle/product/11gr2/dbhome_1
export  ORACLE_SID=orcl
EOF
cat   .bash_profile
source   .bash_profile
  
su  - root
cat  >>  /etc/profile  <<EOF
export  PATH=\$PATH: /data/oracle/product/11gr2/dbhome_1/bin
export  ORACLE_HOME= /data/oracle/product/11gr2/dbhome_1
export  ORACLE_SID=orcl
EOF
tail  /etc/profile
source   /etc/profile

2.6 应答文件(!)

1
2
3
4
cat  >> /etc/oraInst .loc <<EOF
inventory_loc= /data/oracle/oraInventory
inst_group=oinstall
EOF

2.7 依赖库安装

1
2
3
4
注意:以下安装需要挂载系统镜像盘
zypper  in  binutils gcc gcc-c++ glibc glibc-devel ksh-93t 
libstdc++33 libstdc++43 libstdc++43-devel libaio libaio-devel libgcc43 
libstdc++-devel  make  sysstat -y

2.8 修改交换分区配置

1
2
3
vi  /etc/fstab
新增如下:
tmpfs                 /dev/shm              tmpfs      defaults,size=1024m   0 0

 

三、正式安装oracle

3.1 解压安装包

1
2
3
4
5
6
7
8
9
10
11
12
13
TEST: /tmp  # cd /tmp
TEST: /tmp  # mkdir oracle
TEST: /tmp  # mv linux.x64_11gR2_database_* oracle/
TEST: /tmp  # cd oracle/
TEST: /tmp/oracle  # ll
total 2297844
-rw-r--r-- 1 root root 1239269270 Oct 28 11:20 linux.x64_11gR2_database_1of2.zip
-rw-r--r-- 1 root root 1111416131 Oct 28 11:20 linux.x64_11gR2_database_2of2.zip
TEST: /tmp/oracle  # unzip linux.x64_11gR2_database_1of2.zip
TEST: /tmp/oracle  # unzip linux.x64_11gR2_database_2of2.zip
  
TEST: /tmp/oracle  # cd ..
TEST: /tmp  # chown -R oracle.oinstall oracle/*

3.2 安装

1
2
3
4
TEST: /tmp  # su - oracle
oracle@TEST:~>  cd  /tmp/oracle/database
#执行以下命令安装:
. /runInstaller  -silent -debug -force DECLINE_SECURITY_UPDATES= true  oracle. install .option=INSTALL_DB_SWONLY UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION= /data/oracle/oraInventory  ORACLE_HOME= /data/oracle/product/11gr2/dbhome_1  ORACLE_BASE= /data/oracle  oracle. install .db.InstallEdition=EE oracle. install .db.EEOptionsSelection= true  oracle. install .db.optionalComponents=oracle.rdbms.partitioning:11.2.0.3.0,oracle.oraolap:11.2.0.3.0,oracle.rdbms.dm:11.2.0.3.0,oracle.rdbms.lbac:11.2.0.3.0,oracle.rdbms.rat:11.2.0.3.0 oracle. install .db.DBA_GROUP=dba oracle. install .db.OPER_GROUP=dba oracle. install .db.isRACOneInstall= false  DECLINE_SECURITY_UPDATES= true

3.3 检查日志安装情况

1
2
3
4
5
6
7
8
oracle@TEST:~ /oraInventory/logs pwd
/data/oracle/oraInventory/logs
oracle@TEST:~ /oraInventory/logs > ll
total 9844
-rw-rw---- 1 oracle oinstall 9381410 Oct 28 13:35 installActions2016-10-28_01-30-33PM.log
-rw-rw---- 1 oracle oinstall    2055 Oct 28 13:35 oraInstall2016-10-28_01-30-33PM.err
-rw-rw---- 1 oracle oinstall  666083 Oct 28 13:35 oraInstall2016-10-28_01-30-33PM.out
-rw-rw---- 1 oracle oinstall     183 Oct 28 13:31 silentInstall2016-10-28_01-30-33PM.log

3.4 执行root.sh脚本

1
2
3
4
oracle@TEST:~ /oraInventory/logs su  -
Password:
TEST:~  # sh /data/oracle/product/11gr2/dbhome_1/root.sh
Check  /data/oracle/product/11gr2/dbhome_1/install/root_TEST_2016-10-28_13-53-55 .log  for  the output of root script

3.5 启动监听

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
TEST:~  # su - oracle
oracle@TEST:~> netca  /silent  /responsefile  /tmp/oracle/database/response/netca .rsp
  
Parsing  command  line arguments:
     Parameter  "silent"  true
     Parameter  "responsefile"  /tmp/oracle/database/response/netca .rsp
Done parsing  command  line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
     Running Listener Control:
       /data/oracle/product/11gr2/dbhome_1/bin/lsnrctl  start LISTENER
     Listener Control complete.
     Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The  exit  code is 0
  
oracle@TEST:~>  netstat  -lnpt| grep  1521
(Not all processes could be identified, non-owned process info
  will not be shown, you would have to be root to see it all.)
tcp        0      0 :::1521                 :::*                    LISTEN      9094 /tnslsnr    
  
oracle@TEST:~> lsnrctl status
  
LSNRCTL  for  Linux: Version 11.2.0.1.0 - Production on 28-OCT-2016 13:59:16
  
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
  
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                28-OCT-2016 13:56:23
Uptime                    0 days 0 hr. 2 min. 53 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File    /data/oracle/product/11gr2/dbhome_1/network/admin/listener .ora
Listener Log File          /data/oracle/diag/tnslsnr/TEST/listener/alert/log .xml
Listening Endpoints Summary...
   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=TEST)(PORT=1521)))
The listener supports no services
The  command  completed successfully

3.6 配置静默数据库配置文件

1
2
3
4
5
6
7
8
9
oracle@TEST:~>  cp  /tmp/oracle/database/response/dbca .rsp  .
oracle@TEST:~> vim dbca.rsp
  
GDBNAME =  "orcl.locahost"  // 全局数据库的名字=SID+主机域名
SID= "orcl"  //  SID
CHARACTERSET= "AL32UTF8"  // 编码
NATIONALCHARACTERSET= "UTF8"  // 编码
SYSPASSWORD =  "Oracle"     // 密码
SYSTEMPASSWORD =  "Oracle"   // 密码

3.7 进行静默安装数据库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
oracle@TEST:~> dbca -silent -responseFile dbca.rsp  
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log  file  "/data/oracle/cfgtoollogs/dbca/orcl/orcl.log"  for  further details.

3.8 登录数据并修改用户密码永不过期

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
oracle@TEST:~> dbca -silent -responseFile dbca.rsp  
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log  file  "/data/oracle/cfgtoollogs/dbca/orcl/orcl.log"  for  further details.

3.9 创建dba用户,加大数据库连接数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#创建pgm用户,dba权限。
oracle@TEST:~> sqlplus  "/as sysdba"
SQL> create user pgm identified by pgmfetion;
User created.
SQL> grant dba to pgm;
Grant succeeded.
  
#加大数据库连接数
SQL> alter system  set  processes=6000 scope=spfile;
System altered.
SQL> alter system  set  sessions=6605 scope=spfile;
System altered.
SQL> create pfile from spfile;
File created.
#重启数据库
SQL> shutdow immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> 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
oracle@TEST:~> lsnrctl stop
LSNRCTL  for  Linux: Version 11.2.0.1.0 - Production on 28-OCT-2016 14:49:33
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The  command  completed successfully
oracle@TEST:~> lsnrctl start
......
SQL> startup;
ORACLE instance started.
  
Total System Global Area 3290345472 bytes
Fixed Size                  2217832 bytes
Variable Size            2248149144 bytes
Database Buffers         1023410176 bytes
Redo Buffers               16568320 bytes
Database mounted.
Database opened.
  
#检查连接数配置
show parameter processes;
show parameter sessions;
  
#查看当前连接数
select  count(*) from  v $process where program= 'ORACLE.EXE(SHAD)' ;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值