Install Oracle 10GR2 10.2.0.3 in RedHat Enterprise Linux 4 Update 5(5)

#==============================================================================
#执行dbca 创建oracle数据库


dbca

进入欢迎界面,选择Next


选择:Create a Database

选择数据库的类型General Purpose、 Transaction Processing 或 Data Warehouse。
 一般选择General Purpose即可,如果你想调整具体的各项参数,可以选择Custom。
 建议选择Custom。因为一些参数只有在选择Custom安装时才允许你修改。单击 Next。

Specify Database Configuration Options 页面出现。
 在 Database Naming 部分输入 Global Database Name 和 SID。 都为orcl。要和你在ORACLE_SID一致。
 

Select Database Management Option 页面出现。
 选择 Use Database Control for Database Management。单击 Next。


Specify Database Schema Passwords 页面出现。
 选择 Use the same passwords for all accounts,并输入密码。单击 Next。
 

Specify Database File Storage Option 页面出现。
 选择适合您的环境的 File System、Automatic Storage Management 或Raw Devices 。
 我们选择File System。
 单击 Next。


Specify locations for the DB file to create页面出现。选择缺省"Use DB files locations for Template"。
 
 注意:如果你想支持redo log和控制文件的多元化,就要使用Oracle-Managed Files(OMF)。Oracle 推荐使用OMF。具体的原因就不介绍了。


Specify Flash Recovery Area,选取缺省值。
 
 对于重要的生产数据库一定要选中"Enable Archiving"。这样才能使用RMAN进行在线备份工作。
 同时要配置Archiving的参数,如果不配置的话,Archiving Log会存放到给Flash Recovery Area保留的磁盘空间中。
 需要单独为Archiving配置磁盘空间!
 
 cd ~oracle
 
 mkdir Archiving_Log
 
 配置Archiving Log Destinations为:
 
 /data/oracle/Archiving_Log
 
 选择Next。
 
 
DataBase Content界面的DataBase Components选择DB支持的功能。除了Enterprise Manager Repositort以外,一般这些功能都用不上。
 对于小型DB你可以保持缺省选项即可。
 
选择Next
 

进入配置初始化参数界面。这些参数在以后都可以修改,但要注意如下几点:
 
 在内存选项中,选择Typical。如果服务器专门用于Oracle数据库,百分比可以选择到80%。
 
 在Sizing选项中,Block Size缺省为8K,对于OLAP可以选择的大一些,对于OLTP可以选择的小一些,但是Oracle推荐不要小于2K。
 具体的选择要看实际的应用了。对于一般的应用选择默认即可。注意:这个值以后就不能修改了,要修改必须删除DB重新创建。
 还要注意,一个DataFile在Block Size为8K时才能达到最大32GB。如果Block Size为4K,最大单个DataFile就是16GB。
 
 Process缺省150个,对于专用服务器模式可以保持缺省值。以后可以修改。
 
 
 在字符集选项中,如果你运行的Linux环境是英文或者UTF8的中文环境的话,需要手工选择ZHS16GBK为字符集。这也是一般情况。具体的要看你的应用。
 今后的趋势应该是统一到UTF8甚至UTF16/UTF32。
 
 国家字符集保持缺省的AL16UTF16即可。关于国家字符集和字符集的区别,大家可以看看文档或者去培训一下Oracle的课程。
 
 缺省语言和缺省日期格式使用:American和United States。
 
 注意:这些参数关系到今后的EXP/IMP和EM显示等问题,并且和OS的语言环境密切相关,因此请大家仔细的学习。
 

 在连接模式选项中,选择专用服务器模式。关于专用服务器模式和共享服务器模式的选择原则。我结合Oracle的课程和文档总结如下:
 
 如果你资金雄厚,尽量使用专用服务器模式
 
 如果你没有充足的资金去购买高内存和多CPU的服务器,又要有大量的用户连接,选择共享服务器模式。
 
 如果用户进程占用比较大的内存,使用专用服务器模式。Oracle的建议是如果用户进程占用的用户数据达到16K以上就要使用专用服务器模式。
 
 在此我们选用专用服务器模式。
 
 注意:对于初始化参数的调整是Oracle调优的很关键的因素,因此要好好学习!
 
 
 选择Next。
 
 
出现Database Storage屏幕:

 在这里你可以修改Oracle的各种文件的数量和存放位置。一般使用缺省值即可。对于大型的DB你可能要考虑的因素如下:
 
 控制文件的数量和存放位置:控制文件很小,但是对于Oracle很重要,因此尽量把控制文件放在不同的磁盘上保存。
 
 最大数据文件,最大redo log文件和最大redo log组成员的数量。对于大型DB可能缺省值是不够的。
 
 表空间和数据文件的大小等参数,根据你的要求修改即可。
 
 Redo Log Groups:一般采用缺省即可。具体的配置根据很多的因素有不同的配制方法,这里不详细介绍了。
 
 选择Next
 
 
选择数据库创建选项窗口出现:

 选择创建数据库即可。


选择Finish。


出现确认对话框,选择OK!

开始创建数据库。


创建数据库完毕后,Exit退出DBCA。

 
生成的数据库创建脚本放在:/data/oracle/admin/orcl/scripts,你可以看看,我在Oracle培训的时候
就是不用DBCA生成DB,而是生成创建DB的Scripts,然后再在命令行窗口里面创建DB。

 

#==============================================================================
#在profile里面打开ORACLE_HOME环境变量


export ORACLE_HOME=$ORACLE_BASE/product/10.2.0


Updates after Running Oracle Universal Installer

After Oracle10g has been installed, make sure that ORACLE_HOME, PATH, and LD_LIBRARY_PATH are set for the oracle account.

Note that the path for ORACLE_HOME might be different on your system!
Also note that LD_LIBRARY_PATH is needed for some Oracle binaries such as sysresv!

For 10g R2 (10.2.0.1.0) I added the following lines to the ~oracle/.bash_profile file:

export ORACLE_HOME=$ORACLE_BASE/oracle/product/10.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib

After that run the following command to set all environment variables in ~oracle/.bash_profile:
$ . ~oracle/.bash_profile
This commmand will add the environment variables to the ~oracle/.profile and source in the file for the current shell by
executing ". ~oracle/.bash_profile".

NOTE: Do not add a trailing "/" on the ORACLE_HOME environment variable.
Otherwise you will get the error "ORACLE not available" when you try to connect to sys, see Oracle10g/Linux Errors and Problems for more information.

 


#==============================================================================
#执行netca 创建Oracle Listener

Oracle 10gR2 支持动态注册Listener。PMON进程会自动的把新的Oracle Server注册进Listener,而不必执行NETCA。
当然了你也可以执行NETCA进行静态注册。

只需要启动listener服务即可。


[oracle@RHEL-45 bin]$ lsnrctl start

LSNRCTL for Linux: Version 10.2.0.3.0 - Production on 04-JUL-2007 14:58:26

Copyright (c) 1991, 2006, Oracle.  All rights reserved.

Starting /data/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.3.0 - Production
Log messages written to /data/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=RHEL-45)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.3.0 - Production
Start Date                04-JUL-2007 14:58:26
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /data/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=RHEL-45)(PORT=1521)))
The listener supports no services
The command completed successfully


[oracle@RHEL-45 bin]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.3.0 - Production on 04-JUL-2007 14:58:44

Copyright (c) 1991, 2006, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.3.0 - Production
Start Date                04-JUL-2007 14:58:26
Uptime                    0 days 0 hr. 0 min. 17 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /data/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=RHEL-45)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_XPT" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@RHEL-45 bin]$ pstree


你会发现orcl这个实例已经被listener监听了。

Instance "orcl", status READY, has 1 handler(s) for this service...
 


测试一下连接

[oracle@RHEL-45 bin]$ ./sqlplus sys/system as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Wed Jul 4 15:02:35 2007

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> show parameter

如果能显示出来初始化参数即可。

 
#------------------------------------------------------------------------------
#手工配置静态listener

cd $ORACHE_HOME/bin

./netca

从略了。。。。。


#==============================================================================
#启动和维护DBConsole和iSQL*Plus

安装完成后,可以通过访问http://ADA:1158/em来使用EM,可以通过访问http://ADA:5560/isqlplus来使用isqlplus,
还可以通过访问
http://ADA:5560/isqlplus/dba来使用DBA工具。那么可以执行如下命令:

查询状态
$ emctl status dbconsole

启动程序
$ emctl start dbconsole

停止程序
$ emctl stop dbconsole

只有这个“监听”启动了,我们才可以顺利地访问http://ADA:1158/em这个东东。


启动isqlplus
$ isqlplusctl start

停止isqlplus
$ isqlplusctl stop

同理,只有这个“监听”起来了,我们才可以顺利地访问http://ADA:5560/isqlplushttp://ADA:5560/isqlplus/dba的。


#------------------------------------------------------------------------------
#启动EM DBConsole

[oracle@RHEL-45 ~]$ emctl start dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database Control Release 10.2.0.3.0 
Copyright (c) 1996, 2006 Oracle Corporation.  All rights reserved.
http://RHEL-45:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control ....................... started.
------------------------------------------------------------------
Logs are generated in directory /data/oracle/product/10.2.0/db_1/RHEL-45_orcl/sysman/log


#------------------------------------------------------------------------------
#启动iSQL*Plus

[oracle@RHEL-45 ~]$ isqlplusctl start
iSQL*Plus 10.2.0.3.0
Copyright (c) 2003, 2006, Oracle.  All Rights Reserved.
Starting iSQL*Plus ...
iSQL*Plus started.

 


#==============================================================================
#数据库维护的操作。


使用SQLPlus启动数据库:

 

[oracle@RHEL-45 bin]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Wed Jul 4 15:22:37 2007

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

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 1241513984 bytes
Fixed Size                  1261516 bytes
Variable Size             318767156 bytes
Database Buffers          905969664 bytes
Redo Buffers               15515648 bytes
Database mounted.
Database opened.

SQL> show instance;
instance "local"
SQL>


使用SQLPlus停止数据库:


SQL> shutdown immediate;

Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> quit


#------------------------------------------------------------------------------
#Oracle 10gR2提供一个简单的启动/关闭Oracle实例的脚本。

在使用这个脚本前需要修改/etc/oratab,把那一行最后的N改成Y。
改成Y的目的是可以使用dbstart/dbshut脚本启动/关闭数据库。

# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form.:
#   $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/data/oracle/product/10.2.0/db_1:Y

 

这时候使用dbstart $ORACLE_HOME可以自动的启动Listener和DB。

[oracle@RHEL-45 ~]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /data/oracle/product/10.2.0/db_1/bin/dbstart ORACLE_HOME
Processing Database instance "orcl": log file /data/oracle/product/10.2.0/db_1/startup.log

注意:dbstart/dbshut 命令后面要添加一个ORACLE_HOME_LISTNER参数,否则Listener无法自动启动/关闭。


[oracle@RHEL-45 ~]$ dbstart $ORACLE_HOME
Processing Database instance "orcl": log file /data/oracle/product/10.2.0/db_1/startup.log

[oracle@RHEL-45 ~]$ dbshut $ORACLE_HOME
Processing Database instance "orcl": log file /data/oracle/product/10.2.0/db_1/shutdown.log

 


#==============================================================================
#Oracle 开机自动运行。


注意!安装完Oracle后不要轻易的修改主机名和IP地址。如果修改了,需要重新运行netca来reconfigure Listener!!!

#------------------------------------------------------------------------------

数据库创建完成后,修改/etc/oratab,把那一行最后的N改成Y。
改成Y的目的是可以使用dbstart/dbshut脚本启动/关闭数据库。

# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form.:
#   $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/data/oracle/product/10.2.0/db_1:Y

 

#------------------------------------------------------------------------------

vi /etc/rc.d/rc.local

添加:


su - oracle -c "/data/oracle/product/10.2.0/db_1/bin/dbstart $ORACLE_HOME"


注意:如果你没有在oracle用户的.bash_profile里面设置$ORACLE_HOME环境变量的话,就要这么写了:

su - oracle -c "/data/oracle/product/10.2.0/db_1/bin/dbstart /data/oracle/product/10.2.0/db_1"

 

#==============================================================================
#关于表空间和数据文件的大小


Internally, the data object number needs 32 bits, the relative file number needs 10 bits,the block number needs 22 bits,
and the row number needs 16 bits, adding up to a total of 80 bits or 10 bytes.

ROWID is displayed using a base-64 encoding scheme, which uses six positions for the data object number,
three positions for the relative file number, six positions for the block number, and three positions for the row number.

这就是说,每个数据库最多有1024-2=1022个文件(2个文件预留),每个文件最多有4M个 块,如果用默认的oracle block,即8192byte,
那么每个datafile最大为:4M×8K=32GB;所以,每个表空间最大就是32GB×1022=32704GB=32TB。


#==============================================================================
#关于Response文件的例子:

   这一步骤是字符界面装oracle的关键步骤
   到oracle 10g的安装目录下编辑response文件
   $cd /home/share/Oracle/Oracle10g_64bit/database/response/
   可以看到oracle准备了6个response文件,实际上这些文件就是用来安装和配置oracle时的模板,
分别是 custom.rsp dbca.rsp emca.rsp enterprise.rsp netca.rsp standard.rsp在这里挑了一个简
单的response文件 enterprise.rsp,也可以根据实际情况去选用编辑其他几个response文件。

$cp custom.rsp myinst.rsp
   $vi myinst.rsp

修改几个地方,有几个不会改的.

#==============================================================================
#End。
#==============================================================================

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8295/viewspace-578170/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8295/viewspace-578170/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值