测试的主机os是redhat5.3,数据库是oracle10.2.0
为了以后安装方便,使用以下几个文件安装login.txt,kernel.txt,path.txt,limits.txt,createdb.txt
Kernel.txt,init.txt
#!/bin/bash
#/oracle/kernel.txt
fs.file-max = 6815744
fs.aio-max-nr = 1048576
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
limits.txt
#!/bin/bash
#/oracle/limits.txt
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
login.txt
#!/bin/bash
#/oracle/login.txt
session required /lib/security/pam_limits.so
session required pam_limits.so
path.txt
#!/bin/bash
#/oracle/path.txt
export ORACLE_BASE=/opt/oracle/product/10.2.0
export ORACLE_HOME=$ORACLE_BASE/db_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export DISPLAY=192.168.15.125:0.0
export NLS_LANG='SIMPLIFIED CHINESE_CHINA.ZHS16GBK'
createdb.txt
#!/bin/bash
#/oracle/createdb.txt
CREATE DATABASE orcl
USER SYS IDENTIFIED BY orcl
USER SYSTEM IDENTIFIED BY orcl
LOGFILE GROUP 1 ('/opt/oracle/product/10.2.0/oradata/orcl/redo01.log') SIZE 100M,
GROUP 2 ('/opt/oracle/product/10.2.0/oradata/orcl/redo02.log') SIZE 100M,
GROUP 3 ('/opt/oracle/product/10.2.0/oradata/orcl/redo03.log') SIZE 100M
MAXLOGFILES 30
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
DATAFILE '/opt/oracle/product/10.2.0/oradata/orcl/system01.dbf' SIZE 225M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/opt/oracle/product/10.2.0/oradata/orcl/sysaux01.dbf' SIZE 125M REUSE
DEFAULT TABLESPACE users
DATAFILE '/opt/oracle/product/10.2.0/oradata/orcl/users01.dbf'
SIZE 5M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/opt/oracle/product/10.2.0/oradata/orcl/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/opt/oracle/product/10.2.0/oradata/orcl/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
#红色的是可以修改的
Makeup.sh
#!/bin/bash
#/oracle/makeup.sh
mkdir -p /opt/oracle/product/11.0.0/db_1
groupadd oinstall
groupadd dba
useradd -d /home/oracle -m -g oinstall -G dba oracle
passwd oracle
echo "this is add user"
chown -R oracle:oinstall /opt/oracle/product/10.2.0/db_1
chown -R oracle:oinstall /oracle/
echo "this grant "
cd /opt/oracle/
chmod 777 product
cd product
chmod 777 10.2.0
cat path.txt >> /home/oracle/.bashrc
cat kernel.txt >> /etc/sysctl.conf
cat login >> /etc/pam.d/login
cat limits.txt >> /etc/security/limits.conf
sysctl -p
echo " this is path "
mkdir /cdrom
mount /dev/hdc /cdrom
cd /cdrom/Server
rpm -ivh libaio-devel-0.3.106-3.2.i386.rpm libaio-0.3.106-3.2.i386.rpm libgcc-4.1.2-44.el5.i386.rpm libstdc++43-devel-4.3.2-7.el5.i386.rpm libstdc++-devel-4.1.2-44.el5.i386.rpm make-3.81-3.el5.i386.rpm unixODBC-2.2.11-7.1.i386.rpm unixODBC-devel-2.2.11-7.1.i386.rpm --force --nodeps
rpm -ivh gcc-4.1.2-44.el5.i386.rpm libgomp-4.3.2-7.el5.i386.rpm elfutils-libelf-devel-0.137-3.el5.i386.rpm elfutils-libelf-devel-static-0.137-3.el5.i386.rpm glibc-devel-2.5-34.i386.rpm glibc-headers-2.5-34.i386.rpm kernel-headers-2.6.18-128.el5.i386.rpm sysstat-7.0.2-3.el5.i386.rpm --force --nodeps
rpm -ivh gcc-c++-4.1.2-44.el5.i386.rpm
rpm –ivh libXp* --force --nodeps
ehco " this is add software"
init.txt
ob_queue_processes=5
sga_max_size=280M
sga_target=280M
undo_management=auto
undo_tablespace=undotbs1
db_block_size=8192
db_create_file_dest = /opt/oracle/product/10.2.0/oradata/orcl
db_create_online_log_dest_1 = /opt/oracle/product/10.2.0/oradata/ orcl
audit_file_dest=/opt/oracle/product/10.2.0/admin/orcl /adump
background_dump_dest=/opt/oracle/product/10.2.0/admin/orcl /bdump
core_dump_dest=/opt/oracle/product/10.2.0/admin/orcl /cdump
user_dump_dest=/opt/oracle/product/10.2.0/admin/orcl /udump
执行makeup.sh,添加oracle用户,及其他的设置。
安装数据库软件,执行数据库脚本。
开始手动安装数据库
手动创建以下目录
Mkdir –p /opt/oracle/product/10.2.0/admin/orcl
Cd /opt/oracle/product/10.2.0/admin/orcl
Mkdir cdump bdump udump adump
Cd /opt/oracle/product/10.2.0/
Mkdir –p oradata/orcl
生成简单的初始化参数文件
cat init.ora | grep -v ^# | grep -v ^$ > initorcl.ora
cat init.txt >> initorcl.ora
注意修改参数文件中的数据库名称,还要注释掉db_block_buffers =这一行,否则启动的时候会报错。
启动到nomount阶段
SQL> startup nomount
ORACLE 例程已经启动。
Total System Global Area 293601280 bytes
Fixed Size 1261444 bytes
Variable Size 96469116 bytes
Database Buffers 192937984 bytes
Redo Buffers 2932736 byte
SQL> shutdown abort
ORACLE 例程已经关闭。
SQL> create spfile from pfile;
SQL> startup nomount
ORACLE 例程已经启动。
Total System Global Area 293601280 bytes
Fixed Size 1261444 bytes
Variable Size 96469116 bytes
Database Buffers 192937984 bytes
Redo Buffers 2932736 bytes
创建密码文件
Orapwd file=$ORACLE_HOME/dba/orapworcl password=orcl entries=5;
创建数据库
SQL>@createdb.txt
创建必要的数据字典和内置的package
SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
optional:
connect /as sysdba
@?/rdbms/admin/catblock.sql
@?/rdbms/admin/catoctk.sql
@?/rdbms/admin/owminst.plb
connect system/oracle
@?/sqlplus/admin/pupbld.sql
@?/sqlplus/admin/help/hlpbld.sql helpus.sql
查看数据文件,日志文件和控制文件
control01.ctl redo01.log sysaux01.dbf undotbs01.dbf
control02.ctl redo02.log system01.dbf users01.dbf
control03.ctl redo03.log temp01.dbf
配置网络
创建sqlnet.ora,listener.ora,tnsnames.ora参照sample下面的内容
[root@gyc admin]# cat listener.ora
# listener.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /opt/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.15.215)(PORT = 1521))
)
)
[root@gyc admin]# cat sqlnet.ora
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
[root@gyc admin]# cat tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.15.215)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)