Home > 排错 > Linux Tar安装oracle 10g

Linux Tar安装oracle 10g

September 12th, 2011 Leave a comment Go to comments

链接:http://www.dbasky.net/archives/2009/04/linux-taroracle-10g.html

最近公司业务的不断扩大,对数据库的使用也不断的增加,导致了基本每天都要进行安装的安装和配置。其实oracle的安装是很简单,不知道是否有更加方便,快捷的安装方式呢?答案:有的,那就是用linux常用的命令tar来进行安装。今天我就来尝试了在linux as4上用tar方式安装oracle 10g,下面简单记录下这次的操作过程。

原数据库所在服务器信息:

kfserver-> more /etc/issue
Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
Kernel \r on an \m

kfserver-> uname -a
Linux kfserver 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686 i686 i386 GNU/Linux
新数据库所在服务器信息:

root@testserver:[/root]more /etc/issue
Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
Kernel \r on an \m
root@testserver:[/root]uname -a
Linux testserver 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686 i686 i386 GNU/Linux
以上二个系统版本是一样的。

1、在新服务器上添加用户
groupadd oinstall
useradd -g oinstall oracle

2、在新服务器上添加相关目录
mkdir -p /opt/oracle/product

3、设置核心参数
vi /etc/sysctl.conf,添加

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1
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 = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144

使设置生效:
sysctl -p

4、修改oracle用户的环境变量
su – oracle
vi .bash_profile 添加:

# User specific environment and startup programs
PATH=$PATH:$HOME/bin

export PATH
unset USERNAME
export PS1=”` /bin/hostname -s ` -> ”
export EDITOR=vi
export ORACLE_SID=nuage
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_CLIENT=$ORACLE_BASE/product/10.2.0/cleint
export LD_LIBRARY=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export NLS_LANG=”SIMPLIFIED CHINESE_CHINA.ZHS16GBK”

5、在原服务器打包程序
把$ORACLE_HOME下的东西打包压缩:
cd $ORACLE_BASE/product
tar cfz oracle10203.tar 10.2

6、传送到新服务器并解压
scp 上传

cd $ORACLE_BASE/product
tar -xzfv oracle10203
7、修改解压后的文件属主

[root@testserver oracle]# chown -R oracle:oinstall /opt/
chown: changing ownership of `/opt/oracle/product/10.2/rdbms/filemap’: No such file or directory

这里出现一个错误,提示文件不存在,经检查这是一个软链接:

[root@testserver oracle]# ls -l /opt/oracle/product/10.2/rdbms/filemap
lrwxrwxrwx 1 root root 22 Jan 10 17:22 /opt/oracle/product/10.2/rdbms/filemap -> /opt/ORCLfmap/prot1_64
经检查,当前的系统确实不存在/opt/ORCLfmap目录,实际上/opt/ORCLfmap是有root.sh生成的,先删除这个软链接:
rm -f /opt/oracle/product/10.2/rdbms/filemap

重新执行root.sh:

[root@testserver opt]# /opt/oracle/product/10.2/root.sh
Running Oracle10 root.sh script…

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /opt/oracle/product/10.2

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.
此时软连接和目录都已经存在:

[root@testserver opt]# ls /opt/oracle/product/10.2/rdbms/filemap
bin etc log
[root@testserver opt]# ls -l /opt/oracle/product/10.2/rdbms/filemap
lrwxrwxrwx 1 root root 22 Jan 10 17:40 /opt/oracle/product/10.2/rdbms/filemap -> /opt/ORCLfmap/prot1_64
8、创建数据库
运行dbca,一步一步设置好就可以。

9、清理原网络相关文件、原密码文件等。

一般会出现的问题:
1、chown: changing ownership of `/opt/oracle/product/10.2/rdbms/filemap’: No such file or directory
这个问题在上文已有描述,这里不再赘述。

2、Exception in thread “main” java.lang.UnsatisfiedLinkError: /opt/oracle/product/10.2/jdk/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory

执行dbca时报错:

testserver ->$ dbca
Exception in thread “main”
testserver ->$
这里报错信息非常少,无法判断是什么原因,再执行netca就可以看得更多的错误信息了:

[oracle@testserver bin]$ netca
Exception in thread “main” java.lang.UnsatisfiedLinkError: /opt/oracle/product/10.2/jdk/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1503)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:38)
at sun.awt.DebugHelper.(DebugHelper.java:29)
at java.awt.Component.(Component.java:506)

这个问题主要是缺少一个包xorg-x11-deprecated-libs导致的,把包安装上就可以:
[root@testserver soft]# rpm -ivh xorg-x11-deprecated-libs-6.8.2-1.EL.13.37.i386.rpm
warning: xorg-x11-deprecated-libs-6.8.2-1.EL.13.37.i386.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing… ########################################### [100%]
1:xorg-x11-deprecated-lib########################################### [100%]

注意:虽然系统是64位的,但是这里要安装32位的包。

3、ORA-12547: TNS: 丢失连接
在创建数据库前,简单测试一下sqlplus是否正常,发现了这个问题:

testserver ->$ sqlplus “/as sysdba”

SQL*Plus: Release 10.2.0.3.0 – Production on 星期四 1月 10 17:51:35 2008

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

oraclenewdemo: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
ERROR:
ORA-12547: TNS: 丢失连接

请输入用户名:

引起问题的原因是libaio系统包,把相关包安装即可:

[root@testserver soft]# ls
libaio-0.3.105-2.i386.rpm libaio-0.3.105-2.x86_64.rpm libaio-devel-0.3.105-2.x86_64.rpm
[root@testserver soft]# rpm -ivh *
warning: libaio-0.3.105-2.i386.rpm: V3 DSA signature: NOKEY, key ID b38a8516
Preparing… ########################################### [100%]
1:libaio ########################################### [ 33%]
2:libaio ########################################### [ 67%]
3:libaio-devel ########################################### [100%]

同样,这里也需要安装两个32位的包。

4、ORA-01031: insufficient privileges
testserver ->$ sqlplus “/as sysdba”

SQL*Plus: Release 10.2.0.3.0 – Production on 星期五 1月 11 10:48:35 2008

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

ERROR:
ORA-01031: insufficient privileges

请输入用户名:

这个问题是因为用户组不一致造成的。

原库:

[oracle@kfserver oraInventory]$ id -a
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba) context=user_u:system_r:unconfined_t
新库:

[oracle@testserver oraInventory]$ id -a
uid=500(oracle) gid=500(oinstall) groups=500(oinstall) context=user_u:system_r:unconfined_t
在新库上为oracle用户添加组就可以了:

[root@testserver ~]# usermod -G dba oracle

Categories: 排错 Tags:
  1. No comments yet.
  1. No trackbacks yet.

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Videos, Slideshows and Podcasts by Cincopa Wordpress Plugin