http://docs.oracle.com/cd/E11882_01/server.112/e25494/create.htm#ADMIN11082 (Oracle官方安装帮助手册)
http://www.cnblogs.com/ylqmf/archive/2012/04/16/2451211.html (参考网站)
静默安装
为了学会手动建库和静默安装数据库..这三天我都没睡好呐.. 对linux不太了解..让我..
在安装包那块花费很多时间. 下面我将把我安装linux过程中遇到的问题记下供新手参考
下载linux oracle11gr2 64位
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
使用WinSCP将文件移到VM linux中(此处需要配置linux网络..不会的可以.下面列出我自己的配置)
DEVICE=eth0
IPADDR=192.168.1.91
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
HWADDR=00:0C:29:84:91:AA
TYPE=Ethernet
UUID=6600613f-7ead-4586-8fab-28e9e72b1f9b
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
DNS1=192.168.1.1
添加用户和用户组
# id oracle (确认oracle用户是否存在)
groupadd oinstall (建立产品清单管理组)
groupadd dba (建立数据库安装组)
groupadd asmadmin (建立ASM管理组)
groupadd asmdba (建立Grid管理组)
useradd -g oinstall -G dba,asmdba oracle
检查linux的软件包
# rpm -q \
binutils \
compat-libstdc++-33 \
elfutils-libelf \
elfutils-libelf-devel \
expat \
gcc \
gcc-c++ \
glibc \
glibc-common \
glibc-devel \
glibc-headers \
libaio \
libaio-devel \
libgcc \
libstdc++ \
libstdc++-devel \
make \
pdksh \
sysstat \
unixODBC \
unixODBC-devel | grep "not installed"
我检查自己的系统后发现有以下包未安装 (我的系统是Oracle Linux Server release 6.6) 可敲下列命令来查看: cat /etc/issue
compat-libstdc++-33 \--
elfutils-libelf-devel \--
gcc-c++ \--
libaio-devel \--
libstdc++-devel \--
pdksh \--
unixODBC \--
unixODBC-devel --
在配置yum源之前需挂载光盘. mount /dev/cdrom /mnt/cdrom
复制文件 cp -fr /mnt/cdrom /share
配置yum源 此处感谢帮忙配置 364363450
[HighAvailability]
name=HighAvailability
baseurl=file:///share/HighAvailability
enabled=1
gpgcheck=0
[ScalableFileSystem]
name=ScalableFileSystem
baseurl=file:///share/ScalableFileSystem
enabled=1
gpgcheck=0
[Server]
name=Server
baseurl=file:///share/Server
gpgcheck=0
enabled=1
[ResilientStorage]
name=ResilientStorage
baseurl=file:///share/ResilientStorage
gpgcheck=0
enabled=1
[UEK3]
name=UEK3
baseurl=file:///share/UEK3
gpgcheck=0
enabled=1
使用命令安装
yum install XXX 剩下的包
安装剩余的软件包
配置的yum中缺少一个包 pdksh
我下载的 pdksh-5.2.14-1.i386.rpm ,然后使用yum安装 yum installpdksh-5.2.14-1.i386.rpm
调整操作系统内核参数这个..我也不知道为什么
# vi /etc/sysctl.conf (增加或修改以下参数, 参考值为最小需求, kernel.shmmax默认即可无需设置 )
#------------------------------------------
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
#kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
#------------------------------------------
# /sbin/sysctl -p (设置参数立即生效)
增加shell限制.
# vi /etc/security/limits.conf (在文件最后增加或修改以下参数)
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
# vi /etc/pam.d/login (在文件最后增加或修改以下参数)
session required pam_limits.so
# vi /etc/profile (在文件最后增加或修改以下脚本)
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
建立必须的目录
mkdir -p /u01/app/oracle/
chown -R oracle:oinstall /u01 修改用户所有者 u01
chmod -R 775 /u01 授权文件.
设置Oracle用户环境变量.
# su - oracle
$ vi ~/.bash_profile
umask 022
export ORACLE_HOSTNAME=rhel5
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=ORCL
export PATH=.:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdk/bin:$PATH
export LC_ALL="en_US"
export LANG="en_US"
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
$ unzip linux*_11gR2_database_1of2.zip -d /u01 (解压到/u01目录下,可选目录)
$ unzip linux*_11gR2_database_2of2.zip -d /u01
$ cd /u01/database
$ export DISTRIB=`pwd`
生成响应文件模版
oracle.install.option=INSTALL_DB_SWONLY
DECLINE_SECURITY_UPDATES=true
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN,zh_TW
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=true
oracle.install.db.customComponents=oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.option=INSTALL_DB_SWONLY
DECLINE_SECURITY_UPDATES=true
oracle.install.db.config.starterdb.type=GENERAL_PURPOSEoracle.install.db.config.starterdb.memoryLimit=1024 .
DECLINE_SECURITY_UPDATES=true //设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。PS:不管地址对不对)
很重要.
各参数含义如下:
-silent 表示以静默方式安装,不会有任何提示
-force 允许安装到一个非空目录
-noconfig 表示不运行配置助手netca
-responseFile 表示使用哪个响应文件,必需使用绝对路径
oracle.install.responseFileVersion 响应文件模板的版本,该参数不要更改
oracle.install.option 安装选项,本例只安装oracle软件,该参数不要更改
DECLINE_SECURITY_UPDATES 是否需要在线安全更新,设置为false,该参数不要更改
ORACLE_HOSTNAME 安装主机名
UNIX_GROUP_NAME oracle用户用于安装软件的组名
INVENTORY_LOCATION oracle产品清单目录
SELECTED_LANGUAGES oracle运行语言环境,一般包括引文和简繁体中文
ORACLE_HOME Oracle安装目录
ORACLE_BASE oracle基础目录
oracle.install.db.InstallEdition 安装版本类型,一般是企业版
oracle.install.db.isCustomInstall 是否定制安装,默认Partitioning,OLAP,RAT都选上了
oracle.install.db.customComponents 定制安装组件列表:除了以上默认的,可加上Label Security和Database Vault
oracle.install.db.DBA_GROUP oracle用户用于授予OSDBA权限的组名
oracle.install.db.OPER_GROUP oracle用户用于授予OSOPER权限的组名
开始安装:./runInstaller -silent -force -noconfig -responseFile /u01/database//response/db_install.rsp (参数上面解释的很清楚,) on scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/u01/app/oracle/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/dbhome_1/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
4. Return to this window and hit "Enter" key to continue
Successfully Setup Software.
看到了这个界面就恭喜你了..安装没有问题.
./u01/app/oracle/oraInventory/orainstRoot.sh
./u01/app/oracle/product/11.2.0/dbhome_1/root.sh 运行脚本
配置监:听: 我好像没有成功过..
$ $ORACLE_HOME/bin/netca /silent /responsefile $DISTRIB/response/netca.rsp
$ ll $ORACLE_HOME/network/admin/*.ora
$ lsnrctl status
手工装库
vi /u01/database/response/dbca.rsp
#以下参数不要更改
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
#以下参数必须设置
[CREATEDATABASE]
GDBNAME = "ORCL.LK"
TEMPLATENAME = "General_Purpose.dbc"
#以下参数不设置则使用默认值,建议设置
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = "1024"
/u01/app/oracle/product/11.2.0/dbhome_1/bin/dbca -silent -responseFile /u01/database/response/dbca.rsp
Enter SYS user password:
<输入sys用户密码>
Enter SYSTEM user password:
<输入system用户密码>
Copying database files
...
37% complete
Creating and starting Oracle instance
...
62% complete
Completing Database Creation
...
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/ORCL1/ORCL1.log" for further details.各参数含义如下:
-silent 表示以静默方式安装
-responseFile 表示使用哪个响应文件,必需使用绝对路径
RESPONSEFILE_VERSION 响应文件模板的版本,该参数不要更改
OPERATION_TYPE 安装类型,该参数不要更改
GDBNAME 全局数据库名,点号前面默认是db_name,点号后面默认就是db_domain
TEMPLATENAME 建库模板名,参考各模板定义:$ORACLE_HOME/assistants/dbca/templates/*.dbc
CHARACTERSET 字符集,默认是WE8MSWIN1252
TOTALMEMORY 实例内存,默认是服务器物理内存的40%
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 16 11:11:46 2009
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
vi /u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl1.ora(编辑pfile启动到nomount状态)
内容:
CONTROL_FILES=(/u01/app/oracle/oradata/ORCL1/control01.ctl,
/u01/app/oracle/oradata/ORCL1/control02.ctl, /u01/app/oracle/oradata/ORCL1/control03.ctl)
DB_NAME=orcl
DB_RECOVERY_FILE_DEST=/u01/app/oracle/flash_recovery_area
DB_RECOVERY_FILE_DEST_SIZE=3852M
DB_UNIQUE_NAME=orcl
INSTANCE_NUMBER=0
LDAP_DIRECTORY_SYSAUTH=no
NLS_LANGUAGE=AMERICAN
NLS_TERRITORY=AMERICA
UNDO_TABLESPACE=UNDOTBS1
LOCAL_LISTENER='(ADDRESS_LIST= (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)))'
SQL> startup pfile='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl1.ora' nomount;
ORACLE instance started.
Total System Global Area 217157632 bytes
Fixed Size 2211928 bytes
Variable Size 159387560 bytes
Database Buffers 50331648 bytes
Redo Buffers 5226496 bytes
SQL> alter system register;(注册监听)
SQL> create spfile from memory (创建spfile)下次直接从spfile启动
vi /u01/app/oracle/createDB.sql 创建建库脚本
CREATE DATABASE orcl
USER SYS IDENTIFIED BY sys
USER SYSTEM IDENTIFIED BY system
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/ORCL1/redo01a.log','/u01/app/oracle/oradata/ORCL1/redo01b.log') SIZE 60M ,
GROUP 2 ('/u01/app/oracle/oradata/ORCL1/redo02a.log','/u01/app/oracle/oradata/ORCL1/redo02b.log') SIZE 60M ,
GROUP 3 ('/u01/app/oracle/oradata/ORCL1/redo03a.log','/u01/app/oracle/oradata/ORCL1/redo03b.log') SIZE 60M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u01/app/oracle/oradata/ORCL1/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/u01/app/oracle/oradata/ORCL1/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users DATAFILE '/u01/app/oracle/oradata/ORCL1/users01.dbf' SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE '/u01/app/oracle/oradata/ORCL1/temp01.dbf' SIZE 20M REUSE
UNDO TABLESPACE undotbs1 DATAFILE '/u01/app/oracle/oradata/ORCL1/undotbs01.dbf' SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
SQL> @/u01/app/oracle/createDB.sql 运行建库脚本 (注意.脚本路径一定要正确.
undo表空间名要跟pfile里面指定的undo表空间名相同)下面是名称不相同报的错
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-01501: CREATE DATABASE failed
ORA-01519: error while processing file '?/rdbms/admin/dtxnspc.bsq' near line 5
ORA-00604: error occurred at recursive SQL level 1
ORA-30012: undo tablespace 'UNDOTBS1' does not exist or of wrong type
Process ID: 1958
Session ID: 16 Serial number: 1
详解:http://blog.sina.com.cn/s/blog_62565190010170j8.html
跑脚本
sys用户跑 @?/rdbms/admin/catalog.sql @?/rdbms/admin/catproc.sql @?/rdbms/admin/utlrp.sql system用户跑
@?/sqlplus/admin/pupbld.sql
安装完以后.上下左右键和退格键
需要安装 rlwrap,, 但是 rlwrap需要两个软件包支持 : readline .. libtermcap-devel(如果需要知道这些软件包详细信息上百度)