Oracle 数据库之克隆方法Oracle 8.1.7 for Linux系统,在安装上存在一切困难,尤其在Redhat7.2系统下安装的时候会出现很多意想不到的事情,譬如图形界面无法显示、xwin无法远程连接,在编译的过程中如果没有安装GCC,Glibc等等一些库文件,容易出现无法link的错误,而全部安装又会造成其他困难。因此在Oracle安装过程中总结出来了一些经验。介绍如下:
<1>:Oracle在一台服务器中安装成功后,可以作为种子系统,将其打成tar.gz包,并平滑转移到另外一台服务器上,经过测试没有问题;
<2>: 另外一台没有事先安装oracle系统的服务器需要安装 JDK (java虚拟机),因为oracle一些jar文件需要java虚拟机来解释运行,假如没有jdk,即使转移安装好的oracle也会出现各种错误;
<3>:需要设置oracle用户的环境变量,在oracle系统用户登陆后,要读取 /home/oracle/.bash_proile的环境变量,如果没有这些变量,一些程序无法找到或无法运行;
<4>:需要修改oracle的监听的Hostname,如果使用安装好的hostname,那么在使用oracle windows client远程连接数据库会出现无法远程连接数据库的问题;
<5>:oci8.so(php与oracle接口程序)][哦仍然需要本地安装好gcc编译器,因为copy其他服务器的oci8.so文件,有可能不能正常连接运行。
<6>:用户登陆的启动oracle数据库,必须要用oracle用户来启动,如果用root用户来启动会造成安全隐患。
b):安装数据库步骤:
<1>:准备用户环境。
#groupadd dba
#groupadd oinstall
#useradd oracle -g oinstall -G dba
#passwd oracle
输入新用户的密码。
创建安装目录(以/var/oracle/为例)
#mkdir /var/oracle
#chown oracle.dba /var/oracle
#chmod 777 /var/oracle
<2>:设置Oracle用户的登陆环境变量,编辑 /home/oracle/.bash_profile文件,将下列参数加入到 /home/oracle/.bash_profile中;
. /usr/i386-glibc21-linux/bin/i386-glibc21-linux-env.sh
export LD_ASSUME_KERNEL=2.2.5
export LDEMULATION=elf_i386_glibc21
export GCC_EXEC_PREFIX=/usr/i386-glibc21-linux/lib/gcc-lib/
export ORACLE_BASE=/var/oracle
export ORACLE_HOME=$ORACLE_BASE/product/8.1.7
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export ORACLE_SID=Billing
export ORACLE_TERM=vt100
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
umask 022
c):将OracleOk.tar.gz文件解压缩
获得已经安装好的OracleOk.tar.gz文件,将其解压缩到/var/oracle目录中,安装方式如下:
[voipack@bobyang root]# cd /var/oracle
[voipack@bobyang root]# tar –xvzf oracleOk.tar.gz
d):安装JDK
将jdk118_v3-glibc-2.1.3.tar.bz2 copy到/usr/local
[voipack@bobyang root]# cp jdk118_v3-glibc-2.1.3.tar.bz2 /usr/local/
[voipack@bobyang root]# bunzip2 -d jdk118_v3-glibc-2.1.3.tar.bz2
[voipack@bobyang root]# tar xvf jdk118_v3-glibc-2.1.3.tar
[voipack@bobyang root]#ln -s /usr/local/jdk118_v3 /usr/local/java
:修改 /var/oracle/product/8.1.7/network/admin下的listener.ora跟tnsnames.ora文件中的HOST名字。将Host的名称修改为本地服务器Host名称。
# Generated by Oracle configuration tools.
LISTENER =
(DEs criptION_LIST =
(DEs criptION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = Bobyang)(PORT = 1521))
)
)
(DEs criptION =
(PROTOCOL_STACK =
(PRESENTATION = GIOP)
(SESSION = RAW)
)
(ADDRESS = (PROTOCOL = TCP)(HOST = Bobyang)(PORT = 2481))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /var/oracle/product/8.1.7)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = Billing)
(ORACLE_HOME = /var/oracle/product/8.1.7)
(SID_NAME = Billing)
)
)
f):oracle系统启动
<1>:以oracle用户登陆到Linux系统
[oracle@bobyang oracle]$ sqlplus /nolog (本地连接数据库oracle)
SQL*Plus: Release 8.1.7.0.0 - Production on Fri May 23 14:56:21 2003
(c) Copyright 2000 Oracle Corporation. All rights reserved.
SQL>connect /as sysdba (以sysdba超级用户连接数据库)
Connected.
SQL> startup (启动oracle数据库)
ORACLE instance started.
Total System Global Area 72704160 bytes
Fixed Size 73888 bytes
Variable Size 55681024 bytes
Database Buffers 16777216 bytes
Redo Buffers 172032 bytes
Database mounted.
Database opened.
SQL>exit (退出oracle数据库)
Disconnected from Oracle8i Enterprise Edition Release 8.1.7.0.1 - Production
With the Partitioning option
JServer Release 8.1.7.0.1 - Production
[oracle@bobyang oracle]$ lsnrctl start (启动Oracle net8远程监听端口)
LSNRCTL for Linux: Version 8.1.7.0.0 - Production on 23-MAY-2003 14:59:35
(c) Copyright 1998 Oracle Corporation. All rights reserved.
Starting /var/oracle/product/8.1.7/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 8.1.7.0.0 - Production
System parameter file is /var/oracle/product/8.1.7/network/admin/listener.ora
Log messages written to /var/oracle/product/8.1.7/network/log/listener.log
Listening on: (DEs criptION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Listening on: (DEs criptION=(ADDRESS=(PROTOCOL=tcp)(HOST=netbank)(PORT=1521)))
Listening on: (DEs criptION=(ADDRESS=(PROTOCOL=tcp)(HOST=netbank)(PORT=2481))(PROTOCOL_STACK=(PRESENTATION=GIOP)(SESSION=RAW)))
Connecting to (DEs criptION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 8.1.7.0.0 - Production
Start Date 23-MAY-2003 14:59:35
Uptime