远程安装 oracle <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />10.2.1 for redhat 5.0 2.6.18-53.el5xen<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

今天有个朋友打电话告诉我说,要我帮他装一个 oracle 正好闲着没事,我就答应了。他告诉我:要装数据库的机子在江西,只能通过远程安装。还说现在只开了 SSH ,其他都没有开。

我根据他给我的信息如: IP SSh 协议, ROOT 用户名与密码。思考了一下,得去如下安装步聚:

1、              为了把数据库软件传上去,就须开个 FTP ,还用到一个 FTP 工具: FlashFXP 3.6.0

2、              为了要用到图像界面来安装数据库软件与建立数据库,因为我不习惯用静默来安装数据库软件与建立数据库,所以我用到了两个软件: xmanager enterprise 3.0 secureCRT 6.12

3、              通过图像界面来安装数据库软件与建立数据库。

上面提出了三个步聚,下面我来一步一步的解决:

一、         为机器开个 FTP ,首先看一下是不是安装了 FTP 包:

[root@oracleERP ~]# rpm -q ftp

ftp-0.17-33.fc6

呵呵!很好,已经安装了 FTP 了,现在看一下是不是启动了 FTP 服务:

[root@oracleERP vsftpd]# /etc/init.d/vsftpd status

vsftpd is stopped

唉!还没有启动,下面我就来启动:

[root@oracleERP vsftpd]# /etc/init.d/vsftpd start

Starting vsftpd for vsftpd: [  OK  ]

下面我来测试一下可不可以 FTP 上去。

Microsoft Windows XP [ 版本 5.1.2600]

(C) 版权所有 1985-2001 Microsoft Corp.

 

D:\Documents and Settings\db2admin>ftp 218.64.122.159

Connected to 218.64.122.159.

220 (vsFTPd 2.0.5)

User (218.64.122.159:(none)): oracle

331 Please specify the password.

Password:

230 Login successful.

ftp>

很好,可以 FTP 上去。下面我就用 FlashFXP 这个工具 upload 数据库软件上去。幸好我这里的网速还可以 upload 时,可达 2M ,这样节省了我好多时间了, 6 分钟就 upload 完了。

二、这步是怎样图形界面连到远程的机器上。首先到网上去下载: xmanager enterprise 3.0 secureCRT 6.12 。好久没去搜这两人个软件了,它们都升级了,我原来都用 xmanager 2.0 secureCRT 5.1 ,升级还真快啊。好费话不多说了。把两个软件安装到电脑上面去,这两个软件都被破解了的,我个人喜欢用破解版。好了,下面我来配置 XMANGER ,这样的方法很多。下面我就来讲几种方法:

 Xmanager  远程连接 rdhat

========================================
法一:直接开启一个  gnome-session
1. 
点击桌面图标  Xmanager Enterprise

<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
2 右击 Xmanager 图标  -->  Xstart

 
3 在右边的空白处右击, new à Xstart session

4. 出现如下的界面:

Session: 里输入:会话名: xstarttest

HOST 192.169.0.2 ,你连上去的 IP 地址。   

 Protocol: SSH
   
输入 username   passwd
   Execution Command: 
   /usr/bin/gnome-session --display $DISPLAY

如下图:

    点击 确定

出现如下的图片:

 

双击 xstarttest. 如果网络好的话,很快就会出现期待已久的远程桌面。如下图:

现在我们就可以在上面做操作了。

==================================================
法二:开启一个登录窗口 ,下面的方法是在远程机器上开启 XDMCP ,然后再用 Xstart 连接上去。
服务器: redhat as 5.0
终端: Xmanager  enterprise 3.0
服务器配置:( Gnome
------------------------

1. Change runlevel to 5

     修改  /etc/inittab ,将运行级别设置为 5 ,即 :
      id:5:initdefault:

2. Enable XDMCP

打开 /etc/gdm/custom.conf, 然后把 Enable 改为 1 ,即:

 [xdmcp]

Enable=1

3. KDM:

  /usr/share/config/kdm/Xaccess ,然后把下面两行的“#”去掉。

#* #any host can get a login window ==>

* #any host can get a login window

打开 /user/share/config/kdm/kdmrc ,然后把 Enable 设成: true. 即如下:

 [xdmcp]

Enable=true

  4. 配置防火墙:即允许 TCP/UPD 通过。如下:

Open UDP port 177 from the PC to the remote host direction.

Open incoming TCP ports 6000~6010 from the remote host to your PC.

5. 重起远程的机器。开始使用 XMANGER enterprise 3.0

# init 3; init 5 -------------------------

终端配置
------------------------
1
、点击  Xmanager Enterprise  图标,打开  Xbrowser 
   
这时  Xbrowser  窗口中会显示局域网中所有的可用服务器
   
(若没有显示,则表示服务器配置有问题)
   
直接双击你想使用的服务器即可开启一个登录窗口

终端配置(通过 ssh 登陆)
------------------------
如果只能通过  ssh  登录,则需要进行一些配置
首先配置  Xshell
1
、打开  Xshell ,右击你想要连接的  session
   
如果没有的话,就创建一个新的  session
2
、右击  session ,选择 “Properties”
   Connection 
部分:
     “Name”
中输入 session 的名字(随便写)
     “Method”
“SSH” “Host” 为服务器 IP 地址
     “Port Number”
“22”
   
   User Authentication 
部分
     “Method”
“Password”
     “User Name”/“Password”
为你的帐号和密码
3
、点击  Connection  部分中 “Method” 后面的 “Setup”
   
选择 “Tunneling” ,点击 “TCP/IP Forwarding” 中的 “Add”
   
出现对话框,进行下面的操作:
     “Type”
改为 “Outgoing”
     “Listen Port”
“6020”
     “Destination Host”
改为 “localhost”
     “Destination Port”
“6020”
     
(注: Listen/Destination Port  可以是 6020 6255 中任意一个没有使用的值)
    
保存设置
    Xshell 
配置完成,下面开始配置  Xbrowser
------------------------
1
、点击  Xmanager Enterprise  图标,打开  Xbrowser 
   
选择  “Tools”--> “Option”
   
“New Address” 输入服务器的 IP 地址,然后点击 “Add”
   
保存设置。
  
2
、回到  Xbrowser  窗口,这时能看到你增加的服务器图标。
   
右击服务器图标,选择 “Save As” ,创建一个新的  session
   
然后右击这个  session ,选择 “Properties”
   
 “Proxy” 部分打勾, Host  “0.0.0.0”
   Port Number 
“6020”
   
(注:这个值应该与 Xshell 配置中第三步的 “Listen Port” 相同)
3
、点击 “X Server” ,把
   “Allocate display number automatically”
前面的勾去掉,
   
“Display Number box” 中输入  “20”
   
(这个数字应等于上一步中的 Port Number 减去 6000
   
保存设置
4
、双击该服务器图标即可开启一个登录窗口

 

方法三:

xmanager secureCRT 结合使用

环境:在 xp 中安装虚拟机 vmware host-only 方式虚拟 Linux 系统。 xp ip 192.168.0.1 ,虚拟机 Linux 192.168.0.88

xp 中安装 xmanager secureCRT ,默认情况下 CRT 不能显示图形界面,通过以下配置可以实现在 Windows 下的 CRT 里显示 Linux 中的 oracle 图形界面:

oracle 用户登陆 Linux ,修改 .bash_profile

$ vi .bash_profile

在最后加上以下内容:

DISPLAY=192.168.0.1:0.0

export DISPLAY

然后 $source .bash_profile

就大功告成。

最后一步、上面的条件都具备了,下面就是来安装数据库软件与建立数据库。下面安装数据库软件全是按照官方文档来的。下面我就不细细的讲。稍稍讲一下要做的步聚:

解压文件。

unzip 10201_database_linux32.zip

You should now have a single directory containing installation files. Depending on the age of the download this may either be named "db/Disk1" or "database".

设置内核参数:

/etc/sysctl.conf 文件加上如下的内容。

Add the following lines to the /etc/sysctl.conf file:

#kernel.shmall = 2097152

#kernel.shmmax = 2147483648

kernel.shmmni = 4096

# semaphores: semmsl, semmns, semopm, semmni

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

运行下面的命令,来改变当的的内核参数。

Run the following command to change the current kernel parameters:

/sbin/sysctl -p

/etc/security/limits.conf 加上如下的内容。

Add the following lines to the /etc/security/limits.conf file:

*               soft    nproc   2047

*               hard    nproc   16384

*               soft    nofile  1024

*               hard    nofile  65536

/etc/pam.d/login 文件加上如下的内容。

Add the following line to the /etc/pam.d/login file, if it does not already exist:

session    required     /lib/security/pam_limits.so

关闭防火墙:

Disable secure linux by editing the /etc/selinux/config file, making sure the SELINUX flag is set as follows:

SELINUX=disabled

Alternatively, this alteration can be done using the GUI tool (System > Administration > Security Level and Firewall). Click on the SELinux tab and disable the feature.

安装需要的包:

Install the following packages:

# From RedHat AS5 Disk 1

cd /media/cdrom/Server

rpm -Uvh setarch-2*

rpm -Uvh make-3*

rpm -Uvh glibc-2*

rpm -Uvh libaio-0*

cd /

eject

 

# From RedHat AS5 Disk 2

cd /media/cdrom/Server

rpm -Uvh compat-libstdc++-33-3*

rpm -Uvh compat-gcc-34-3*

rpm -Uvh compat-gcc-34-c++-3*

rpm -Uvh gcc-4*

rpm -Uvh libXp-1*

cd /

eject

 

# From RedHat AS5 Disk 3

cd /media/cdrom/Server

rpm -Uvh openmotif-2*

rpm -Uvh compat-db-4*

cd /

eject

创建用户名与用户组:

Create the new groups and users:

groupadd oinstall

groupadd dba

groupadd oper

 

useradd -g oinstall -G dba oracle

passwd oracle

为数据库软件创建目录。

Create the directories in which the Oracle software will be installed:

mkdir -p /u01/app/oracle/product/10.2.0/db_1

chown -R oracle.oinstall /u01

修改 /etc/redhat-releas 文件,这样做的目的是为了在安装时能通过。因为 oracle 10G 检查文件里对操作系统有要求。所要把它改成 redhat-4

Edit the /etc/redhat-release file replacing the current release information (Red Hat Enterprise Linux Server release 5 (Tikanga)) with the following:

redhat-4

设置环境变量:编辑: .bash_profile, 在里面填上如下的内容。

Login as the oracle user and add the following lines at the end of the .bash_profile file:

# Oracle Settings

TMP=/tmp; export TMP

TMPDIR=$TMP; export TMPDIR

 

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME

ORACLE_SID=TSH1; 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

 

if [ $USER = "oracle" ]; then

  if [ $SHELL = "/bin/ksh" ]; then

    ulimit -p 16384

    ulimit -n 65536

  else

    ulimit -u 16384 -n 65536

  fi

fi

Installation

Log into the oracle user. If you are using X emulation then set the DISPLAY environmental variable:

DISPLAY= 本机的IP地址:0.0; export DISPLAY

Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory:

./runInstaller

安装完以后,要把 /etc/redhat-release 这个文件的内容改过来。

Edit the /etc/redhat-release file restoring the original release information:

Red Hat Enterprise Linux Server release 5 (Tikanga)

Edit the /etc/oratab file setting the restart flag for each instance to 'Y':

TSH1:/u01/app/oracle/product/10.2.0/db_1:Y

注:在安装完数据库后的总结。我首先是把数据库软件安装以后,再运行 DBCA 的。

在运行 DBCA 时。我把内存分高了。提示: ORA-27123 unable to attach to shared memory segment 。后来我把内存分低一点。就通过了。

在操作系统下看:共享内存:

[root@oracleERP ~]# cat /proc/sys/kernel/shmmax

2999999999

只有 2999999999

而我把它分了: 7294967295

临时给 shmmax 分内存。

Echo 7294967295 > /proc/sys/kernel/shmmax. 。这样临时给 shmmax 分好了。

如果想永久的分 shmmax, 。就要编辑: /etc/sysctl.conf

设置:

kernel.shmmax = 7294967295

就可以了。

好了!写了几个小时终于写完了。