Oracle 10g官方文档上写对于红帽linux只能装在rhel4以下的操作系统版本上,当然装在rhel5上也没有什么问题,但需要oracle公司的特别授权,否则将来无法联系oracle公司进行support。在rhel6上装oracle,如果采用传统的./runInstall.sh方式,则会遇到错误,需要用点特殊的手段,才能搞定!而且需要使用tar打包在rhel5上装好的oracle软件(关闭oracle后打包),软件体系架构要相符合;同样可以使用这种方式在PXE装机的时候,直接把oracle软件和数据库一起装上,但需要精心编写PXE post%节脚本!
1:创建oracle用户和oinstall,dba组
- [root@rhel6 ~]# groupadd oinstall
- [root@rhel6 ~]# groupadd dba
- [root@rhel6 ~]# useradd -g oinstall -G dba oracle
- [root@rhel6 ~]# echo 'oracle' |passwd --stdin oracle
- Changing password for user oracle.
- passwd: all authentication tokens updated successfully.
2:修改相应的环境变量
- [root@rhel6 /]# su - oracle
- [oracle@rhel6 ~]$ cat .bash_profile
- # .bash_profile
- # Get the aliases and functions
- if [ -f ~/.bashrc ]; then
- . ~/.bashrc
- fi
- # User specific environment and startup programs
- ORACLE_BASE=/u01/app
- ORACLE_HOME=/u01/app/oracle
- ORACLE_SID=ora10g
- LD_LIBRARY_PATH=$ORACLE_HOME/lib
- PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
- alias sqlplus='/usr/local/rlwrap/bin/rlwrap sqlplus'
- alias rman='/usr/local/rlwrap/bin/rlwrap rman'
- NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
- NLS_LANG=american_america.UTF8
- EDITOR=vim
- export PATH ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH DISPLAY NLS_DATE_FORMAT NLS_LANG EDITOR
3:将rhel5上打包过的oracle解压到rhel6上
[root@rhel6 ~]# chown -R oracle.oinstall /u01/
[root@rhel6 /]# tar -zxvpf /u01/ora10g.tar.gz
4: 启动数据库报错如下,需要将oracle用户加入root组
- [root@rhel6 /]# su - oracle
- [oracle@rhel6 ~]$ sqlplus /nolog
- SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jun 15 15:15:46 2011
- Copyright (c) 1982, 2005, Oracle. All rights reserved.
- SQL> conn /as sysdba
- Connected to an idle instance.
- SQL> startup
- ORA-27125: unable to create shared memory segment
- Linux-x86_64 Error: 1: Operation not permitted
- [root@rhel6 /]# head -n 1 /etc/group
- root:x:0:root,oracle
- [root@rhel6 /]# su - oracle
- [oracle@rhel6 ~]$ sqlplus /nolog
- SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jun 15 15:34:58 2011
- Copyright (c) 1982, 2005, Oracle. All rights reserved.
- SQL> conn /as sysdba
- Connected to an idle instance.
- SQL> startup
- ORACLE instance started.
- Total System Global Area 629145600 bytes
- Fixed Size 2022824 bytes
- Variable Size 197132888 bytes
- Database Buffers 423624704 bytes
- Redo Buffers 6365184 bytes
- Database mounted.
- Database opened.
- SQL> select open_mode,log_mode from v$database;
- OPEN_MODE LOG_MODE
- ------------------------------ ------------------------------------
- READ WRITE ARCHIVELOG
5:启动isqlplus和listener
- [oracle@rhel6 ~]$ lsnrctl start
- [oracle@rhel6 ~]$ isqlplusctl start
- [oracle@rhel6 ~]$ netstat -ntpl |egrep '1521|5560'
- (Not all processes could be identified, non-owned process info
- will not be shown, you would have to be root to see it all.)
- tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 4167/tnslsnr
- tcp 0 0 0.0.0.0:5560 0.0.0.0:* LISTEN 4176/java
6:重新配置dbconsole,配置前保证在rhel6上可以打开dbca和netca图形界面
- SQL> alter user sys identified by "123456";
- User altered.
- SQL> alter user system identified by "123456";
- User altered.
- SQL> alter user sysman identified by "123456";
- User altered.
- SQL> alter user dbsnmp identified by "123456";
- User altered.
- [oracle@rhel6 ~]$ emca -deconfig dbcontrol db -repos drop -silent -PORT 1521 -SID ora10g -SYS_PWD 123456 -DBSNMP_PWD 123456 -SYSMAN_PWD 123456
- STARTED EMCA at Jun 15, 2011 4:30:43 PM
- EM Configuration Assistant, Version 10.2.0.1.0 Production
- Copyright (c) 2003, 2005, Oracle. All rights reserved.
- Jun 15, 2011 4:30:43 PM oracle.sysman.emcp.EMConfig perform
- INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/ora10g/emca_2011-06-15_04-30-43-PM.log.
- Jun 15, 2011 4:30:43 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
- INFO: Stopping Database Control (this may take a while) ...
- Jun 15, 2011 4:30:48 PM oracle.sysman.emcp.EMReposConfig dropRepository
- INFO: Dropping the EM repository (this may take a while) ...
- Jun 15, 2011 4:32:23 PM oracle.sysman.emcp.EMReposConfig invoke
- INFO: Repository successfully dropped
- Enterprise Manager configuration completed successfully
- FINISHED EMCA at Jun 15, 2011 4:32:23 PM
- oracle@rhel6 ~]$ emca -config dbcontrol db -repos recreate -silent -reconfig ports -DBCONTROL_HTTP_PORT 1158 -SID ora10g -HOST 192.168.50.4 -SYS_PWD 123456 -PORT 1521 -DBSNMP_PWD 123456 -SYSMAN_PWD 123456
- STARTED EMCA at Jun 15, 2011 5:29:11 PM
- EM Configuration Assistant, Version 10.2.0.1.0 Production
- Copyright (c) 2003, 2005, Oracle. All rights reserved.
- Jun 15, 2011 5:29:11 PM oracle.sysman.emcp.EMConfig perform
- INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/ora10g/emca_2011-06-15_05-29-10-PM.log.
- Jun 15, 2011 5:29:12 PM oracle.sysman.emcp.util.PortManager isPortInUse
- WARNING: Specified port 1158 is already in use.
- Jun 15, 2011 5:29:12 PM oracle.sysman.emcp.EMReposConfig dropRepository
- INFO: Dropping the EM repository (this may take a while) ...
- Jun 15, 2011 5:29:13 PM oracle.sysman.emcp.EMReposConfig invoke
- INFO: Repository successfully dropped
- Jun 15, 2011 5:29:13 PM oracle.sysman.emcp.EMReposConfig createRepository
- INFO: Creating the EM repository (this may take a while) ...
- Jun 15, 2011 5:31:35 PM oracle.sysman.emcp.EMReposConfig invoke
- INFO: Repository successfully created
- Jun 15, 2011 5:31:40 PM oracle.sysman.emcp.util.DBControlUtil startOMS
- INFO: Starting Database Control (this may take a while) ...
- Jun 15, 2011 5:33:16 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
- INFO: Database Control started successfully
- Jun 15, 2011 5:33:16 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
- INFO: >>>>>>>>>>> The Database Control URL is http://rhel6.766.com:1158/em <<<<<<<<<<<
- Enterprise Manager configuration completed successfully
- FINISHED EMCA at Jun 15, 2011 5:33:16 PM
- [oracle@rhel6 ~]$ netstat -ntpl |egrep '1158|1521|5560'
- (Not all processes could be identified, non-owned process info
- will not be shown, you would have to be root to see it all.)
- tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 2095/tnslsnr
- tcp 0 0 0.0.0.0:5560 0.0.0.0:* LISTEN 3991/java
- tcp 0 0 0.0.0.0:1158 0.0.0.0:* LISTEN 3881/java
7:测试