oracle 11g 静默安装

有时候会遇到命令行安装oracle和建库,没事就做个试验记录下
1.配置Yum源及关闭SeLinux

[root@rhel65 mnt]# mount /dev/sr0 /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only

[root@rhel65 ~]# cat /etc/yum.repos.d/iso.repo
[iso]
name=iso
baseurl=file:///mnt
enabled=1
gpgcheck=0

[root@rhel65 ~]# vi /etc/selinux/config
SELINUX=disabled

2.检查安装必要的rpm包
rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make pdksh sysstat
与上面不同,待检查
yum -y install binutils binutils-devel compat-libcap1 compat-libstdc++-33 compat-libstdc++-33.i686 ksh elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel glibc-headers gcc gcc-c++ libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 make sysstat unixODBC unixODBC-devel libXp libXp-devel libXpm-devel telnet

3.修改sysctl.conf文件
vi /etc/sysctl.conf
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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

以上几个内核参数的大致含义如下
kernel.shmma:最大共享内存段,以字节为单位,物理内存*1024*1024*2,为物理内存的2倍。
kernel.shmmni:整个系统共享内存段的最大数目。
kernel.shmall:共享内存总量,以页为单位。
kernel.sem:每个信号对象集的最大信号对象数;系统范围内最大信号对象数;每个信号对象支持的最大操作数;系统范围内最大信号对象集数。
fs.file-max:文件句柄数,表示在Linux系统中可以打开的文件数量。
net.ipv4.ip_local_port_range:应用程序可使用的IPv4端口范围。
net.core.rmem_default:套接字接收缓冲区大小的缺省值
net.core.rmem_max:套接字接收缓冲区大小的最大值
net.core.wmem_default:套接字发送缓冲区大小的缺省值
net.core.wmem_max:套接字发送缓冲区大小的最大值

使内核参数实时生效
sysctl -p

4.Oracle用户设置Shell限制
vi /etc/security/limits.conf
oracle soft nproc 65536
oracle hard nproc 65536
oracle soft nofile 65536
oracle hard nofile 65536

5.session登录安全设置
vi /etc/pam.d/login #增加以下一行
session required pam_limits.so

在/etc/profile末尾增加oracle相关限制
vi /etc/profile

#Oracle判断
if [ \$USER = "oracle" ]; then
if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi

6.创建oracle用户,组(root用户)
创建Oracle安装组oinstall,数据库管理员组dba,及oracle用户
cat /etc/group
groupadd -g 54321 oinstall
groupadd -g 54322 dba
useradd -u 54321 -m -d /home/oracle -g oinstall -G dba oracle
echo "oarcle" | passwd --stdin oracle

id oracle
uid=54321(oracle) gid=54321(oinstall) 组=54321(oinstall),54322(dba)
groupadd oinstall 是创建用户组,用来做oracle的安装和维护工作
useradd 是创建用户
-m –d /home/oracle 是把/home/oracle目录作为oracle用户的主目录或登录默认目录
–g oinstall 是表示oracle用户的初始组为oinstall
–G dba 是表示oracle用户同时属于dba组,做数据维护,和数据库管理工作

/*
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -g oinstall -G dba oracle(主组oinstall,其它组:dba)
--passwd oracle
echo "oarcle" | passwd --stdin oracle
一句话修改账户密码的命令 echo "密码" | passwd --stdin 用户名
下面是最简单的创建
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
echo "oarcle" | passwd --stdin oracle
chmod -R 700 /home/oracle

*/

7.创建安装目录
mkdir -p /u01/app/oracle
--创建数据文件路径
mkdir -p /u01/app/oracle/oradata
mkdir -p /u01/app/oraInventory
--创建闪回路径
mkdir -p /u01/app/oracle/fast_recovery_area
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01/app/oracle
chown -R oracle:oinstall /u01/app
chmod -R 755 /u01/app

8.创建 oracle bash_profile
su - oracle
vi .bash_profile
--下面创建DBNAME为TESTDB,执行前批量替换成自己喜欢的名字

export PATH
export ORACLE_BASE=/u01/app/oracle;
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1;
export ORACLE_SID=testdb;
export ORACLE_UNQNAME=testdb;
export ORACLE_TERM=xterm;
export PATH=$ORACLE_HOME/bin:$PATH;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
#数据库编码 ZHS16GBK/UTF8 任选一个
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
#数据库时间格式
export NLS_DATE_FORMAT=YYYY/MM/DD
export EDITOR=vi
export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'
export SQLPATH=/home/oracle/sqlpath

umask 022
#set -o vi
stty erase ^h
set line 189 pages 200
set time on

alias sql='sqlplus / as sysdba'
alias trace='cd /u01/app/oracle/diag/rdbms/testdb/testdb/trace'
alias oralog='cd /u01/app/oracle/diag/rdbms/rac/rac1/trace/'
alias network='cd /u01/app/oracle/product/11.2.0/db_1/network/admin/'

echo '################### 测试环境 ########################'
echo '0. rac: export ORACLE_SID=testdb; export DBNAME=testdb';
echo ' ';

#以下两个设置是用来设置rlwrap插件的环境,用来支持命令行回显功能
#alias sqlplus="rlwrap sqlplus"
#alias rman="rlwrap rman"

--使配置生效
source /home/oracle/.bash_profile

[oracle@testdb ~]# . /home/oracle/.bash_profile

检查环境变量是否生效
env |grep ORA

9.解压文件
unzip ...

10.静默文件配置/单节点为例
[root@rhel65 ~]# cd /home/oracle/soft/database/response/
[root@rhel65 response]# ls
dbca.rsp db_install.rsp netca.rsp
[root@rhel65 response]# grep -Ev "^$|^#" db_install.rsp
#对照响应文件修改自己的配置,示例是安装在/u01/app目录下的,单实例的话只需要对应修改=后面有值的,修改之前最好cp一份
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY ##// 安装类型 29行
ORACLE_HOSTNAME=rhel65 ##// 主机名称(hostname查询,这里要注意,主机名要在 /etc/hosts 文件中配置好ip对应关系,否则安装会报错) 37行
UNIX_GROUP_NAME=oinstall ##// 安装组 42行
INVENTORY_LOCATION=/u01/app/oraInventory ##//INVENTORY目录(不填就是默认值) 49行 这个文件不能放在ORACLE_BASE下
SELECTED_LANGUAGES=en,zh_CN,zh_TW ##// 选择语言 86行
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 ##// oracle_home 91行
ORACLE_BASE=/u01/app/oracle ##// oracle_base --96行
oracle.install.db.InstallEdition=EE ##// oracle版本 107行
oracle.install.db.isCustomInstall=false ##//自定义安装,否,使用默认组件 117行
oracle.install.db.EEOptionsSelection=false
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0
oracle.install.db.DBA_GROUP=dba ##// dba用户组 154行
oracle.install.db.OPER_GROUP=oinstall ##// oper用户组 160行
oracle.install.db.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=
oracle.install.db.racOneServiceame=
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE ##//数据库类型 189行
oracle.install.db.config.starterdb.globalDBName=testdb ##//globalDBName(这里要和第8步配置的sid一致) 194行
oracle.install.db.config.starterdb.SID=testdb ##//SID(这里要和第8步配置的sid一致)199行
oracle.install.db.config.starterdb.characterSet=AL32UTF8 213行
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.memoryLimit=
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=oracle ##//设定所有数据库用户使用同一个密码 262行
oracle.install.db.config.starterdb.password.SYS=
oracle.install.db.config.starterdb.password.SYSTEM=
oracle.install.db.config.starterdb.password.SYSMAN=
oracle.install.db.config.starterdb.password.DBSNMP=
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL=
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.automatedBackup.osuid=
oracle.install.db.config.starterdb.automatedBackup.ospwd=
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE ##//这里是文件系统
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/u01/app/oracle/oradata ##//数据文件路径 mkdir -p /u01/app/oracle/oradata
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/u01/app/oracle/fast_recovery_area ##//闪回路径 mkdir -p /u01/app/oracle/fast_recovery_area
oracle.install.db.config.asm.diskGroup=
oracle.install.db.config.asm.ASMSNMPPassword=
MYORACLESUPPORT_USERNAME=
MYORACLESUPPORT_PASSWORD=
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false (手动写了false) 388
DECLINE_SECURITY_UPDATES=true ##//设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。 400行
PROXY_HOST=
PROXY_PORT=
PROXY_USER=
PROXY_PWD=
PROXY_REALM=
COLLECTOR_SUPPORTHUB_URL=
oracle.installer.autoupdates.option=SKIP_UPDATES ##//
oracle.installer.autoupdates.downloadUpdatesLoc=
AUTOUPDATES_MYORACLESUPPORT_USERNAME=
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
[root@rhel65 response]#

安装
[root@rhel65 response]# su - oracle
[23:07:00 oracle(db_1)@rhel65 ~]$ cd /home/oracle/soft/database/response
[23:07:14 oracle(db_1)@rhel65 response]$ cd ..
[23:07:18 oracle(db_1)@rhel65 database]$ ./runInstaller -silent -showProgress -ignoreSysPrereqs -responseFile /home/oracle/soft/database/response/db_install.rsp

--yum install --nogpgcheck oracle-rdbms-server-11gR2-preinstall
--wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle

[23:49:14 oracle(db_1)@rhel65 database]$ ./runInstaller -silent -showProgress -ignoreSysPrereqs -responseFile /home/oracle/soft/database/response/db_install.rsp
Starting Oracle Universal Installer...

Checking Temp space: must be greater than 120 MB. Actual 5173 MB Passed
Checking swap space: must be greater than 150 MB. Actual 3999 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-05-18_11-49-20PM. Please wait ...[23:49:21 oracle(db_1)@rhel65 database]$ [WARNING] [INS-13014] Target environment do not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. /usr/oracle/oraInventory/logs/installActions2019-05-18_11-49-20PM.log
ACTION: Identify the list of failed prerequisite checks from the log: /usr/oracle/oraInventory/logs/installActions2019-05-18_11-49-20PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
You can find the log of this install session at:
/usr/oracle/oraInventory/logs/installActions2019-05-18_11-49-20PM.log

Prepare in progress.
.................................................. 9% Done.

Prepare successful.

Copy files in progress.
.................................................. 14% Done.
.................................................. 20% Done.
.................................................. 26% Done.
.................................................. 32% Done.
.................................................. 41% Done.
.................................................. 46% Done.
.................................................. 51% Done.
.................................................. 56% Done.
.................................................. 62% Done.
.................................................. 67% Done.
.................................................. 72% Done.
.................................................. 77% Done.
.................................................. 82% Done.
........................................
Copy files successful.

Link binaries in progress.
..........
Link binaries successful.

Setup files in progress.
.................................................. 87% Done.
.................................................. 94% Done.

Setup files successful.
The installation of Oracle Database 11g was successful.
Please check '/usr/oracle/oraInventory/logs/silentInstall2019-05-18_11-49-20PM.log' for more details.

Execute Root Scripts in progress.

As a root user, execute the following script(s):
1. /usr/oracle/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/11.2.0/db_1/root.sh
.................................................. 100% Done.

Execute Root Scripts successful.
Successfully Setup Software.

--root下执行上述2脚本
[19:19:42 root(db_1)@rhel65 ~]# /usr/oracle/oraInventory/orainstRoot.sh
Changing permissions of /usr/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /usr/oracle/oraInventory to oinstall.
The execution of the script is complete.
[19:19:43 root(db_1)@rhel65 ~]# /u01/app/oracle/product/11.2.0/db_1/root.sh
Check /u01/app/oracle/product/11.2.0/db_1/install/root_rhel65_2019-05-26_19-19-52.log for the output of root script

至此【软件安装完成】

11.配置监听程序 切换oracle用户执行
[14:42:16 oracle(db_1)@rhel65 response]$ $ORACLE_HOME/bin/netca /silent /responseFile /home/oracle/soft/database/response/netca.rsp
至此【创建监听完成】

12.静默dbca建库
$ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/soft/database/response/dbca.rsp

执行前需要设置以下参数,rsp中以下都被注释掉了,可以直接添加到最后
GDBNAME= "testdb"
SID ="testdb"
SYSPASSWORD= "oracle"
SYSTEMPASSWORD= "oracle"
SYSMANPASSWORD= "oracle"
DBSNMPPASSWORD= "oracle"
DATAFILEDESTINATION=/u01/app/oracle/oradata
RECOVERYAREADESTINATION=/u01/app/oracle/fast_recovery_area
CHARACTERSET= "ZHS16GBK"
TOTALMEMORY= "2638"
#其中TOTALMEMORY ="1638" 为1638MB,物理内存2G*80%。

[19:28:56 oracle(db_1)@rhel65 ~]$ $ORACLE_HOME/bin/dbca -silent -responseFile /home/oracle/soft/database/response/dbca.rsp
Enter SYS user password:

Enter SYSTEM user password:

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
57% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
74% complete
85% complete
86% complete
98% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/testdb/testdb.log" for further details.
至此【建库完成】

[20:30:46 oracle(db_1)@rhel65 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sun May 26 20:30:48 2019

Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

20:30:48 sys@testdb> select status from v$instance;

STATUS
------------
OPEN

Elapsed: 00:00:00.00
20:30:50 sys@testdb>
数据库已open

[20:31:20 oracle(db_1)@rhel65 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 26-MAY-2019 20:31:20

Copyright (c) 1991, 2013, 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.4.0 - Production
Start Date 26-MAY-2019 19:23:22
Uptime 0 days 1 hr. 7 min. 58 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/rhel65/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rhel65)(PORT=1521)))
Services Summary...
Service "testdb" has 1 instance(s).
Instance "testdb", status RESTRICTED, has 1 handler(s) for this service...
Service "testdbXDB" has 1 instance(s).
Instance "testdb", status RESTRICTED, has

至此【监听已启动】
数据库到这基本可以正常工作了。。。
其中tnsnames.ora 对应的host为主机名,最好改成IP

【实例检查】
监听
lsnrctl status
进程
ps -ef | grep ora_ | grep -v grep | wc -l
ps -ef | grep ora_ | grep -v grep

shutdown immediate;
startup mount
alter database archivelog;
闪回可以不开启,耗资源耗空间
alter database flashback on;
alter database open;

【异常处理】
[root@test220 ~]# tailf /tmp/OraInstall2019-07-31_03-27-48PM/installActions2019-07-31_03-27-48PM.log
INFO: Setting value for the property:configcmds in the bean:configcmdmappings
--日志这里报错
SEVERE: [FATAL] PRVF-0002 : Could not retrieve local nodename.
Refer associated stacktrace #oracle.install.commons.util.exception.DefaultErrorAdvisor:35
INFO: Advice is ABORT
SEVERE: Unconditional Exit
INFO: Adding ExitStatus FAILURE to the exit status set
WARNING: A log of this session is currently saved as: /tmp/OraInstall2019-07-31_03-27-48PM/installActions2019-07-31_03-27-48PM.log. Oracle recommends that if you want to keep this log, you should move it from the temporary location to a more permanent location.
INFO: Finding the most appropriate exit status for the current application
INFO: Exit Status is -1
INFO: Shutdown Oracle Database 11g Release 2 Installer

解决方法:修改hosts文件
[root@test220 ~]# vi /etc/hosts
192.168.X.X test220


//

一、主机信息查看
1、查看主机名 uname -a
2、查看主机版本 cat /etc/redhat-release
3、查看主机IP ifconfig -a
4、查看hosts解析 cat /etc/hosts
5、查看主机时间 date
6、查看主机磁盘 df -h
7、查看存储配置 multipath -l
8、查看主机防火墙 service iptables status
9、查看selinux配置 cat /etc/selinux/config
10、查看存储超时时间 cat /sys/block/sdb/device/timeout
11、查看系统硬件时钟 hwclock --show

二、主机基础信息可能的修改
1、修改主机时间 date -s 14:20:50
2、硬件同步的系统时钟 clock --systohc
系统同步硬件的时钟 clock --hctosys
3、停止防火墙 service iptables stop
防火墙不开机启动 chkconfig iptables off
确认防火墙状态 service iptables status
防火墙开机启动确认 chkconfig --list|grep iptables
4、删除主机ntp配置文件 rm -rf /etc/ntp.conf
5、修改selinux配置 sed -i '/enforcing/s/SELINUX=enforced/SELINUX=disabled/g' /etc/selinux/config
确认selinux修改 cat /etc/selinux/config

设置sar
默认sar记录为10分钟一次,改为1分钟一次
日志保存目录为/var/log/sa
运行频率修改,把时间*/10改为*/1,出下面
# vi /etc/cron.d/sysstat
# run system activity accounting tool every 10 minutes
*/1 * * * * root /usr/lib64/sa/sa1 1 1
如果没有配置文件则需要安装sysstat-7.0.2-3.el5_5.1.x86_64.rpm包
日志保存时间,改为30天
# vi /etc/sysconfig/sysstat
HISTORY=30

增强提示符
为了使用同一用户oracle更好的分辨在哪个ORACLE_HOME中,使用以下增强的命令提示符
vi /etc/profile
export PS1='[\t \u(${ORACLE_HOME##*/})@\h \W]\$ '

设置SQLPATH目录
sqlpath目录中的login.sql设置了登录sqlplus的环境变量
mkdir -p /home/oracle/sqlpath
vi login.sql
set TERM OFF
define_editor=vim
define loginname=idle
column global_name new_value loginname
select lower(USER||'@'
||substr(global_name,1,decode(dot,0,length(global_name),dot-1))) global_name
from
(select global_name, instr(global_name,'.') dot
from global_name);
set sqlprompt '&loginname> '
alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';
SET TIMING ON
SET TIME ON
SET SERVEROUTPUT ON


SET LINESIZE 130
SET TERM ON
SET NUMWIDTH 13
SET PAGESIZE 1000
SET ECHO ON

在安装过程中涉及的几个文件位置及用途
/etc/sysctl.conf (修改内核参数)
/etc/security/limits.conf (shell对oracle用户的限制)
/etc/pam.d/login
/etc/profile (系统相关的环境变量)
/home/oracle/.bash_profile (oracle用户相关的环境变量)
/home/oracle(确保本目录空间足够大)
/etc/hosts (建立ip和机器名的关系,通过uname把地址和机器名关联,否则在安装数据库时报监听器错误)
/etc/sysconfig/network 修改机器名

使用yum安装缺失的rpm包
yum list
yum -y install rpm_name.rpm
yum makecache 是将服务器上的软件包信息 现在本地缓存,以提高 搜索 安装软件的速度
man yum 查看yum的帮助信息
yum 主要的一下命令如下:
yum search 软件包 搜索软件包
yum install 软件包 安装软件包
yum remove 软件包
yum update 更新系统
yum clean all 清除缓存目录下的软件包及旧的headers

执行完 yum makecache之后,你可以用
yum search subversion和yum -C search subversion 二者差别挺明显的,前者明显比后者慢

修改启动参数打开归档和闪回
# 修改spfile参数
alter system set log_archive_dest_1='location=/doea5/arch';
alter system set log_archive_format='arch_%t_%s_%r.log' scope=spfile;
alter system set db_recovery_file_dest_size=20G scope=spfile;
alter system set db_recovery_file_dest='/oracle/app/oracle/flash_recovery';
alter system set db_flashback_retention_target=10080 scope=spfile;
alter system set undo_retention=10800;

# 打开归档和闪回
shutdown immediate
startup mount
alter database archivelog ;
alter database flashback on;
alter database open;

防火墙设置
在文件【/etc/sysconfig/iptables】内增加以下内容:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 1158 -j ACCEPT
Oracle远程访问端口默认是1521,OEM端口1158,若自定义新端口,请开放相应端口。
(新开放端口的配置必须紧跟着放在端口22的配置后面)
重启防火墙
[root@oracle sysconfig]# service iptables restart

关闭selinux和iptables
iptables -F
iptables -x
编辑/etc/selinux/config,状态变成disabled

chown oracle:oinstall -R /tmp/database
chmod +x -R /tmp/database

修改操作系统启动模式
把level 5的图形界面改为level 3的字符界面,启动操作系统后会进入字符界面
# vi /etc/inittab
id:3:initdefault:

清空resolv.conf
在生产环境中,不建议使用resolve.conf解析域名,可能会使客户端登录缓慢,建议清空它
vi /etc/resolv.conf
清空

参考下面进行参数设置
https://www.linuxidc.com/Linux/2016-11/137543.htm

增强提示符
为了使用同一用户oracle更好的分辨在哪个ORACLE_HOME中,使用以下增强的命令提示符
# vi /etc/profile
export PS1='[\t \u(${ORACLE_HOME##*/})@\h \W]\$ '

配置NTP服务
根据公司的NTP策略,需要布置NTP脚本,从IDC处取得ntpd-deploy.sh
目前有一份脚本存放在/u07/system_configuration/ntpd/for_linux目录
如果时间与实现的时间相关太多,先使用ntpdate手工同步一下
# ntpdate ntp-hb1.99bill.com
# ./ntpd-deploy.sh hb

GI环境的ntpd需要加上-x参数
# vi /etc/sysconfig/ntpd
加上参数-x
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"

为了保证BIOS时间和系统时间差别太大,ntpd会不同步,在系统重启时增加自动同步一次的脚本
# vi /etc/rc.local
ntpdate ntp-hb1.99bill.com

设置sar
默认sar记录为10分钟一次,改为1分钟一次
日志保存目录为/var/log/sa
运行频率修改,把时间*/10改为*/1,出下面
# vi /etc/cron.d/sysstat
# run system activity accounting tool every 10 minutes
*/1 * * * * root /usr/lib64/sa/sa1 1 1
如果没有配置文件则需要安装sysstat-7.0.2-3.el5_5.1.x86_64.rpm包
日志保存时间,改为30天
# vi /etc/sysconfig/sysstat
HISTORY=30

你可能感兴趣的:(oracle 11g 静默安装)