(1)可以运行如下命令检查所需包是否都已安装
# rpm -q make gcc glibc compat-db compat-gcc compat-gcc-c++ compat-libstdc++ \compat-libstdc++-devel openmotif21 setarch libaio \
# rpm -q gcc make binutils openmotif setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel
如果没有出现“not found”字样则表示已安装。
如果没有安装这些包的话,可以在CentOS安装光盘的CentOS目录下找到相应的rmp文件来安装,如果你的服务器可以联网的话,也可以通过yum的方式下载安装,在终端中执行以下命令:
# yum –y install 没有发现的包名字
(2)关闭防火墙,关闭SELIINUX
vi /etc/selinux/config 确保以下内容:
SELINUX=disabled
(3)=========检查系统硬件配置情况
查看内存空间
# grep MemTotal /proc/meminfo
MemTotal: 1034584 kB
查看交换空间swap大小
# grep SwapTotal /proc/meminfo
SwapTotal: 524280 kB
检查安装空间要求
# df –h
以确定oracle安装在那个硬盘内较好.
注意:为SWAP分配的空间要超过1G,要不然后面装Oralce会因为空间不足而无法安装。
(4) 修改host文件
Hosts File
# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
10.1.130.78 localhost.localdomain localhost
10.1.130.78 dvrvmg78.boldtech.internal
注意:你要把10.1.130.78改成你自己的IP。
(5) 配置Linux内核参数,设置内核参数
# vi /etc/sysctl.conf
在行末添加以下内容
#use for oracle
kernel.shmall = 268435456
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 或1048576
net.core.rmem_max = 262144 或1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
再运行sysctl -p应用以上参数
# /sbin/sysctl –p
(6) ==Oracle建议对每个Linux帐户可以使用的进程数和打开的文建树设置限制,设置最大打开文件数
在"# End of file"前加入以下几行
# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
(7) 设置会话
# vi/etc/pam.d/login
行末添加以下内容
sessionrequired /lib/security/pam_limits.so
session required pam_limits.so(这句话我没有增加也行)
(8) ==对Bourne、Bash、Korn shell,用编辑器gedit打开文件/etc/profile中加入以下几行(最下面)
# vi /etc/profile
#add for installing oracle 10g
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
For the C shell (csh or tcsh), add the following lines to the /etc/csh.login.
if ( $USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
endif
(9) 建立oracle用户及组
# groupadd oinstall
# groupadd dba
# groupadd oper
# useradd -g oinstall -G dba oracle
# passwd oracle
(10) 建立ORACLE_HOME目录,解压数据库安装文件, 安装文件可以在以下路径找到:\\hangzhou4\Public\Oracle For Linux
# unzip 10201_database_linux32.zip
# mv database /tmp/
# chown -R oracle.oinstall /tmp/database
(11) 修改操作系统版本标识
# vi /etc/redhat-release
#CentOS release 5.2 (Final) (删除掉而不是简单的注销)
redhat-4
(12) 修改ORACLE环境变量
# su - oracle
$ vi .bash_profile
#export PATH
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/apps/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db102; export ORACLE_HOME
ORACLE_SID=GEHGAL; export ORACLE_SID
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
(13) 配置XDMCP
对于GDM
# vi /etc/gdm/custom.conf
[xdmcp]
Enable=1
注意:custom.conf这个文件可能是只读文件,需要改成可写属性才能修改。
(14) 因为默认centos5.1不支持10.2,0.1,修改安装文件
#vi /tmp/database/install/oraparam.ini
找到### #[Certified Versions]
Linux=redhat-3,SuSE-9,redhat-4,centos-5,UnitedLinux-1.0,asianux-1,asianux-2再后面添加
[Linux-centos-5.2-optional]
TEMP_SPACE=80
SWAP_SPACE=150
MIN_DISPLAY_COLORS=256
(15) 创建oracle安装目录
# mkdir -p /apps/oracle
# chown -R oracle:oinstall /apps/oracle
# chmod -R 775 /apps/oracle
(16) 安装vnc
1. 下载
vnc有免费版本和收费版本,我们使用免费的版本就足够了。
官方网站是:
http://www.realvnc.com
2、安装Linux版的vnc
从以下地址:\\hangzhou4\Projects\GEH_GAL\tools\install拿到安装包:vnc-4_1_3-x86_linux.tar.gz,vnc-4_1_3-x86_win32_viewer.zip,先把vnc-4_1_1-x86_linux.tar.gz放到需要远程控制的机器10.1.130.78上,然后解压到/opt目录:
tar xzvf vnc-4_1_1-x86_linux.tar.gz -C /opt
cd /opt/vnc-4_1_1-x86_linux/
安装:
./vncinstall /usr/local/vnc
安装成功后,进行设置,运行:#vncpasswd,输入两次远程控制的密码。
====================================
VNC connect to CentOS:
1. Login using PuTTy
2. Create .vnc for user
[chemy.chen@dvrvmg78 vnc-4_1_3-x86_linux]$ ./vncserver
3. Change xstartup configuration
[chemy.chen@dvrvmg78 vnc-4_1_3-x86_linux]$ cd ~
[chemy.chen@dvrvmg78 ~]$ cd .vnc
[chemy.chen@dvrvmg78 ~]$ sudo vi xstartup
#!/bin/sh
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
gnome-session &
Save and exit.
4. Stop vnc and restart
[chemy.chen@dvrvmg78 .vnc]$ ps -ef | grep vnc
root 1291 1 0 09:49 pts/3 00:00:00 Xvnc :3 -desktop dvrvmg78:3 (root) -httpd /usr/share/vnc/classes -auth /home/chemy.chen/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /home/chemy.chen/.vnc/passwd -rfbport 5903 -pn
root 1301 1 0 09:49 pts/3 00:00:00 vncconfig -iconic
1053 2110 30899 0 09:54 pts/3 00:00:00 grep vnc
root 23576 1 0 Apr03 ? 00:00:23 Xvnc :1 -desktop dvrvmg78:1 (root) -httpd /usr/share/vnc/classes -auth /home/tao.xu/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /home/tao.xu/.vnc/passwd -rfbport 5901 –pn
[chemy.chen@dvrvmg78 .vnc]$ cd /opt/vnc-4_1_3-x86_linux/
[chemy.chen@dvrvmg78 vnc-4_1_3-x86_linux]$ sudo ./vncserver -kill 3
[chemy.chen@dvrvmg78 vnc-4_1_3-x86_linux]$ sudo ./vncserver
[chemy.chen@dvrvmg78 vnc-4_1_3-x86_linux]$ ps -ef | grep vnc
root 1291 1 0 09:49 pts/3 00:00:00 Xvnc :3 -desktop dvrvmg78:3 (root) -httpd /usr/share/vnc/classes -auth /home/chemy.chen/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /home/chemy.chen/.vnc/passwd -rfbport 5903 -pn
root 1301 1 0 09:49 pts/3 00:00:00 vncconfig -iconic
1053 2500 30899 0 09:59 pts/3 00:00:00 grep vnc
root 23576 1 0 Apr03 ? 00:00:23 Xvnc :1 -desktop dvrvmg78:1 (root) -httpd /usr/share/vnc/classes -auth /home/tao.xu/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /home/tao.xu/.vnc/passwd -rfbport 5901 –pn
5. Connect from client
Open vnc-4_1_3-x86_win32_viewer.exe in client machine, provide “Server” as: 10.1.130.78:3.0
6. Provide password as what you set in step 2, and login successfully;
====================================
3. 以vnc client远程连接服务器安装oracle
(17) 安装oracle数据库
以root身份login,
# xhost +
# su - oracle
$ export DISPLAY= 10.2.9.112:1.0
$ /tmp/database/runInstaller
Choose Enterprise setup
(18) 成功后恢复操作系统版本
# vi /etc/redhat-release
CentOS release 5.2 (Final)
(19) 设置数据库开机自动启动
# vi /etc/oratab
GEHGAL:/apps/oracle/product/10.2.0/db102:Y
$ vi /apps/oracle/product/10.2.0/db102/bin/dbstart
第78行修改为
ORACLE_HOME_LISTNER=$ORACLE_HOME
vi /etc/init.d/oracle
#!/bin/bash
# chkconfig: 0356 95 1
# description: init script to start/stop Oracle Database 10gR2, TNS listener, isQL*Plus, EMS
# match these values to your environment:
export ORACLE_BASE=/apps/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db102
export ORACLE_SID=GEHGAL
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_USER=oracle
# see how we are called:
case $1 in
start)
su - "$ORACLE_USER" -c "$ORACLE_HOME/bin/dbstart"
su - "$ORACLE_USER" -c "$ORACLE_HOME/bin/isqlplusctl start"
su - "$ORACLE_USER" -c "$ORACLE_HOME/bin/emctl start dbconsole"
;;
stop)
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
su - "$ORACLE_USER" -c "$ORACLE_HOME/bin/isqlplusctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
;;
*)
echo "Usage: $0 {start|stop}"
;;
esac
保存退出后:
sudo chmod +x /etc/init.d/oracle
chkconfig --add oracle
(20) 数据库相关命令
$ dbstart [ start | status | stop ]
$ lsnrctl [ start | status | stop ]
$ emctl [ start | status | stop ] console
$ dbshut
$dbstop
$ sqlplus /nolog
>connect system/passwd as sysdba
su – oracle
DBCA - Database Configuration Assistant: $ dbca
Network Configuration Assistant: $ netca
(21) 启动EM
$ emctl start dbconsole
如果出现TZ(时区)错误,按下列方法:
[HowTo] Update Timezone on CentOS/RedHat
# yum install system-config-date
# setup
Go-to -> Timezone configuration -> Select your local time zone -> Click OK -> Quit.
To check your current timezone:
# date
$ echo $TZ
$ emctl resetTZ agent
将出现下面的信息:
TZ set to Etc/GMT-7
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
Updating /dgalai/resen/product/102/svr68.srs2.com_h11h99/sysman/config/emd.properties...
Time zone set to Etc/GMT-7.
To complete this process, you must either:
connect to the database served by this DBConsole as user 'sysman', and execute:
SQL> exec mgmt_target.set_agent_tzrgn('svr68.srs2.com:3938',’ Etc/GMT-7’)
-- or --
connect to the database served by this DBConsole as user 'sys', and execute:
SQL> alter session set current_schema = SYSMAN;
SQL> exec mgmt_target.set_agent_tzrgn('svr68.srs2.com:3938', ‘Etc/GMT-7’)
暂时不管它,我们先重建EM(下面红色部份)。附相关文档:
症状:
进入EM控制台(http://172.19.111.38:1158/em)后,没有输入用户名和密码就直接登陆并显示数据库状态信息;
另外刚开始数据库监听没有起来,所以EM控制台显示信息也是说监听没有起来,后来监听起来了,EM控制台还是显示旧信息,刷新页面也那样。
问题原因和解决办法:
重启控制台服务后也没有效果:
$ emctl status dbconsole
$ emctl stop dbconsole
$ emctl start dbconsole
可能时原先监听未成功启动过,或者由于我修改过监听端口(1521改成1528)造成的。
重建em资料库:
$ emctl stop dbconsole
$ emca -repos recreate
...
Enter the following information:
Database SID: orcl10
Listener port number: 1528
PassWord for SYS user: Oracle10
Password for SYSMAN user: oracle10
Do you wish to continue? [yes(Y)/no(N)]: y
...
INFO: Repository sUCcessfully created
Enterprise Manager configuration completed successfully
FINISHED EMCA at Apr 19, 2007 6:20:22 PM
配置dbcontrol:
$ emca -config dbcontrol db
Enter the following information:
Database SID: orcl10
Database Control is already
configured for the database orcl10
You have chosen to configure
Database Control for managing
the database orcl10
This will remove the existing configuration
and the default settings and perform a fresh
configuration
Do you wish to continue? [yes(Y)/no(N)]: y
Listener port number: 1528
Password for SYS user: oracle10
Password for DBSNMP user: oracle10
Password for SYSMAN user: oracle10
Email address for notifications (optional):
Outgoing Mail (SMTP) server for
notifications (optional):
...
Do you wish to continue? [yes(Y)/no(N)]: y
...
Enterprise Manager configuration
completed successfully
FINISHED EMCA at Apr 19, 2007 6:27:44 PM
然后再进入 http://172.19.111.38:1158/em 查看正常了。
Oracle10G的EM采用了web方式,并且分成了2个产品,database control和grid control。Grid control需要下载单独的光盘安装。在用DBCA建库的时候,可以选择是否启用dbcontrol,启用的话需要在数据库中建立一个sysman的schema,用于保存EM的一些数据,这个就是EM的资料库(repository)。使用命令行工具emca可以创建,修改,重建或者删除dbcontrol的配置。
由于要在数据库中建EM资料库,数据库和监听都必须已经启动并正常工作。
emca -repos create 创建一个EM资料库
emca -repos recreate 重建一个EM资料库
emca -repos drop 删除一个EM资料库
emca -config dbcontrol db
配置数据库的 Database Control
emca -deconfig dbcontrol db
删除数据库的 Database Control配置
emca -reconfig ports
重新配置db control和agent的端口
emctl start console
启动EM console服务,使用前需要先
设置ORACLE_SID环境变量
emctl stop console 停止EM console服务,
使用前需要先设置ORACLE_SID环境变量
注:通过查看$ORACLE_HOME/install/portlist.ini
文件可以知道当前dbcontrol正在使用的端口,
默认dbcontrol http端口1158,agent端口3938。
假如要重新配置端口,可以使用如下命令:
emca -reconfig ports -dbcontrol_http_port 1159
emca -reconfig ports -agent_port 3939
使用命令行工具emctl可以启动/停止console服务,察看服务状态等。
访问http://localhost:1158/em/,端口号可能已经改变,如果还是不能访问,通过查看$ORACLE_HOME/install/portlist.ini文件,以确定当前dbcontrol正使用的端口是多少。
Login正常后,我们再执行以下命令:
$sqlplus /nolog
SQL> conn
Enter user-name: SYSMAN
Enter password:
Connected.
SQL> exec mgmt_target.set_agent_tzrgn('10.1.130.78:3938','Etc/GMT-7');
It is OK.
附:
检查EM dbconsole 配置属性
‑} Z!`4RZ9Qn1L&f K(k0检查$ORACLE_HOME/<hostname>_<SERVICE_NAME>/sysman/config下的ITPUB个人空间r
]~
kT3emoms.properties。
# rpm -q make gcc glibc compat-db compat-gcc compat-gcc-c++ compat-libstdc++ \compat-libstdc++-devel openmotif21 setarch libaio \
# rpm -q gcc make binutils openmotif setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel
如果没有出现“not found”字样则表示已安装。
如果没有安装这些包的话,可以在CentOS安装光盘的CentOS目录下找到相应的rmp文件来安装,如果你的服务器可以联网的话,也可以通过yum的方式下载安装,在终端中执行以下命令:
# yum –y install 没有发现的包名字
(2)关闭防火墙,关闭SELIINUX
vi /etc/selinux/config 确保以下内容:
SELINUX=disabled
(3)=========检查系统硬件配置情况
查看内存空间
# grep MemTotal /proc/meminfo
MemTotal: 1034584 kB
查看交换空间swap大小
# grep SwapTotal /proc/meminfo
SwapTotal: 524280 kB
检查安装空间要求
# df –h
以确定oracle安装在那个硬盘内较好.
注意:为SWAP分配的空间要超过1G,要不然后面装Oralce会因为空间不足而无法安装。
(4) 修改host文件
Hosts File
# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
10.1.130.78 localhost.localdomain localhost
10.1.130.78 dvrvmg78.boldtech.internal
注意:你要把10.1.130.78改成你自己的IP。
(5) 配置Linux内核参数,设置内核参数
# vi /etc/sysctl.conf
在行末添加以下内容
#use for oracle
kernel.shmall = 268435456
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 或1048576
net.core.rmem_max = 262144 或1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
再运行sysctl -p应用以上参数
# /sbin/sysctl –p
(6) ==Oracle建议对每个Linux帐户可以使用的进程数和打开的文建树设置限制,设置最大打开文件数
在"# End of file"前加入以下几行
# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
(7) 设置会话
# vi/etc/pam.d/login
行末添加以下内容
sessionrequired /lib/security/pam_limits.so
session required pam_limits.so(这句话我没有增加也行)
(8) ==对Bourne、Bash、Korn shell,用编辑器gedit打开文件/etc/profile中加入以下几行(最下面)
# vi /etc/profile
#add for installing oracle 10g
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
For the C shell (csh or tcsh), add the following lines to the /etc/csh.login.
if ( $USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
endif
(9) 建立oracle用户及组
# groupadd oinstall
# groupadd dba
# groupadd oper
# useradd -g oinstall -G dba oracle
# passwd oracle
(10) 建立ORACLE_HOME目录,解压数据库安装文件, 安装文件可以在以下路径找到:\\hangzhou4\Public\Oracle For Linux
# unzip 10201_database_linux32.zip
# mv database /tmp/
# chown -R oracle.oinstall /tmp/database
(11) 修改操作系统版本标识
# vi /etc/redhat-release
#CentOS release 5.2 (Final) (删除掉而不是简单的注销)
redhat-4
(12) 修改ORACLE环境变量
# su - oracle
$ vi .bash_profile
#export PATH
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/apps/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db102; export ORACLE_HOME
ORACLE_SID=GEHGAL; export ORACLE_SID
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
(13) 配置XDMCP
对于GDM
# vi /etc/gdm/custom.conf
[xdmcp]
Enable=1
注意:custom.conf这个文件可能是只读文件,需要改成可写属性才能修改。
(14) 因为默认centos5.1不支持10.2,0.1,修改安装文件
#vi /tmp/database/install/oraparam.ini
找到### #[Certified Versions]
Linux=redhat-3,SuSE-9,redhat-4,centos-5,UnitedLinux-1.0,asianux-1,asianux-2再后面添加
[Linux-centos-5.2-optional]
TEMP_SPACE=80
SWAP_SPACE=150
MIN_DISPLAY_COLORS=256
(15) 创建oracle安装目录
# mkdir -p /apps/oracle
# chown -R oracle:oinstall /apps/oracle
# chmod -R 775 /apps/oracle
(16) 安装vnc
1. 下载
vnc有免费版本和收费版本,我们使用免费的版本就足够了。
官方网站是:
http://www.realvnc.com
2、安装Linux版的vnc
从以下地址:\\hangzhou4\Projects\GEH_GAL\tools\install拿到安装包:vnc-4_1_3-x86_linux.tar.gz,vnc-4_1_3-x86_win32_viewer.zip,先把vnc-4_1_1-x86_linux.tar.gz放到需要远程控制的机器10.1.130.78上,然后解压到/opt目录:
tar xzvf vnc-4_1_1-x86_linux.tar.gz -C /opt
cd /opt/vnc-4_1_1-x86_linux/
安装:
./vncinstall /usr/local/vnc
安装成功后,进行设置,运行:#vncpasswd,输入两次远程控制的密码。
====================================
VNC connect to CentOS:
1. Login using PuTTy
2. Create .vnc for user
[chemy.chen@dvrvmg78 vnc-4_1_3-x86_linux]$ ./vncserver
3. Change xstartup configuration
[chemy.chen@dvrvmg78 vnc-4_1_3-x86_linux]$ cd ~
[chemy.chen@dvrvmg78 ~]$ cd .vnc
[chemy.chen@dvrvmg78 ~]$ sudo vi xstartup
#!/bin/sh
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
gnome-session &
Save and exit.
4. Stop vnc and restart
[chemy.chen@dvrvmg78 .vnc]$ ps -ef | grep vnc
root 1291 1 0 09:49 pts/3 00:00:00 Xvnc :3 -desktop dvrvmg78:3 (root) -httpd /usr/share/vnc/classes -auth /home/chemy.chen/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /home/chemy.chen/.vnc/passwd -rfbport 5903 -pn
root 1301 1 0 09:49 pts/3 00:00:00 vncconfig -iconic
1053 2110 30899 0 09:54 pts/3 00:00:00 grep vnc
root 23576 1 0 Apr03 ? 00:00:23 Xvnc :1 -desktop dvrvmg78:1 (root) -httpd /usr/share/vnc/classes -auth /home/tao.xu/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /home/tao.xu/.vnc/passwd -rfbport 5901 –pn
[chemy.chen@dvrvmg78 .vnc]$ cd /opt/vnc-4_1_3-x86_linux/
[chemy.chen@dvrvmg78 vnc-4_1_3-x86_linux]$ sudo ./vncserver -kill 3
[chemy.chen@dvrvmg78 vnc-4_1_3-x86_linux]$ sudo ./vncserver
[chemy.chen@dvrvmg78 vnc-4_1_3-x86_linux]$ ps -ef | grep vnc
root 1291 1 0 09:49 pts/3 00:00:00 Xvnc :3 -desktop dvrvmg78:3 (root) -httpd /usr/share/vnc/classes -auth /home/chemy.chen/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /home/chemy.chen/.vnc/passwd -rfbport 5903 -pn
root 1301 1 0 09:49 pts/3 00:00:00 vncconfig -iconic
1053 2500 30899 0 09:59 pts/3 00:00:00 grep vnc
root 23576 1 0 Apr03 ? 00:00:23 Xvnc :1 -desktop dvrvmg78:1 (root) -httpd /usr/share/vnc/classes -auth /home/tao.xu/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /home/tao.xu/.vnc/passwd -rfbport 5901 –pn
5. Connect from client
Open vnc-4_1_3-x86_win32_viewer.exe in client machine, provide “Server” as: 10.1.130.78:3.0
6. Provide password as what you set in step 2, and login successfully;
====================================
3. 以vnc client远程连接服务器安装oracle
(17) 安装oracle数据库
以root身份login,
# xhost +
# su - oracle
$ export DISPLAY= 10.2.9.112:1.0
$ /tmp/database/runInstaller
Choose Enterprise setup
(18) 成功后恢复操作系统版本
# vi /etc/redhat-release
CentOS release 5.2 (Final)
(19) 设置数据库开机自动启动
# vi /etc/oratab
GEHGAL:/apps/oracle/product/10.2.0/db102:Y
$ vi /apps/oracle/product/10.2.0/db102/bin/dbstart
第78行修改为
ORACLE_HOME_LISTNER=$ORACLE_HOME
vi /etc/init.d/oracle
#!/bin/bash
# chkconfig: 0356 95 1
# description: init script to start/stop Oracle Database 10gR2, TNS listener, isQL*Plus, EMS
# match these values to your environment:
export ORACLE_BASE=/apps/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db102
export ORACLE_SID=GEHGAL
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_USER=oracle
# see how we are called:
case $1 in
start)
su - "$ORACLE_USER" -c "$ORACLE_HOME/bin/dbstart"
su - "$ORACLE_USER" -c "$ORACLE_HOME/bin/isqlplusctl start"
su - "$ORACLE_USER" -c "$ORACLE_HOME/bin/emctl start dbconsole"
;;
stop)
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
su - "$ORACLE_USER" -c "$ORACLE_HOME/bin/isqlplusctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
;;
*)
echo "Usage: $0 {start|stop}"
;;
esac
保存退出后:
sudo chmod +x /etc/init.d/oracle
chkconfig --add oracle
(20) 数据库相关命令
$ dbstart [ start | status | stop ]
$ lsnrctl [ start | status | stop ]
$ emctl [ start | status | stop ] console
$ dbshut
$dbstop
$ sqlplus /nolog
>connect system/passwd as sysdba
su – oracle
DBCA - Database Configuration Assistant: $ dbca
Network Configuration Assistant: $ netca
(21) 启动EM
$ emctl start dbconsole
如果出现TZ(时区)错误,按下列方法:
[HowTo] Update Timezone on CentOS/RedHat
# yum install system-config-date
# setup
Go-to -> Timezone configuration -> Select your local time zone -> Click OK -> Quit.
To check your current timezone:
# date
$ echo $TZ
$ emctl resetTZ agent
将出现下面的信息:
TZ set to Etc/GMT-7
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
Updating /dgalai/resen/product/102/svr68.srs2.com_h11h99/sysman/config/emd.properties...
Time zone set to Etc/GMT-7.
To complete this process, you must either:
connect to the database served by this DBConsole as user 'sysman', and execute:
SQL> exec mgmt_target.set_agent_tzrgn('svr68.srs2.com:3938',’ Etc/GMT-7’)
-- or --
connect to the database served by this DBConsole as user 'sys', and execute:
SQL> alter session set current_schema = SYSMAN;
SQL> exec mgmt_target.set_agent_tzrgn('svr68.srs2.com:3938', ‘Etc/GMT-7’)
暂时不管它,我们先重建EM(下面红色部份)。附相关文档:
症状:
进入EM控制台(http://172.19.111.38:1158/em)后,没有输入用户名和密码就直接登陆并显示数据库状态信息;
另外刚开始数据库监听没有起来,所以EM控制台显示信息也是说监听没有起来,后来监听起来了,EM控制台还是显示旧信息,刷新页面也那样。
问题原因和解决办法:
重启控制台服务后也没有效果:
$ emctl status dbconsole
$ emctl stop dbconsole
$ emctl start dbconsole
可能时原先监听未成功启动过,或者由于我修改过监听端口(1521改成1528)造成的。
重建em资料库:
$ emctl stop dbconsole
$ emca -repos recreate
...
Enter the following information:
Database SID: orcl10
Listener port number: 1528
PassWord for SYS user: Oracle10
Password for SYSMAN user: oracle10
Do you wish to continue? [yes(Y)/no(N)]: y
...
INFO: Repository sUCcessfully created
Enterprise Manager configuration completed successfully
FINISHED EMCA at Apr 19, 2007 6:20:22 PM
配置dbcontrol:
$ emca -config dbcontrol db
Enter the following information:
Database SID: orcl10
Database Control is already
configured for the database orcl10
You have chosen to configure
Database Control for managing
the database orcl10
This will remove the existing configuration
and the default settings and perform a fresh
configuration
Do you wish to continue? [yes(Y)/no(N)]: y
Listener port number: 1528
Password for SYS user: oracle10
Password for DBSNMP user: oracle10
Password for SYSMAN user: oracle10
Email address for notifications (optional):
Outgoing Mail (SMTP) server for
notifications (optional):
...
Do you wish to continue? [yes(Y)/no(N)]: y
...
Enterprise Manager configuration
completed successfully
FINISHED EMCA at Apr 19, 2007 6:27:44 PM
然后再进入 http://172.19.111.38:1158/em 查看正常了。
Oracle10G的EM采用了web方式,并且分成了2个产品,database control和grid control。Grid control需要下载单独的光盘安装。在用DBCA建库的时候,可以选择是否启用dbcontrol,启用的话需要在数据库中建立一个sysman的schema,用于保存EM的一些数据,这个就是EM的资料库(repository)。使用命令行工具emca可以创建,修改,重建或者删除dbcontrol的配置。
由于要在数据库中建EM资料库,数据库和监听都必须已经启动并正常工作。
emca -repos create 创建一个EM资料库
emca -repos recreate 重建一个EM资料库
emca -repos drop 删除一个EM资料库
emca -config dbcontrol db
配置数据库的 Database Control
emca -deconfig dbcontrol db
删除数据库的 Database Control配置
emca -reconfig ports
重新配置db control和agent的端口
emctl start console
启动EM console服务,使用前需要先
设置ORACLE_SID环境变量
emctl stop console 停止EM console服务,
使用前需要先设置ORACLE_SID环境变量
注:通过查看$ORACLE_HOME/install/portlist.ini
文件可以知道当前dbcontrol正在使用的端口,
默认dbcontrol http端口1158,agent端口3938。
假如要重新配置端口,可以使用如下命令:
emca -reconfig ports -dbcontrol_http_port 1159
emca -reconfig ports -agent_port 3939
使用命令行工具emctl可以启动/停止console服务,察看服务状态等。
访问http://localhost:1158/em/,端口号可能已经改变,如果还是不能访问,通过查看$ORACLE_HOME/install/portlist.ini文件,以确定当前dbcontrol正使用的端口是多少。
Login正常后,我们再执行以下命令:
$sqlplus /nolog
SQL> conn
Enter user-name: SYSMAN
Enter password:
Connected.
SQL> exec mgmt_target.set_agent_tzrgn('10.1.130.78:3938','Etc/GMT-7');
It is OK.
附:
检查EM dbconsole 配置属性
‑} Z!`4RZ9Qn1L&f K(k0检查$ORACLE_HOME/<hostname>_<SERVICE_NAME>/sysman/config下的ITPUB个人空间r
]~
kT3emoms.properties。