[[email protected] Desktop]
[[email protected] Desktop] cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.20 udbs01
192.168.0.21 udbs02
192.168.98.20 udbs01-priv
192.168.98.21 udbs02-priv
192.168.0.22 udbs01-vip
192.168.0.23 udbs02-vip
192.168.0.24 udbs-scan
[[email protected] Desktop] cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
HWADDR=00:0C:29:0B:08:3A
TYPE=Ethernet
UUID=10e5298f-408f-4ece-935b-9067beae20e8
IPADDR=192.168.98.20
NETMASK=255.255.248.0
GATEWAY=192.168.0.254
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
[[email protected] Desktop]$ cat /home/oracle/.bash_profile
.bash_profile
Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
User specific environment and startup programs
PATH=HOME/bin
export PATH
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=PATH:/usr/sbin:ORACLE_HOME/lib:/lib:/usr/lib:/lib64:/usr/lib64
TNS_ADMIN=$ORACLE_HOME/network/admin
ORACLE_ADMIN=$ORACLE_BASE/admin
CLASSPATH=.:ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export ORACLE_BASE ORACLE_HOME ORACLE_SID ORACLE_TERM PATH LD_LIBRARY_PATH TNS_ADMIN ORACLE_ADMIN
export CLASSPATH
export PATH=PATH:/usr/local/bin/
export LD_LIBRARY_PATH=ORACLE_HOME/rdbms/lib:/lib:/usr/lib
export PATH=ORACLE_HOME/OPatch:/bin:/usr/ccs/bin:$PATH
export CLASSPATH=ORACLE_HOME/jlib: cat /etc/sysctl.conf
Kernel sysctl configuration file for Red Hat Linux
#
For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
sysctl.conf(5) for more details.
Controls IP packet forwarding
net.ipv4.ip_forward = 0
Controls source route verification
net.ipv4.conf.default.rp_filter = 1
Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
Controls whether core dumps will append the PID to the core filename.
Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
Controls the maximum size of a message, in bytes
kernel.msgmax = 65536
Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
use for oracle
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
[[email protected] Desktop]$ cat /etc/sysctl.conf
Kernel sysctl configuration file for Red Hat Linux
#
For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
sysctl.conf(5) for more details.
Controls IP packet forwarding
net.ipv4.ip_forward = 0
Controls source route verification
net.ipv4.conf.default.rp_filter = 1
Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0
Controls whether core dumps will append the PID to the core filename.
Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1
Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536
Controls the maximum size of a message, in bytes
kernel.msgmax = 65536
Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736
Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
use for oracle
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
[[email protected] Desktop]$ cat /etc/security/limits.conf
/etc/security/limits.conf
#
Each line describes a limit for a user in the form:
#
#
use for oracle
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
Where:
can be:
- an user name
- a group name, with @group syntax
- the wildcard *, for default entry
- the wildcard %, can be also used with %group syntax,
for maxlogin limit
#
can have the two values:
- “soft” for enforcing the soft limits
- “hard” for enforcing hard limits
#
can be one of the following:
- core - limits the core file size (KB)
- data - max data size (KB)
- fsize - maximum filesize (KB)
- memlock - max locked-in-memory address space (KB)
- nofile - max number of open files
- rss - max resident set size (KB)
- stack - max stack size (KB)
- cpu - max CPU time (MIN)
- nproc - max number of processes
- as - address space limit (KB)
- maxlogins - max number of logins for this user
- maxsyslogins - max number of logins on the system
- priority - the priority to run user process with
- locks - max number of file locks the user can hold
- sigpending - max number of pending signals
- msgqueue - max memory used by POSIX message queues (bytes)
- nice - max nice priority allowed to raise to values: [-20, 19]
- rtprio - max realtime priority
#
#
* soft core 0
* hard rss 10000
@student hard nproc 20
@faculty soft nproc 20
@faculty hard nproc 50
ftp hard nproc 0
@student - maxlogins 4
End of file
[[email protected] Desktop] cat /etc/profile
/etc/profile
System wide environment and startup programs, for login setup
Functions and aliases go in /etc/bashrc
It’s NOT a good idea to change this file unless you know what you
are doing. It’s much better to create a custom.sh shell script in
/etc/profile.d/ to make custom changes to your environment, as this
will prevent the need for merging in future updates.
pathmunge () {
case “:${PATH}:” in
:”$1”:)
;;
*)
if [ “PATH:1:$PATH
fi
esac
}
if [ -x /usr/bin/id ]; then
if [ -z “$EUID” ]; then
# ksh workaround
EUID=id -u
UID=id -ru
fi
USER=”id -un”
LOGNAME=USER”
fi
Path manipulation
if [ “$EUID” = “0” ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
pathmunge /sbin after
fi
HOSTNAME=/bin/hostname 2>/dev/null
HISTSIZE=1000
if [ “$HISTCONTROL” = “ignorespace” ] ; then
export HISTCONTROL=ignoreboth
else
export HISTCONTROL=ignoredups
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
By default, we want umask to get set. This sets it for login shell
Current threshold for system reserved uid/gids is 200
You could check uidgid reservation validity in
/usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ “id -gn” = “id -un” ]; then
umask 002
else
umask 022
fi
for i in /etc/profile.d/*.sh ; do
if [ -r “{-#*i}" != "i”
else
. “$i” >/dev/null 2>&1
fi
fi
done
unset i
unset -f pathmunge
下面这段才是我们在这个文件中要添加的部分
For Oracle
if [ SHELL = “/bin/ksh” ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
[[email protected] Desktop]$
编辑/etc/pam.d/login:
cat >> /etc/pam.d/login << EOF
session required pam_limits.so
EOF
安装Oracle 10g
一.进入/stages目录,解压安装文件:(注意:stages是自己创建的目录用于存放安装包,我用ScureCRT上传的包,也可以自己安装VMwarework Station 自带的 工具VMware tool,(VMware tool 在 选项卡 “虚拟机” 的“VMware tool” 点击进行挂载,然后连接,重启机器,即可挂载成功,然后在解压包,复制到 /tm目录下,进入目录. ./vm***.pl的文件,一直回车键就可以安装成功。)安装完后,可直接将文件从window 机器上进行拖拽到虚拟机桌面中。)
(这是网上别人的安装10g 安装包解压方式
cd /stages
zcat 10201_database_linux_x86_64.cpio.gz)
开始授权安装
![这里写图片描述前面由于忘记截图,暂时省略(前面一直是点击next即可。),(https://img-blog.csdn.net/20180822142627757?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM4MjY0MTUz/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
![这里写图片描述DBCA进行创库]
[这里写图片描述ORA-27125,出现这个错误,先点击X将跳出的错误关闭,回到上一步,然后按照我下一张图的命令窗口中的命令,新打开一个窗口,然后在Oracle用户下查看其用户和组ID,然后在root用户下进行修改。(具体原因安装图解完,我会进行解释。这里的解释,也是百度别人的。
进行验证数据库是否成功
racle数据库出现ORA-27125: unable to create shared memory segment解决办法
2016年01月20日 17:14:30
我在Oracle Linux 6上安装Oracle 10.2.0.1,创建数据库时就遇到了这个错误。
这个错误的解决就是修改 /proc/sys/vm/hugetlb_shm_group 文件。
以下是老杨提到过的一个问题,解决方法相同:
帮客户解决一个Linux上数据库无法启动的问题。
客户的Linux 5.6 x86-64环境,安装数据库后,启动数据库报错:ORA-27125。
Oracle文档上关于ORA-27125错误的描述为:
ORA-27125: unable to create shared memory segment
Cause: shmget() call failed
Action: contact Oracle support
查询了一下,发现问题和linux上的hugetbl有关。
解决方法也很简单,首先检查oracle用户的组信息:
[[email protected] ~] more /proc/sys/vm/hugetlb_shm_group
0
下面用root执行下面的命令,将dba组添加到系统内核中:
echo 501 > /proc/sys/vm/hugetlb_shm_group
然后启动数据库,问题消失。
在系统重启后又会出现这个问题,ORA-27125
此时要将vm.hugetlb_shm_group = 501添加到下面这个配置文件中,如下:
vi /etc/sysctl.conf
vm.hugetlb_shm_group = 501
然后退出 sysctl -p 使其生效。
可以启动并打开数据库。
但是在重启系统后又出现数据库无法自动启动,必须手动启动,如下所示。
[[email protected] Desktop]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 22 12:35:05 2018
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> select instance_name,status from instance;
select instance_name,status from instance
*
ERROR at line 1:
ORA-01034: ORACLE not available
SQL> select instance_name,status from vinstance
*
ERROR at line 1:
ORA-01034: ORACLE not available
SQL> startup;
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 2022600 bytes
Variable Size 171967288 bytes
Database Buffers 419430400 bytes
Redo Buffers 6365184 bytes
Database mounted.
Database opened.
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
orcl OPEN
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
[[email protected] Desktop] cat /etc/oratab
#
数据库无法自动启动:
解决方案:
[[email protected] Desktop]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 22 12:35:05 2018
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> select instance_name,status from instance;
select instance_name,status from instance
*
ERROR at line 1:
ORA-01034: ORACLE not available
SQL> select instance_name,status from vinstance
*
ERROR at line 1:
ORA-01034: ORACLE not available
SQL> startup;
ORACLE instance started.
Total System Global Area 599785472 bytes
Fixed Size 2022600 bytes
Variable Size 171967288 bytes
Database Buffers 419430400 bytes
Redo Buffers 6365184 bytes
Database mounted.
Database opened.
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
orcl OPEN
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
[[email protected] Desktop] cat /etc/oratab
#
This file is used by ORACLE utilities. It is created by root.sh
and updated by the Database Configuration Assistant when creating
a database.
A colon, ‘:’, is used as the field terminator. A new line terminates
the entry. Lines beginning with a pound sign, ‘#’, are comments.
#
Entries are of the form:
ORACLE_HOME:
The first and second fields are the system identifier and home
directory of the database respectively. The third filed indicates
to the dbstart utility that the database should , “Y”, or should not,
“N”, be brought up at system boot time.
#
Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/10.2.0/db_home1:N
接下来要解决数据库如何自动重启。
[[email protected] Desktop]$ su -
password:
将N改为Y
[[email protected] ~]# cat /etc/oratab
#
This file is used by ORACLE utilities. It is created by root.sh
and updated by the Database Configuration Assistant when creating
a database.
A colon, ‘:’, is used as the field terminator. A new line terminates
the entry. Lines beginning with a pound sign, ‘#’, are comments.
#
Entries are of the form:
ORACLE_HOME:
The first and second fields are the system identifier and home
directory of the database respectively. The third filed indicates
to the dbstart utility that the database should , “Y”, or should not,
“N”, be brought up at system boot time.
#
Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/u01/app/oracle/product/10.2.0/db_home1:Y
[[email protected] ~]# cat /etc/rc.local
!/bin/sh
#
This script will be executed after all the other init scripts.
You can put your own initialization stuff in here if you don’t
want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
su - oracle -lc “/u01/app/oracle/product/10.2.0/db_home1/bin/lsnrctl start”
su - oracle -lc /u01/app/oracle/product/10.2.0/db_home1/bin/dbstart
[[email protected] ~]# reboot
[[email protected] Desktop]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 22 13:42:40 2018
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
orcl OPEN
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
这里是运行10g安装包时,缺少相应的包,无法运行 runInstall 文件(./runInstall);
需要用yum进行安装,(我上一篇文章中描述了如何配置本地yum源)
yum -y install autoconf automake binutils-devel bison cpp dos2unix ftp gcc gcc-c++ lrzsz python-devel
yum -y install compat-db compat-gcc-34 compat-gcc-34-c++ compat-libstdc++-33 glibc-* glibc-.i686 libXpm-.i686 libXp.so.6 libXt.so.6 libXtst.so.6 libgcc_s.so.1 ksh libXp libaio-devel numactl numactl-devel unixODBC unixODBC-devel