20090611字符安装oracle

1.安装前准备

安装前准备
检查所需的OS
创建用户和组
配置内核参数
设置环境变量

2.安装所需的responseFile

oracle安装文件在/oracle/database/
cp /oracle/database/response/enterprise.rsp  /tmp/installoracle.rsp
vi /tmp/installoracle.rsp
#设置如下参数
#Description: Unix group to be set for the inventory directory.
UNIX_GROUP_NAME="oinstall"
#Description: Complete path of the Oracle Home.
ORACLE_HOME="/oracle/u01/app/oracle/product/10.2.0/db2"
#Description: Oracle Home Name. Used in creating folders and services.
ORACLE_HOME_NAME="OraDbHomel"
#Description: This variable holds the hostname of the system as set by the user.
ORACLE_HOSTNAME="onlinux"
# The OS group to be granted OSDBA privileges
s_nameForDBAGrp="dba"
# The OS group to be granted OSOPER privileges
s_nameForOPERGrp="dba"
# Description: Determines the type of configuration to perform for the session.
#3 Install Software Only
n_configurationOption=3

3. 安装oracle软件

./runInstaller –silent –responseFile /tmp/installoracle.rsp
安装过程要执行两个脚本不要忘记

4.安装数据库

1.建立相关的目录
mkdir  –p  $ORACLE_BASE/admin/ORACLE_SID
cd $ORACLE_BASE/admin/ORACLE_SID
mkdir adump bdump cdump dpdump udump
2.建立密码文件
cd $ORACLE_HOME/dbs/
orapwd  file=orapwSID password=123456 force=y
3.建立参数文件(pfile)
cd $ORACLE_HOME/dbs/
vi initSID.ora
db_name=SID
undo_tablespace=undotbs1
undo_management=AUTO
shared_pool_size=120M
#control_file可以不写,但有时不行
#control_files=
4.运行建库的脚本
首先建立一个脚本
vi creatdb.sql
CREATE DATABASE testdb
   USER SYS IDENTIFIED BY sys
   USER SYSTEM IDENTIFIED BY sys
   LOGFILE GROUP 1 ('/u01/app/oracle /oradata/testdb/redo01.log') SIZE 100M,
           GROUP 2 ('/u01/app/oracle /oradata/testdb/redo02.log') SIZE 100M,
           GROUP 3 ('/u01/app/oracle /oradata/testdb/redo03.log') SIZE 100M
   MAXLOGFILES 5
   MAXLOGMEMBERS 5
   MAXLOGHISTORY 1
   MAXDATAFILES 100
   MAXINSTANCES 1
   CHARACTER SET AL32UTF8
   NATIONAL CHARACTER SET AL16UTF16
   DATAFILE '/u01/app/oracle /oradata/testdb/system01.dbf' SIZE 325M REUSE
   EXTENT MANAGEMENT LOCAL
   SYSAUX DATAFILE '/u01/app/oracle /oradata/testdb/sysaux01.dbf' SIZE 325M REUSE
   DEFAULT TABLESPACE usertbs DATAFILE '/u01/app/oracle /oradata/testdb/usertbs.dbf' SIZE 10M REUSE
   DEFAULT TEMPORARY TABLESPACE tempts1
      TEMPFILE '/u01/app/oracle /oradata/testdb/temp01.dbf'
      SIZE 20M REUSE
   UNDO TABLESPACE undotbs
      DATAFILE '/u01/app/oracle /oradata/testdb/undotbs01.dbf'
      SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
       运行
SQL>@/oracle/database/creatdb.sql
 
当出database done sucessful就成功了
5.最后运行三个脚本
前两个sysdba运行,后一个system运行
sqlplus / as sysdba
SQL>@$ORACLE_HOME/rdbms/admin/catalog.sql
SQL>@$ORACLE_HOME/rdbms/admin/catproc.sql
SQL>disconnect
Sqlplus system /
Passwd:
SQL>@$ORACLE_HOME/sqlplus/admin/pupbld.sql

5.删除数据库

SQL>startup database mount force restrict
SQL>drop database;
SQL>!rm –rf $ORACLE_HOME/*
rm –rf /etc/ora*
rm –rf  $ORACLE_BASE/flash_recovery_area
 
rm –rf  $ORACLE_BASE/admin
rm –rf  $ORACLE_BASE/oradata