[oracle@udbs01 Desktop] cat/etc/sysconfig/networkNETWORKING=yesHOSTNAME=udbs01[oracle@udbs01Desktop] c a t / e t c / s y s c o n f i g / n e t w o r k N E T W O R K I N G = y e s H O S T N A M E = u d b s 01 [ o r a c l e @ u d b s 01 D e s k t o p ]
[oracle@udbs01 Desktop]
cat/etc/hosts/cat:/etc/hosts/:Notadirectory[oracle@udbs01Desktop]
c
a
t
/
e
t
c
/
h
o
s
t
s
/
c
a
t
:
/
e
t
c
/
h
o
s
t
s
/
:
N
o
t
a
d
i
r
e
c
t
o
r
y
[
o
r
a
c
l
e
@
u
d
b
s
01
D
e
s
k
t
o
p
]
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
[oracle@udbs01 Desktop]
cat/etc/sysconfig/network−scripts/ifcfg−eth0DEVICE=eth0HWADDR=00:0C:29:0B:08:30TYPE=EthernetUUID=8ed1b6a8−bbf7−4256−9e60−e4d76f311fb8IPADDR=192.168.0.20NETMASK=255.255.255.0GATEWAY=192.168.0.254ONBOOT=yesNMCONTROLLED=yesBOOTPROTO=none[oracle@udbs01Desktop]
c
a
t
/
e
t
c
/
s
y
s
c
o
n
f
i
g
/
n
e
t
w
o
r
k
−
s
c
r
i
p
t
s
/
i
f
c
f
g
−
e
t
h
0
D
E
V
I
C
E
=
e
t
h
0
H
W
A
D
D
R
=
00
:
0
C
:
29
:
0
B
:
08
:
30
T
Y
P
E
=
E
t
h
e
r
n
e
t
U
U
I
D
=
8
e
d
1
b
6
a
8
−
b
b
f
7
−
4256
−
9
e
60
−
e
4
d
76
f
311
f
b
8
I
P
A
D
D
R
=
192.168.0.20
N
E
T
M
A
S
K
=
255.255.255.0
G
A
T
E
W
A
Y
=
192.168.0.254
O
N
B
O
O
T
=
y
e
s
N
M
C
O
N
T
R
O
L
L
E
D
=
y
e
s
B
O
O
T
P
R
O
T
O
=
n
o
n
e
[
o
r
a
c
l
e
@
u
d
b
s
01
D
e
s
k
t
o
p
]
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
[oracle@udbs01 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= PATH: P A T H : HOME/bin
export PATH
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=
ORACLEBASE/product/10.2.0/dbhome1exportTERM=xtermexportPATH=
O
R
A
C
L
E
B
A
S
E
/
p
r
o
d
u
c
t
/
10.2.0
/
d
b
h
o
m
e
1
e
x
p
o
r
t
T
E
R
M
=
x
t
e
r
m
e
x
p
o
r
t
P
A
T
H
=
PATH:/usr/sbin:
ORACLEHOME/binexportLDLIBRARYPATH=
O
R
A
C
L
E
H
O
M
E
/
b
i
n
e
x
p
o
r
t
L
D
L
I
B
R
A
R
Y
P
A
T
H
=
ORACLE_HOME/lib:/lib:/usr/lib:/lib64:/usr/lib64
TNS_ADMIN=$ORACLE_HOME/network/admin
ORACLE_ADMIN=$ORACLE_BASE/admin
CLASSPATH=.: ORACLEHOME/jre: O R A C L E H O M E / j r e : 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= ORACLEHOME/bin: O R A C L E H O M E / b i n : PATH:/usr/local/bin/
export LD_LIBRARY_PATH= ORACLEHOME/lib: O R A C L E H O M E / l i b : ORACLE_HOME/rdbms/lib:/lib:/usr/lib
export PATH= ORACLEHOME/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/sbin: O R A C L E H O M E / b i n : / u s r / b i n : / e t c : / u s r / s b i n : / u s r / u c b : / s b i n : ORACLE_HOME/OPatch:/bin:/usr/ccs/bin:$PATH
export CLASSPATH= ORACLEHOME/JRE: O R A C L E H O M E / J R E : ORACLE_HOME/jlib: ORACLEHOME/rdbms/jlib[oracle@udbs01Desktop] O R A C L E H O M E / r d b m s / j l i b [ o r a c l e @ u d b s 01 D e s k t o p ] 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
[oracle@udbs01 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
[oracle@udbs01 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
[oracle@udbs01 Desktop] catcatcatchsegv[oracle@udbs01Desktop] c a t c a t c a t c h s e g v [ o r a c l e @ u d b s 01 D e s k t o p ] 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 [ “
2”=“after”];thenPATH=
2
”
=
“
a
f
t
e
r
”
]
;
t
h
e
n
P
A
T
H
=
PATH:
1elsePATH=
1
e
l
s
e
P
A
T
H
=
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=
USERMAIL=”/var/spool/mail/
U
S
E
R
M
A
I
L
=
”
/
v
a
r
/
s
p
o
o
l
/
m
a
i
l
/
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”];thenif[“
i
”
]
;
t
h
e
n
i
f
[
“
{-#*i}" != "
−”];then.“
−
”
]
;
t
h
e
n
.
“
i”
else
. “$i” >/dev/null 2>&1
fi
fi
done
unset i
unset -f pathmunge
下面这段才是我们在这个文件中要添加的部分
For Oracle
if [
USER=“oracle”];thenif[
U
S
E
R
=
“
o
r
a
c
l
e
”
]
;
t
h
e
n
i
f
[
SHELL = “/bin/ksh” ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
[oracle@udbs01 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用户的组信息:
[oracle@yans1 ~]
idoracleuid=500(oracle)gid=502(oinstall)groups=502(oinstall),501(dba)[oracle@yans1 ]
i
d
o
r
a
c
l
e
u
i
d
=
500
(
o
r
a
c
l
e
)
g
i
d
=
502
(
o
i
n
s
t
a
l
l
)
g
r
o
u
p
s
=
502
(
o
i
n
s
t
a
l
l
)
,
501
(
d
b
a
)
[
o
r
a
c
l
e
@
y
a
n
s
1
]
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 使其生效。
可以启动并打开数据库。
但是在重启系统后又出现数据库无法自动启动,必须手动启动,如下所示。
[oracle@udbs02 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 v
instance;selectinstancename,statusfromv
i
n
s
t
a
n
c
e
;
s
e
l
e
c
t
i
n
s
t
a
n
c
e
n
a
m
e
,
s
t
a
t
u
s
f
r
o
m
v
instance
*
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
[oracle@udbs02 Desktop]
cat/etc/oraoracle−releaseoraInst.locoratab[oracle@udbs02Desktop]
c
a
t
/
e
t
c
/
o
r
a
o
r
a
c
l
e
−
r
e
l
e
a
s
e
o
r
a
I
n
s
t
.
l
o
c
o
r
a
t
a
b
[
o
r
a
c
l
e
@
u
d
b
s
02
D
e
s
k
t
o
p
]
cat /etc/oratab
#
数据库无法自动启动:
解决方案:
[oracle@udbs02 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 v
instance;selectinstancename,statusfromv
i
n
s
t
a
n
c
e
;
s
e
l
e
c
t
i
n
s
t
a
n
c
e
n
a
m
e
,
s
t
a
t
u
s
f
r
o
m
v
instance
*
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
[oracle@udbs02 Desktop]
cat/etc/oraoracle−releaseoraInst.locoratab[oracle@udbs02Desktop]
c
a
t
/
e
t
c
/
o
r
a
o
r
a
c
l
e
−
r
e
l
e
a
s
e
o
r
a
I
n
s
t
.
l
o
c
o
r
a
t
a
b
[
o
r
a
c
l
e
@
u
d
b
s
02
D
e
s
k
t
o
p
]
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:
ORACLESID: O R A C L E S I D : 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
接下来要解决数据库如何自动重启。
[oracle@udbs02 Desktop]$ su -
password:
将N改为Y
[root@udbs02 ~]# 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:
ORACLESID: O R A C L E S I D : 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
[root@udbs02 ~]# 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
[root@udbs02 ~]# reboot
[oracle@udbs02 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