系统架构
[root@localhost ~]# uname -a
Linux db 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# uname -r
2.6.32-431.el6.x86_64
[root@db ~]# cat /proc/version
Linux version 2.6.32-431.el6.x86_64 (mockbuild@x86-023.build.eng.bos.redhat.com) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) ) #1 SMP Sun Nov 10 22:19:54 EST 2013
操作系统
[root@db ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
内存
[root@localhost ~]# grep -i memtotal /proc/meminfo
MemTotal: 32872580 kB
[root@db ~]# swapon -s
Filename Type Size Used Priority
/dev/dm-1 partition 16506872 0 -1
磁盘
[root@db ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_db-lv_root 50G 2.9G 44G 7% /
tmpfs 16G 152K 16G 1% /dev/shm
/dev/sda1 485M 40M 421M 9% /boot
/dev/mapper/vg_db-lv_home 2.3T 200M 2.2T 1% /home
内存空闲
[root@db ~]# free
total used free shared buffers cached
Mem: 32872580 798616 32073964 0 26744 323628
-/+ buffers/cache: 448244 32424336
Swap: 16506872 0 16506872
安装包
Oracle官方文档中确定要安装的包如下:
binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (i686)
gcc-4.4.4-13.el6 (x86_64)
gcc-c++-4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (i686)
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (i686)
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6 (i686)
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6 (i686)
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6 (i686)
libXext-1.1 (x86_64)
libXext-1.1 (i686)
libXtst-1.0.99.2 (x86_64)
libXtst-1.0.99.2 (i686)
libX11-1.3 (x86_64)
libX11-1.3 (i686)
libXau-1.0.5 (x86_64)
libXau-1.0.5 (i686)
libxcb-1.5 (x86_64)
libxcb-1.5 (i686)
libXi-1.3 (x86_64)
libXi-1.3 (i686)
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)
注:(1)安装glibc-2.17-55.el7.i686.rpm时,因为依赖包相互依赖,需要与依赖包同时安装:
(安装命令)
yum -y install \
binutils \
compat-libcap1 \
compat-libstdc++-33 \
compat-libstdc++-33*.i686 \
elfutils-libelf-devel \
gcc \
gcc-c++ \
glibc*.i686 \
glibc \
glibc-devel \
glibc-devel*.i686 \
ksh \
libgcc*.i686 \
libgcc \
libstdc++ \
libstdc++*.i686 \
libstdc++-devel \
libstdc++-devel*.i686 \
libaio \
libaio*.i686 \
libaio-devel \
libaio-devel*.i686 \
make \
sysstat \
unixODBC \
unixODBC*.i686 \
unixODBC-devel \
unixODBC-devel*.i686 \
libXp
rpm -ivh --force --nodeps gcc-4.1.2-55.el5.i386.rpm
机器名设置
[root@localhost ~]# hostname db
[root@localhost ~]# vi /etc/sysconfig/network
HOSTNAME=db
[root@localhost ~]# vi /etc/hosts
添加
10.10.11.229 db
禁用sendmail,提升系统启动速度
chkconfig --levels 12345 sendmail off
禁用SELinux:
/etc/selinux/config
修改
SELINUX=disabled
一定需要重起才有效
SELinux提供了比默认ugo+rwx更详细的权限控制
添加用户组oinstall,dba
groupadd oinstall
groupadd dba
添加用户oracle
useradd -g oinstall -G dba oracle
设置oracle密码
passwd oracle
[root@db ~]# id oracle
uid=500(oracle) gid=500(oinstall) 组=500(oinstall),501(dba)
建立安装目录(google一下OFA)
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01/app
chmod -R 775 /u01/app
修改oracle用户环境变量
su - oracle
vi .bash_profile or root下vi ~oracle/.bash_profile
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=ORCL; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
umask 002
改好后,使之生效
source .bash_profile
修改ulimit(感觉好象没有必要)
vim /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
核心参数
vim /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 17179869184
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
改好后,使之生效
sysctl -p
/sbin/sysctl -p
改文件限制
vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
注意:修改此文件是即时生效的,但可能要重登录后再看
ulimit -Sn
ulimit -Hn
ulimit -Sn
ulimit -Sn
ulimit -Sn
vim /etc/pam.d/login (感觉好象没有必要)
session required /lib/security/pam_limits.so
session required pam_limits.so
安装
下载的oracle文件ssh到/u01/app/oracle
xhost + #一定要运行一下
su - oracle
cd /u01/app/oracle
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
unset LANG LANGUAGE #解决中文乱码
cd /u01/app/oracle/databse
./runInstaller
Step1:从安装盘找vsftpd-2.0.5-10.el5.i386.rpm
安装rpm -ivh vsftpd-2.0.5-10.el5.i386.rpm
Step2:开启服务
cd /etc/rc.d/init.d
service vsftpd start
orcl229
iptables
-A RH-Firewall-1-INPUT -p tcp --dport 1521 -j ACCEPT
安装后配置
ORACLE11g
数据库自启动配置
修改以下两个文件
/etc/oratab
和
$ORACLE_HOME/bin/dbstart
[root@redhat ~]# vi /etc/oratab
将
test:/u01/oracle/product/OraHome:N
修改为
test:/u01/oracle/product/OraHome:Y
[root@redhat ~]# su -l oracle
[oracle@redhat ~]$ cd $ORACLE_HOME
[oracle@redhat OraHome]$ cd bin
[oracle@redhat bin]$ vi dbstart
找到
ORACLE_HOME_LISTNER=$1
这一行,将
$1
改为
$ORACLE_HOME
--------------------------------------------------------------------
安装过程中遇到如下问题时:
问题1:
Exception String: Error in invoking target 'mkldflags ntcontab.o nnfgt.o' of makefile '/u01/app/oracle/product/11.2.0/db_1/network/lib/ins_net_client.mk'. See '/u01/app/oraInventory/logs/installActions2015-11-19_03-02-59PM.log' for details.
分析:
gcc版本问题或者gcc的包没有装全
处理方案:
gcc的rpm包的顺序及方法
glibc
# rpm -ivh glibc-common-2.12-1.25.el6.x86_64.rpm
# rpm -ivh kernel-headers-2.6.32-131.0.15.el6.x86_64.rpm
# rpm -ivh libgcc-4.4.5-6.el6.x86_64.rpm
# rpm -ivh glibc-2.12-1.25.el6.x86_64.rpm
# rpm -ivh libgomp-4.4.5-6.el6.x86_64.rpm
# rpm -ivh nscd-2.12-1.25.el6.x86_64.rpm
# rpm -ivh glibc-headers-2.12-1.25.el6.x86_64.rpm
# rpm -ivh glibc-devel-2.12-1.25.el6.x86_64.rpm
# rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm
# rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm
# rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
# rpm -ivh cpp-4.4.5-6.el6.x86_64.rpm
# rpm -ivh gcc-4.4.5-6.el6.x86_64.rpm
注:以上是安装gcc,软件安装顺序不能错。
******************************************
# rpm -ivh libstdc++-4.4.5-6.el6.x86_64.rpm
# rpm -ivh libstdc++-devel-4.4.5-6.el6.x86_64.rpm
# rpm -ivh gcc-c++-4.4.5-6.el6.x86_64.rpm
注:以上是安装gcc-c++
按照上面的顺序安装完gcc后题目所说的错误就能修正了
安装过程中遇到问题:
DBCA fails while in the middle of creating the database with the following errors
ORA-13516: AWR Operation failed: CATPROC not valid
ORA-06512: at "SYS.DBMS_SWRF_INTERNAL", line 206
ORA-06512: at "SYS.DBMS_SWRF_INTERNAL", line 239
ORA-06512: at line 1
Cause
ORA-13516 DURING DB CREATION WHEN DB PWD CONTAINS " " (SPACE) CHARACTER Bug ID 8633879
This Bug is suspended due to lack of required information, but the issue is solved by using workaround (removing the space and the special characters used in the passwd)
Solution
Do not include any spaces or special characters in the password,
If you are particular with the passwords, then you can reset the passwords once the database is created. Eg:
conn / as sysdba
alter user USERNAME identified by PWD;
上面讲到密码中包含空格或是特殊字符就可能会在dbca时出现以上错误.在建库的时候要避免使用空格或是特殊字符.当然和密码中特殊字符相关的错误,也可能出现在rman中等.
---------------------
利用
dbca
创建数据库时提示
ORA-12532: TNS:invalid argument
错误代码,
是iptables没有开放1521端口,在iptables
中添加以下条目
-A INPUT -p tcp --dport 1521 -j ACCEPT
解决问题。
iptables导致远程连接linux下oracle数据库失败
service iptables stop 后。
连接、操作都正常,确定是iptables的原因。
然而,不能为了连接把整个iptables关掉,还是要查到具体是那个规则造成的。
在上查到一篇文章提到修改
vi /etc/sysconfig/iptables
则将
-A INPUT -p tcp --dport 1521 -j ACCEPT
插入到
-A INPUT -j REJECT --reject-with icmp-host-prohibited
之前。
重新启动iptables,数据库可以正常连接。
调整memory target后
SQL> alter system set memory_max_target=28G scope=spfile;
System altered.
SQL> alter system set memory_target=28G scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORA-00845: MEMORY_TARGET not supported on this system
原因:
MEMORY_MAX_TARGET 的设置不能超过 /dev/shm 的大小
[root@db ORCL]# df -h |grep shm
tmpfs 16G 80K 16G 1% /dev/shm
解决方法:
mount -t tmpfs shmfs -o size=28G /dev/shm
vi /etc/fstab(修改使之永久生效)
tmpfs /dev/shm tmpfs defaults
,size=28G 0 0