Archive

Posts Tagged ‘Oracle’

HP-UX Ioctl ASYNC_CONFIG error, errno = 1

June 18th, 2010 wajoynece 2 comments
数据库udump目录下包含了29592个trace文件, 占用10GB多的空间:
#ls | wc -l
29592
#du -sk
14390876        .
trace文件内容如下:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
System name:    HP-UX
Release:        B.11.31
Version:        U
Machine:        ia64
Redo thread mounted by this instance: 1
Oracle process number: 0
Ioctl ASYNC_CONFIG error, errno = 1
这个问题来源于启用了async io的hp unix系统, dba组没有mlock权限造成的;
查看/etc/privgroup文件, 发现第一行有一个注释, 进一步查看当前系统没有使用/dev/async, 同时dba组也没有MLOCK权限;
#cat /etc/privgroup
# ORACLE async i/o
dba MLOCK RTPRIO RTSCHED
#getprivgrp dba
dba:
#fuser /dev/async
/dev/async:
问题其实恰恰出现在/etc/privgroup中的注释行, 在去掉注释后, /dev/async启用, udump下不再产生日志.
#vi /etc/privgroup
“/etc/privgroup” 2 lines, 44 characters
dba MLOCK RTSCHED RTPRIO
#setprivgrp -f /etc/privgroup
#getprivgrp dba
dba: RTPRIO MLOCK RTSCHED
#fuser /dev/async
/dev/async:     3613o    3622o    3624o    3583o    3585o    3588o
总结: 有些系统配置文件不要轻易加注释.
参考metalink:
How to Disable Asynch_io on HP to Avoid Ioctl Async_config Error Errno = 1 [ID 302801.1]
http://www.oracleblog.cn/working-case/how-to-open-async-io-on-hpux/
http://www.eygle.com/archives/2009/11/hp-ux_async_config.html
Categories: Oracle Tags: , ,

故障ORA-12516诊断

August 18th, 2009 wajoynece No comments

现场报告连接数据库报错:ORA-12519 TNS: no appropriate service handler found

这个错误没遇到过,登录现场环境确认报错情况属实,sqlplus / as sysdba不能登录数据库;

检查操作系统oracle进程数目,与processes=600的设定比较接近;

检查应用服务器连接池连接情况,2台weblogic连接池current都是200,加起来400,有2台tomcat,current情况未知,配置最大75;

检查listener,发现state是blocked

‘”DEDICATED” established:1 refused:0 state:blocked’

这里比较异常,正常情况下应该是ready,不解;

求助metalink 240710.1 找到了原因:

By way of instance registration, PMON is responsible for updating the listener
with information about a particular instance such as load and dispatcher
information. Maximum load for dedicated connections is determined by the
PROCESSES parameter. The frequency at which PMON provides SERVICE_UPDATE
information varies according to the workload of the instance. The maximum
interval between these service updates is 10 minutes.

The listener counts the number of connections it has established to the instance
but does not immediately get information about connections that have terminated.
Only when PMON updates the listener via SERVICE_UPDATE is the listener
informed of current load. Since this can take as long as 10 minutes, there can be
a difference between the current instance load according to the listener
and the actual instance load.

When the listener believes the current number of connections has reached maximum
load, it may set the state of the service handler for an instance to “blocked”
and begin refusing incoming client connections with either of the following
errors:

TNS-12516 TNS:listener could not find instance with matching protocol stack

pmon动态instance信息到listener,这其中就包括process数目的信息,当到达限制时,pmon会通知listener别再申请连接了,listener把相应的服务状态修改为:blocked,客户端再次连接就会报12516错误。

开始解决:两台tomcat服务器运行了归档查询业务,是最近新添加的服务,问题也就出在这里;

关闭tomcat服务器;过一会查看监听状态,发现已经变为ready,sqlplus / as sysdba尝试连接数据库,已经可以连接;

进一步查看session信息,发现tomcat服务器仍然有144个连接,说明tomcat连接有严重泄露情况;

最终,把processes增大,tomcat=>weblogic,期望可以解决这一问题。

Categories: Oracle Tags: ,

ASM之迁移到ASM

August 11th, 2009 wajoynece No comments

oracle@wayne-laptop:~$ rman target /

Recovery Manager: Release 10.2.0.4.0 – Production on Tue Aug 11 16:20:41 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: ORA10G (DBID=4013050375)

RMAN> BACKUP AS COPY INCREMENTAL LEVEL 0  DATABASE FORMAT ‘+dg1′TAG ‘ORA_ASM_MIGRATION’;

Starting backup at 11-AUG-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile fno=00001 name=/home/oracle/app/oradata/ora10g/system01.dbf
output filename=+DG1/ora10g/datafile/system.264.694628679 tag=ORA_ASM_MIGRATION recid=7 stamp=694628715
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile fno=00002 name=/home/oracle/app/oradata/ora10g/undotbs01.dbf
output filename=+DG1/ora10g/datafile/undotbs1.265.694628721 tag=ORA_ASM_MIGRATION recid=8 stamp=694628745
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile fno=00003 name=/home/oracle/app/oradata/ora10g/sysaux01.dbf
output filename=+DG1/ora10g/datafile/sysaux.266.694628757 tag=ORA_ASM_MIGRATION recid=9 stamp=694628773
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting datafile copy
input datafile fno=00005 name=/home/oracle/app/oradata/ORA10G/datafile/o1_mf_wayne_57q7y8hp_.dbf
output filename=+DG1/ora10g/datafile/wayne.268.694628781 tag=ORA_ASM_MIGRATION recid=10 stamp=694628787
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile fno=00004 name=/home/oracle/app/oradata/ora10g/users01.dbf
output filename=+DG1/ora10g/datafile/users.261.694628797 tag=ORA_ASM_MIGRATION recid=11 stamp=694628796
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting datafile copy
copying current control file
output filename=+DG1/ora10g/controlfile/backup.262.694628797 tag=ORA_ASM_MIGRATION recid=12 stamp=694628799
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 11-AUG-09
channel ORA_DISK_1: finished piece 1 at 11-AUG-09
piece handle=+DG1/ora10g/backupset/2009_08_11/nnsnn0_ora_asm_migration_0.263.694628803 tag=ORA_ASM_MIGRATION comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 11-AUG-09

RMAN> run {
2> backup as backupset spfile;
3> restore spfile to ‘+dg1/spfile’;
4> }

Starting backup at 11-AUG-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 11-AUG-09
channel ORA_DISK_1: finished piece 1 at 11-AUG-09
piece handle=/home/oracle/app/flash_recovery_area/ORA10G/backupset/2009_08_11/o1_mf_nnsnf_TAG20090811T162849_582by1ts_.bkp tag=TAG20090811T162849 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 11-AUG-09

Starting restore at 11-AUG-09
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring SPFILE
output filename=+dg1/spfile
channel ORA_DISK_1: reading from backup piece /home/oracle/app/flash_recovery_area/ORA10G/backupset/2009_08_11/o1_mf_nnsnf_TAG20090811T162849_582by1ts_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/app/flash_recovery_area/ORA10G/backupset/2009_08_11/o1_mf_nnsnf_TAG20090811T162849_582by1ts_.bkp tag=TAG20090811T162849
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 11-AUG-09

RMAN> exit

Recovery Manager complete.
oracle@wayne-laptop:~$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 – Production on Tue Aug 11 16:29:42 2009

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> startup force nomount PFILE=”/tmp/pfile.ora”;
ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size            1266584 bytes
Variable Size          100666472 bytes
Database Buffers       96468992 bytes
Redo Buffers            7118848 bytes
SQL> alter system set control_files=’+dg1/ct1.f’,'+fra/ct2.f’ scope=spfile;

System altered.

SQL> alter system set DB_RECOVERY_FILE_DEST_SIZE=2g scope=spfile;

System altered.

SQL> alter system set DB_RECOVERY_FILE_DEST=’+fra’ scope=spfile;

System altered.

SQL> shutdown immediate
ORA-01507: database not mounted

ORACLE instance shut down.
SQL> startup nomount PFILE=”/tmp/pfile.ora”;
ORACLE instance started.

Total System Global Area  205520896 bytes
Fixed Size            1266584 bytes
Variable Size          100666472 bytes
Database Buffers       96468992 bytes
Redo Buffers            7118848 bytes
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
oracle@wayne-laptop:~$ rman target /

Recovery Manager: Release 10.2.0.4.0 – Production on Tue Aug 11 16:33:18 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: ora10g (not mounted)

RMAN> restore controlfile from ‘/home/oracle/app/oradata/ora10g/control03.ctl’;

Starting restore at 11-AUG-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: copied control file copy
output filename=+DG1/ct1.f
output filename=+FRA/ct2.f
Finished restore at 11-AUG-09

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> switch database to copy;

datafile 1 switched to datafile copy “+DG1/ora10g/datafile/system.264.694628679″
datafile 2 switched to datafile copy “+DG1/ora10g/datafile/undotbs1.265.694628721″
datafile 3 switched to datafile copy “+DG1/ora10g/datafile/sysaux.266.694628757″
datafile 4 switched to datafile copy “+DG1/ora10g/datafile/users.261.694628797″
datafile 5 switched to datafile copy “+DG1/ora10g/datafile/wayne.268.694628781″

RMAN> recover database;

Starting recover at 11-AUG-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

starting media recovery
media recovery complete, elapsed time: 00:00:03

Finished recover at 11-AUG-09

RMAN> run {
set newname for tempfile 1 to ‘+dg1′;
switch tempfile all;
}

2> 3> 4>
executing command: SET NEWNAME

renamed temporary file 1 to +dg1 in control file

RMAN> ALTER DATABASE OPEN;

database opened

RMAN> exit

Recovery Manager complete.

oracle@wayne-laptop:~$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 – Production on Tue Aug 11 16:39:03 2009

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>
SQL>
declare
cursor rlc is
select group# grp, thread# thr, bytes/1024 bytes_k, ‘NO’ srl
from v$log
union
select group# grp, thread# thr, bytes/1024 bytes_k, ‘YES’ srl
from v$standby_log
order by 1;
stmt     varchar2(2048);
swtstmt  varchar2(1024) := ‘alter system switch logfile’;
ckpstmt  varchar2(1024) := ‘alter system checkpoint global’;
begin
for rlcRec in rlc loop
if (rlcRec.srl = ‘YES’) then
stmt := ‘alter database add standby logfile thread ‘ ||
rlcRec.thr || ‘ ”+DG1” size ‘ ||
rlcRec.bytes_k || ‘K’;
execute immediate stmt;
stmt := ‘alter database drop standby logfile group ‘ || rlcRec.grp;
execute immediate stmt;
else
stmt := ‘alter database add logfile thread ‘ ||
rlcRec.thr || ‘ ”+DG1” size ‘ ||
rlcRec.bytes_k || ‘K’;
execute immediate stmt;
begin
stmt := ‘alter database drop logfile group ‘ || rlcRec.grp;
dbms_output.put_line(stmt);
execute immediate stmt;
exception
when others then
execute immediate swtstmt;
execute immediate ckpstmt;
execute immediate stmt;
end;
end if;
end loop;
38  end;
39  /

PL/SQL procedure successfully completed.

Categories: Oracle Tags: ,

ASM之建立实验环境

August 10th, 2009 wajoynece 4 comments

准备模拟磁盘文件

root@wayne-laptop:/home/oracle/test# for i in 0 1 2 3 ;do dd if=/dev/zero of=file_disk$i bs=1024 count=524288 ; done
524288+0 records in
524288+0 records out
536870912 bytes (537 MB) copied, 14.0764 s, 38.1 MB/s
524288+0 records in
524288+0 records out
536870912 bytes (537 MB) copied, 15.2912 s, 35.1 MB/s
524288+0 records in
524288+0 records out
536870912 bytes (537 MB) copied, 18.8882 s, 28.4 MB/s
524288+0 records in
524288+0 records out
536870912 bytes (537 MB) copied, 18.276 s, 29.4 MB/s
root@wayne-laptop:/home/oracle/test# ls -l
total 2099216
-rw-r–r– 1 root root 536870912 2009-08-10 10:48 file_disk0
-rw-r–r– 1 root root 536870912 2009-08-10 10:48 file_disk1
-rw-r–r– 1 root root 536870912 2009-08-10 10:49 file_disk2
-rw-r–r– 1 root root 536870912 2009-08-10 10:49 file_disk3

创建loop设备

root@wayne-laptop:/home/oracle/test# for i in 0 1 2 3 ; do losetup /dev/loop$i file_disk$i; done
root@wayne-laptop:/home/oracle/test# losetup -a
/dev/loop0: [0805]:1917697 (file_disk0)
/dev/loop1: [0805]:1917709 (file_disk1)
/dev/loop2: [0805]:1917711 (file_disk2)
/dev/loop3: [0805]:1917712 (file_disk3)
root@wayne-laptop:/dev# chown oracle:dba /dev/loop*

配置css

+++++++++++++++出现的问题以及解决++++++++++++++++++++++++++
root@wayne-laptop:/home/oracle/app/10.2.0/db_1/bin# localconfig add
/home/oracle/app/10.2.0/db_1/bin/crsctl.bin: /usr/lib/libstdc++.so.5: version `CXXABI_1.2′ not found (required by /home/oracle/app/10.2.0/db_1/bin/crsctl.bin)
/home/oracle/app/10.2.0/db_1/bin/crsctl.bin: /usr/lib/libstdc++.so.5: version `GLIBCPP_3.2′ not found (required by /home/oracle/app/10.2.0/db_1/bin/crsctl.bin)

root@wayne-laptop:/home/oracle/app/10.2.0/db_1/bin# cd /usr/lib
root@wayne-laptop:/usr/lib# ls -l | grep libstdc__
root@wayne-laptop:/usr/lib# ls -l | grep libstdc++
lrwxrwxrwx 1 root root 23 2009-05-12 11:16 libstdc++.so.5 -> /usr/lib/libstdc++.so.6
lrwxrwxrwx 1 root root 18 2009-05-11 18:32 libstdc++.so.6 -> libstdc++.so.6.0.9
-rw-r–r– 1 root root 970680 2009-02-19 18:42 libstdc++.so.6.0.9

root@wayne-laptop:/usr/lib# aptitude install libstdc++5
root@wayne-laptop:/usr/lib# ln -sf libstdc++.so.5.0.7 libstdc++.so.5
+++++++++++++++++++++++++++++++++++++++++

root@wayne-laptop:/home/oracle/app/10.2.0/db_1/bin# mkdir -p /var/lock/subsys
root@wayne-laptop:/home/oracle/app/10.2.0/db_1/bin# localconfig reset
Successfully accumulated necessary OCR keys.
Creating OCR keys for user ‘root’, privgrp ‘root’..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process…
Expecting the CRS daemons to be up within 600 seconds.

^c

root@wayne-laptop:/home/oracle/app/10.2.0/db_1/bin# nohup /etc/init.d/init.cssd run >/dev/null 2>&1
[1] 17991

创建asm实例

$ dbca -silent -configureASM \
-asmSysPassword change_on_install \
-diskString “/dev/loop*” \
-diskList /dev/loop1 \
-diskGroupName DG1 \
-redundancy EXTERNAL

Categories: Oracle Tags: ,

SQL优化之过长的in list和过多的or操作

August 3rd, 2009 wajoynece 4 comments

CBO面对in (1,2,3,……)或者类似的or操作会做些什么呢?
1. 把in转换为union all操作,从而用到索引加快查询,可以使用use_concat提示强制该转换,这么做的缺点在于CBO面对每个union all操作都要计算cost,导致parse时间过长,解决办法见2;
2. 对应的操作为inlist iterator,可以使用NO_EXPAND提示强制进行,即使用了索引,同时避免了union all带来的cost计算问题;

还有一个从设计角度优化这个问题的思路:就是建表保存in数据,用join代替in操作。

Categories: Uncategorized Tags: ,

SQL优化之checkpoint not complete

July 28th, 2009 wajoynece 4 comments

话说从前有一个从excel导入到数据库中的功能,近来该功能“超级”缓慢,严重影响生产活动。

从告警日志中,可以找到一些线索:日志切换非常频繁,出现多处checkpoint not complete。

同时,在系统中查询产生redo最多的会话,正是上面提到的那个功能,导入不到1w条数据,竟然累计产生近10G的redo!!!

到这里,已经有理由怀疑是这个功能出现的问题,导致过多的redo,进一步产生checkpoint not complete等待;

OK,10046,终于找到了问题的根源:不合理使用的物化视图

在导入功能相关的数据库表上,建有一个物化视图,我们知道物化视图刷新可以on commit,on demand,而这里使用了on commit,而且每次都是全刷新;更糟糕的是,导入功能是每条记录提交一次!

也就是说:每导入一条数据,物化视图需要清空,重新刷新数据。

解决思路:

  • 物化视图刷新模式修改为on demand
  • 物化视图全刷新变为快速刷新
  • 导入数据使用分批提交方式
Categories: Oracle Tags: ,

debian i686 oracledb install tips

July 21st, 2009 wajoynece No comments

apt-get install make gcc g++ libc6-dev libstdc++5 libaio1 unzip
mkdir /etc/rc.d
for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done
ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/basename /bin/basename

Categories: Linux, Oracle Tags: , ,

ORACLE 10G install steps on ubuntu 8.10 x64 server

July 20th, 2009 wajoynece No comments

安装过程中遇到不少问题,记录一下:

wayne@wayne-laptop:~/.ssh$ ssh -X holly@10.8.66.201

holly@10.8.66.201′s password:

Linux ubuntu108 2.6.24-19-server #1 SMP Wed Jun 18 14:44:47 UTC 2008 x86_64

The programs included with the Ubuntu system are free software;

the exact distribution terms for each program are described in the

individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by

applicable law.

To access official Ubuntu documentation, please visit:

http://help.ubuntu.com/

Last login: Mon Jul 20 09:34:34 2009 from 10.8.10.154

holly@ubuntu108:~$ sudo su -

root@ubuntu108:~#

root@ubuntu108:~# hostname

ubuntu108

root@ubuntu108:~# apt-get update

……

root@ubuntu108:~# apt-get install build-essential libaio1 gawk ksh libmotif3 alien libtool lsb-rpm

……

root@ubuntu108:~# cd /bin

root@ubuntu108:/bin# ls -l /bin/sh

lrwxrwxrwx 1 root root 4 Jul 17 22:33 /bin/sh -> dash

root@ubuntu108:/bin# ln -sf bash /bin/sh

root@ubuntu108:/bin# ls -l /bin/sh

lrwxrwxrwx 1 root root 4 Jul 20 09:45 /bin/sh -> bash

root@ubuntu108:/bin# addgroup oinstall

Adding group `oinstall’ (GID 1001) …

Done.

root@ubuntu108:/bin# addgroup dba

Adding group `dba’ (GID 1002) …

Done.

root@ubuntu108:/bin# addgroup nobody

Adding group `nobody’ (GID 1003) …

Done.

root@ubuntu108:/bin# usermod -g nobody nobody

root@ubuntu108:/bin# useradd -g oinstall -G dba -p oracle -d /home/oracle -s /bin/bash oracle

root@ubuntu108:/bin# passwd -l oracle

Password changed.

root@ubuntu108:/bin# mkdir /home/oracle

root@ubuntu108:/bin# chown -R oracle:dba /home/oracle

root@ubuntu108:/bin# ln -s /usr/bin/awk /bin/awk

root@ubuntu108:/bin# ln -s /usr/bin/rpm /bin/rpm

root@ubuntu108:/bin# ln -s /usr/bin/basename /bin/basename

root@ubuntu108:/bin# ln -s /lib/libgcc_s.so.1 /lib/libgcc_s.so

root@ubuntu108:/bin# mkdir /etc/rc.d

root@ubuntu108:/bin# for i in 0 1 2 3 4 5 6 S ; do ln -s /etc/rc$i.d /etc/rc.d/rc$i.d ; done

root@ubuntu108:/bin# mkdir -p /oracle

root@ubuntu108:/bin# chown -R oracle:dba /oracle

root@ubuntu108:/bin# echo “fs.file-max = 65536″ >> /etc/sysctl.conf

root@ubuntu108:/bin# echo “kernel.shmall = 2097152″ >> /etc/sysctl.conf

root@ubuntu108:/bin# echo “kernel.shmmax = 2147483648″ >> /etc/sysctl.conf

root@ubuntu108:/bin# echo “kernel.shmmni = 4096″ >> /etc/sysctl.conf

root@ubuntu108:/bin# echo “kernel.sem = 250 32000 100 128″ >> /etc/sysctl.conf

root@ubuntu108:/bin# echo “net.ipv4.ip_local_port_range = 1024 65535″ >> /etc/sysctl.conf

root@ubuntu108:/bin# echo “net.core.rmem_default = 262144″ >> /etc/sysctl.conf

root@ubuntu108:/bin# echo “net.core.rmem_max = 262144″ >> /etc/sysctl.conf

root@ubuntu108:/bin# echo “net.core.wmem_max = 262144″ >> /etc/sysctl.conf

root@ubuntu108:/bin# echo “net.core.wmem_default = 262144″ >> /etc/sysctl.conf

root@ubuntu108:/bin# echo “oracle soft nproc 2047″ >> /etc/security/limits.conf

root@ubuntu108:/bin# echo “oracle hard nproc 16384″ >> /etc/security/limits.conf

root@ubuntu108:/bin# echo “oracle soft nfile 1024″ >> /etc/security/limits.conf

root@ubuntu108:/bin# echo “oracle hard nofile 65530″ >> /etc/security/limits.conf

root@ubuntu108:/bin# sysctl -p

kernel.printk = 4 4 1 7

kernel.maps_protect = 1

fs.inotify.max_user_watches = 524288

vm.mmap_min_addr = 65536

net.ipv4.conf.default.rp_filter = 1

net.ipv4.conf.all.rp_filter = 1

fs.file-max = 65536

kernel.shmall = 2097152

kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 1024 65535

net.core.rmem_default = 262144

net.core.rmem_max = 262144

net.core.wmem_max = 262144

net.core.wmem_default = 262144

root@ubuntu108:/bin# su – oracle

Your account has expired; please contact your system administrator

su: User account has expired

(Ignored)

oracle@ubuntu108:~$ pwd

/home/oracle

oracle@ubuntu108:~$ wget ftp://usr:pwd@10.8.2.70/Oracle/10g/10201_database_linux_x86_64.cpio.gz–10:06:07– ftp://hollycrm:*password*@10.8.2.70/

……

oracle@ubuntu108:~$ ls

10201_database_linux_x86_64.cpio.gz

oracle@ubuntu108:~$ gunzip 10201_database_linux_x86_64.cpio.gz

oracle@ubuntu108:~$ ls

10201_database_linux_x86_64.cpio

oracle@ubuntu108:~$ cpio -idmv < 10201_database_linux_x86_64.cpio

……

oracle@ubuntu108:~$ ls

10201_database_linux_x86_64.cpio database

oracle@ubuntu108:~$ cd database/

oracle@ubuntu108:~/database$ ./runInstaller -help

./runInstaller: line 52: /home/oracle/database/install/.oui: No such file or directory

oracle@ubuntu108:~/database$ cd install

oracle@ubuntu108:~/database/install$ ls -al

total 364

drwxr-xr-x 5 oracle oinstall 4096 2009-07-20 10:11 .

drwxr-xr-x 6 oracle oinstall 4096 2009-07-20 10:11 ..

-rwxr-xr-x 1 oracle oinstall 28 2005-10-23 15:49 addLangs.sh

-rwxr-xr-x 1 oracle oinstall 76 2005-10-23 15:49 addNode.sh

drwxr-xr-x 2 oracle oinstall 4096 2009-07-20 10:11 images

-rwxr-xr-x 1 oracle oinstall 46448 2005-10-23 15:49 lsnodes

-rwxr-xr-x 1 oracle oinstall 2268 2005-10-23 15:49 oneclick.properties

-rwxr-xr-x 1 oracle oinstall 2387 2005-10-23 15:49 oraparam.ini

-rwxr-xr-x 1 oracle oinstall 6428 2005-10-23 15:49 oraparamsilent.ini

-rwxr-xr-x 1 oracle oinstall 163185 2005-10-23 15:49 .oui

drwxr-xr-x 2 oracle oinstall 4096 2009-07-20 10:11 resource

drwxr-xr-x 2 oracle oinstall 4096 2009-07-20 10:11 response

-rwxr-xr-x 1 oracle oinstall 102612 2005-10-23 15:49 unzip

–这里遇到这个问题,具体原因是由于Oracle数据库64位安装介质使用了32位的安装程序,而系统中没有32位包。

root@ubuntu108:/usr/X11R6# apt-get install ia32-libs

Reading package lists… Done

……

ldconfig deferred processing now taking place

oracle@ubuntu108:/oracle/database$ export DISPLAY=10.8.10.154:0.0

oracle@ubuntu108:/oracle/database$ export LANG=us_EN.UTF-8

oracle@ubuntu108:/oracle/database$ ./runInstaller -ignoreSysPrereqs -record -destinationFile /oracle/orainstall.rsp

……

oracle@ubuntu108:/oracle/database$ ./runInstaller -ignoreSysPrereqs -silent -responseFile /oracle/orainstall.rsp

……

WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.

To register the new inventory please run the script ‘/home/oracle/oraInventory/orainstRoot.sh’ with root privileges.

If you do not register the inventory, you may not be able to update or patch the products you installed.

The following configuration scripts

/home/oracle/oracle/product/10.2.0/db_1/root.sh

need to be executed as root for configuring the system. If you skip the execution of the configuration tools, the configuration will not be complete and the product wont function properly. In order to get the product to function properly, you will be required to execute the scripts and the configuration tools after exiting the OUI.

The installation of Oracle Database 10g was successful.

Please check ‘/home/oracle/oraInventory/logs/silentInstall2009-07-20_02-41-14PM.log‘ for more details.

这里应该查看/home/oracle/oraInventory/logs/silentInstall2009-07-20_02-41-14PM.log,看是否有报错信息;我安装过程中没有注意,结果后面打补丁报出跟这里一样的错误。

****************************************************************************

root@ubuntu108:~# /home/oracle/oraInventory/orainstRoot.sh

Changing permissions of /home/oracle/oraInventory to 770.

Changing groupname of /home/oracle/oraInventory to oinstall.

The execution of the script is complete

root@ubuntu108:~# /home/oracle/oracle/product/10.2.0/db_1/root.sh

Running Oracle10 root.sh script…

The following environment variables are set as:

ORACLE_OWNER= oracle

ORACLE_HOME= /home/oracle/oracle/product/10.2.0/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:

Copying dbhome to /usr/local/bin …

Copying oraenv to /usr/local/bin …

Copying coraenv to /usr/local/bin …

Creating /etc/oratab file…

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root.sh script.

Now product-specific root actions will be performed.

****************************************************************************


–打补丁:

–第一次图形安装报错,日志如下(查看日志的过程中,发现这个错误在之前的静默安装日志中已经报错):

INFO: /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../libpthread.so when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../libpthread.a when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/bin/../lib/libpthread.so when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/bin/../lib/libpthread.a when searching for -lpthread

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.so when searching for -lp

INFO: thread

/usr/bin/ld: skipping incompatible /usr/lib/libpthread.a when searching for -lpthread

/usr/bin/ld: cannot find -lpthread

collect2: ld returned 1 exit status

INFO: make[1]: *** [/home/oracle/oracle/product/10.2.0/db_1/sysman/lib/libnmemso.so] Error 1

INFO: make[1]: Leaving directory `/home/oracle/oracle/product/10.2.0/db_1/sysman/lib’

INFO: make: *** [libnmemso] Error 2

INFO: End output from spawned process.

INFO: ———————————-

INFO: Exception thrown from action: make

Exception Name: MakefileException

Exception String: Error in invoking target ‘agent’ of makefile ‘/home/oracle/oracle/product/10.2.0/db_1/sysman/lib/ins_sysman.mk’. See ‘/home/oracle/oraInventory/logs/installActions2009-07-20_02-54-28PM.log’ for details.

Exception Severity: 1

–继续安装包

root@ubuntu108:/home/oracle/oraInventory/logs# sudo apt-get install gcc libaio1 lesstif2 lesstif2-dev make libc6 libc6-i386 libc6-dev-i386 libstdc++5 lib32stdc++6 lib32z1 ia32-libs

……

–报错:

INFO: /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.2.4/libgcc.a when searching for -lgcc

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.2.4/libgcc.a when searching for -lgcc

/usr/bin/ld: cannot find -lgcc

INFO: collect2: ld returned 1 exit status

make[1]: *** [/home/oracle/oracle/product/10.2.0/db_1/sysman/lib/libnmemso.so] Error 1

INFO: make[1]: Leaving directory `/home/oracle/oracle/product/10.2.0/db_1/sysman/lib’

INFO: make: *** [libnmemso] Error 2

INFO: End output from spawned process.

INFO: ———————————-

INFO: Exception thrown from action: make

Exception Name: MakefileException

Exception String: Error in invoking target ‘agent’ of makefile ‘/home/oracle/oracle/product/10.2.0/db_1/sysman/lib/ins_sysman.mk’. See ‘/home/oracle/oraInventory/logs/installActions2009-07-20_03-10-03PM.log’ for details.

Exception Severity: 1

–继续安装包

root@ubuntu108:/home/oracle/oraInventory/logs# apt-get install gcc-multilib

……

oracle@ubuntu108:/oracle/Disk1$ ./runInstaller -ignoreSysPrereqs -record -destinationFile /oracle/oraupdate.rsp

……

oracle@ubuntu108:/oracle/Disk1$ ./runInstaller -ignoreSysPrereqs -silent -responseFile /oracle/oraupdate.rsp

……

WARNING:
The following configuration scripts need to be executed as the “root” user.
#!/bin/sh
#Root script to run
/home/oracle/oracle/product/10.2.0/db_1/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as “root”
3. Run the scripts

The installation of Oracle Database 10g Release 2 Patch Set 3 was successful.
Please check ‘/home/oracle/oraInventory/logs/silentInstall2009-07-20_03-19-54PM.log’ for more details.

****************************************************************************
root@ubuntu108:/home/oracle/oraInventory/logs# /home/oracle/oracle/product/10.2.0/db_1/root.sh
Running Oracle10 root.sh script…

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME=  /home/oracle/oracle/product/10.2.0/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file “dbhome” already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
Copying dbhome to /usr/local/bin …
The file “oraenv” already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
Copying oraenv to /usr/local/bin …
The file “coraenv” already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
Copying coraenv to /usr/local/bin …

Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
****************************************************************************

vi .bash_profile

umask 022

export ORACLE_HOME=/home/oracle/oracle/product/10.2.0/db_1

export PATH=$PATH:$ORACLE_HOME/bin

export ORACLE_SID=hollyc5

export ORACLE_BASE=/home/oracle

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

export NLS_LANG=AMERICAN_AMERICA.UTF8

export LANG=us_EN.UTF-8

dbca

……

netca

……

最后,ubuntu应该安装的包:

sudo apt-get install gcc libaio1 lesstif2 lesstif2-dev make libc6 libc6-i386 libc6-dev-i386 libstdc++5 lib32stdc++6 lib32z1 ia32-libs gcc-multilib

Categories: Linux, Oracle Tags: , ,

Oracle安装-Linux内核参数-共享内存信号量设置

July 10th, 2009 wajoynece No comments

Oracle数据库在linux系统上的安装过程中,涉及到设置linux内核参数;

这些内核参数究竟代表什么含义,如何调整这些参数?

共享内存

可以通过ipcs -lm命令查看目前系统共享内存的参数限制:

# ipcs -lm

—— Shared Memory Limits ——–
max number of segments = 4096
max seg size (kbytes) = 1048576
max total shared memory (pages) = 2097152
min seg size (bytes) = 1

这里涉及到3个于共享内存相关的参数:SHMMAX,SHMMNI,SHMALL

SHMMAX

  • 含义:单个共享内存段最大字节数
  • 设置:比SGA略大
  • 查看:cat /proc/sys/kernel/shmmax
  • $ cat /proc/sys/kernel/shmmax
    1073741824

  • 修改:
  • sysctl -w kernel.shmmax=1073741824
    echo “kernel.shmmax=1073741824″ >> /etc/sysctl.conf

SHMMNI

  • 含义:共享内存段最大个数
  • 设置:至少4096
  • 查看:cat /proc/sys/kernel/shmmni
  • # cat /proc/sys/kernel/shmmni
    4096

  • 修改:

# sysctl -w kernel.shmmni=4096
# echo “kernel.shmmni=4096″ >> /etc/sysctl.conf

SHMALL

  • 含义:系统中共享内存页总数
  • 设置:至少ceil(shmmax/PAGE_SIZE);ORACLE DOC 默认值:2097152*4096=8GB
  • 查看:cat /proc/sys/kernel/shmall

$ getconf PAGE_SIZE
4096

# cat /proc/sys/kernel/shmall
2097152

  • 修改:

# sysctl -w kernel.shmall=2097152
# echo “kernel.shmall=2097152″ >> /etc/sysctl.conf

信号量:

当前系统信号量限制:

oracle@lab-rd-01:~$ ipcs -ls

—— Semaphore Limits ——–
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 100

SEMMSL

  • 含义:每个信号量set中信号量最大个数
  • 设置:最小250;对于processes参数设置较大的系统建议设置为processes+10

SEMMNI

  • 含义:linux系统信号量set最大个数
  • 设置:最少128

SEMMNS

  • 含义:linux系统中信号量最大个数
  • 设置:至少32000;SEMMSL * SEMMNI

SEMOPM

  • 含义:semop系统调用允许的信号量最大个数
  • 设置:至少100;或者等于SEMMSL

查看信号量设置:cat /proc/sys/kernel/sem

order:SEMMSL, SEMMNS, SEMOPM, SEMMNI

oracle@lab-rd-01:~$ cat /proc/sys/kernel/sem
250    32000    100    128

修改:

sysctl -w kernel.sem=”250 32000 100 128″
echo “kernel.sem=250 32000 100 128″ >> /etc/sysctl.conf

ORACLE提供了sysresv工具管理共享内存以及信号量,操作系统级别可以通过ipcs管理。

Categories: Linux, Oracle Tags: , , , ,