在LINUX平台上手动创建多个实例(oracle11g)
http://blog.csdn.net/sunchenglu7/article/details/39676659
=====================================================================
使用命令 yum install -y 'package name' 安装所缺的程序包,pdksh包除外。注意:要用yum安装32 bit的程序包,可先修改 vi /etc/yum.conf,添加一行:multilib_policy=all。oracle在检查环境的时候会要求安装i386,但CentOS 6.4光盘中32 bit的程序包都是i686,其实都一样,忽略这个差异问题应该不大(见下边的安装部分)。
另外可以找一张5.8的盘或老的盘挂载安装,它是i386的
安装pdksh包(该程序包未被纳入CentOS的安装盘中):
使用命令:wget ftp://rpmfind.net/linux/centos/5.9/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_64.rpm 将pdksh程序包下载到本地
使用命令 rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm 进行安装(注意:该程序包与ksh冲突,如果已经安装ksh,建议使用命令 rpm -e ksh-* 卸载)
====================================================================
数据库模板,内核已升级,ceph已挂载。只剩安装db软件与装库。
静默安装
oracle 11gR2 11.2.0.4
1、数据库安装环境准备
2、准备静默安装响应文件
1)利用图形化界面生成rsp文件
运行到oracle 安装目录下
./runInstaller &
到最后快filish的时候点击 Save Response File 按钮制定db.rsp文件存放路径;最后cancel安装界面。
2)如果不能执行图形化界面录制,可以通过编辑现有的rsp文件
打开安装文件路径找到response文件夹里面的 db_install.rsp文件。
/home/oracle/database/response/db_install.rsp
根据文件提示修改相关内容,一般是安装组,ORACLE_HOME,ORACLE_BASE 路径等信息。
3、执行静默安装操作
1)开始静默安装
$ ./runInstaller -silent -noconfig -ignorePrereq -responseFile /home/oracle/db.rsp
2)查看安装过程
可以到/opt/app/oraInventory/logs 目录下查看安装进度。
tail -100f installActions2012-03-13_10-36-42AM.log
3)安装成功提示执行脚本
到最后提示:
/opt/app/oracle/oraInventory/orainstRoot.sh
/opt/app/oracle/product/11.2.0/db_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.
100G硬盘,swap16G,boot1G,剩下的是/。 安装完桌面与数据库软件后,共占用8.1G的磁盘空间(没有建库,即dbca)
数据库软件安装需要4.7G
[oracle@cu-dbs-152 ~]$ rm -rf database/
[oracle@cu-dbs-152 ~]$ rm -rf p13390677_112040_Linux-x86-64_*
[oracle@cu-dbs-152 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 83G 8.1G 71G 11% /
tmpfs 16G 228K 16G 1% /dev/shm
/dev/sda1 190M 74M 103M 42% /boot
192.168.7.4:6789,192.168.7.5:6789,192.168.7.6:6789:/
53T 980G 52T 2% /ceph
/dev/sr0 3.7G 3.7G 0 100% /media/CentOS_6.8_Final [oracle@cu-dbs-152 ~]$ free -m
total used free shared buffers cached
Mem: 32173 392 31781 1 22 156
-/+ buffers/cache: 214 31959
Swap: 16383 0 16383 建库,dbca安装之后的空间变化
[root@cu-dbs-152 datafile]# ll
total 1861264
-rw-r----- 1 oracle oinstall 629153792 Jul 3 18:19 o1_mf_sysaux_gkryhg0x_.dbf
-rw-r----- 1 oracle oinstall 734011392 Jul 3 18:19 o1_mf_system_gkryh9tw_.dbf
-rw-r----- 1 oracle oinstall 20979712 Jul 3 18:18 o1_mf_temp_gkryhnbj_.tmp
-rw-r----- 1 oracle oinstall 534781952 Jul 3 18:19 o1_mf_undotbs1_gkryhkj1_.dbf
-rw-r----- 1 oracle oinstall 5251072 Jul 3 18:19 o1_mf_users_gkryj37x_.dbf [root@cu-dbs-152 datafile]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 83G 11G 68G 14% /
tmpfs 28G 3.1G 25G 11% /dev/shm 安装完之后,占用11G空间.做好之后,做一个快照,再备份一下,以后拿来就用。
没有dbca,或者建库之前,就是下面的目录与文件结构,基本都是空的
三个目录,两个文件
[oracle@cu-dbs-152 app]$ cd oraInventory/
[oracle@cu-dbs-152 oraInventory]$ ls -R
.:
ContentsXML logs oraInst.loc orainstRoot.sh oui ./ContentsXML:
comps.xml inventory.xml libs.xml ./logs:
installActions2019-07-03_02-30-42PM.log oraInstall2019-07-03_02-30-42PM.err oraInstall2019-07-03_02-30-42PM.out ./oui:
srcs.lst
三个目录
[oracle@cu-dbs-152 app]$ cd oracle/
[oracle@cu-dbs-152 oracle]$ ll
total 12
drwxr-xr-x 2 oracle oinstall 4096 Jul 3 14:38 checkpoints
drwxrwxr-x 11 oracle oinstall 4096 Jul 3 14:37 diag
drwxr-xr-x 3 oracle oinstall 4096 Jul 3 14:34 product
都是空目录
[oracle@cu-dbs-152 oracle]$ cd diag/
[oracle@cu-dbs-152 diag]$ ls -R
.:
asm clients crs diagtool lsnrctl netcman ofm rdbms tnslsnr ./asm:
./clients:
./crs:
./diagtool:
./lsnrctl:
./netcman:
./ofm:
./rdbms:
./tnslsnr: cfgtoollogs目录下面的emca目录,在dbca建库时自动生成,一般将界面上的勾选去掉.
[root@cu-dbs-154 cfgtoollogs]# ll
total 8
drwxr-x--- 2 oracle oinstall 4096 Jul 4 10:02 dbca
drwxr-x--- 2 oracle oinstall 4096 Jul 4 10:02 emca
[root@cu-dbs-154 cfgtoollogs]# cd emca/
[root@cu-dbs-154 emca]# ls
emca_2019_07_04_10_02_20.log emca_2019_07_04_10_02_20.log.lck
[root@cu-dbs-154 emca]# ll
total 4
-rw-r----- 1 oracle oinstall 1464 Jul 4 10:02 emca_2019_07_04_10_02_20.log
-rw-r----- 1 oracle oinstall 0 Jul 4 10:02 emca_2019_07_04_10_02_20.log.lck
dbca建库开始
选择自定义库
选择omf
在8/12步,可以选择组件
只选jvm,xml db,application express三个组件,其它不选
在9/12步,初始化参数设置
1024*25=25600MB,也就是80%,使用AMM,automatic memory management,这个在之前/dev/shm已经设置为28g
pga+sga=25600MB,自动在pga与sga之间分配。
游标1000
做好之后,做一个快照,再备份一下,以后拿来就用。
cs6.8_x86-64系统装完之后,进入桌面,右键打开终端
先在本地配置静态ip
vi /etc/sysconfig/network-scripts/ifcfg-eth0
cat /etc/sysconfig/network-scripts/ifcfg-eth0
可以配置双ip,方便一些
[root@oracle-test network-scripts]# cat ifcfg-eth0
DEVICE=eth0
HWADDR=52:54:00:72:F3:48
TYPE=Ethernet
UUID=c00c2e33-5c52-484b-9a91-883bc86d5c81
ONBOOT=yes
#BOOTPROTO=static
BOOTPROTO=dhcp
#IPADDR=192.168.10.88
#PREFIX=24
#GATEWAY=192.168.10.6
#DNS1=8.8.8.8
[root@oracle-test network-scripts]# cat ifcfg-eth0:1
DEVICE=eth0:1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.10.88
PREFIX=24
GATEWAY=192.168.10.6
DNS1=8.8.8.8
service network restart
然后在windows上再通过ssh远程连接到目标主机上修改下面的
chkconfig iptables off
chkconfig ip6tables off
chkconfig NetworkManager off
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
echo "192.168.10.199:/home/kvm /mnt nfs defaults 0 0" >> /etc/fstab
echo "192.168.10.88 $HOSTNAME" >> /etc/hosts
vi /etc/ssh/sshd_config
service sshd restart
reboot
rpm -ivh http://mirror.symnds.com/distributions/CentOS-vault/5.8/os/x86_64/CentOS/pdksh-5.2.14-37.el5.x86_64.rpm
rpm -ivh Downloads/pdksh-5.2.14-21.x86_64.rpm
rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install gcc libaio-devel elfutils-libelf-devel gcc-c++ compat-libstdc++-33 rlwrap -y
cat <<EOF >> /etc/security/limits.conf
#for oracle
oracle soft nproc 2048
oracle hard nproc 16384
oracle soft nofile 2048
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
#for grid
grid soft nproc 2048
grid hard nproc 16384
grid soft nofile 2048
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768
EOF
编辑文件 vi /etc/pam.d/login,添加如下行(11gR1有要求,R2没有要求):
session required /lib64/security/pam_limits.so
session required pam_limits.so
编辑 vi /etc/profile 文件,添加如下行(11gR1有要求,R2没有要求):
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
下面两个参数默认是有的,在cs6.8desktop中,所以不需要设置了
kernel.shmall = 2097152
kernel.shmmax = 4294967295
cat <<EOF >> /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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 = 1048576
vm.swappiness=10
EOF
sysctl -p /etc/sysctl.conf
如果要使用amm特性,就要先将此设置大一些,32g物理内存,就将tmpfs设为28g,到时自动内存管理就不会报错。
vi /etc/fstab
tmpfs /dev/shm tmpfs size=28G 0 0
grid安装可能需要更多目录与用户
如果只使用oracle,不用grid,就直接跳过下面这部分
=============================
创建base,与oradata(即数据文件目录),二者最好在不同的磁盘上
mkdir -p /u01/app
chown -R oracle:oinstall /u01/app
chmod -R 775 /u01/app
创建需要的用户和用户组:
使用root用户执行:
/usr/sbin/groupadd -g 501 oinstall
/usr/sbin/groupadd -g 502 dba
/usr/sbin/groupadd -g 503 oper
/usr/sbin/groupadd -g 504 asmadmin
/usr/sbin/groupadd -g 505 asmoper
/usr/sbin/groupadd -g 506 asmdba
/usr/sbin/useradd -g oinstall -G dba,asmdba,oper oracle
/usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
grid home /u01/app/11.2.0.4/grid
cluster home /u01/app/grid
oracle base /u01/app/oracle
三个目录独立,不能重合
mkdir -p /u01/app/11.2.0.4/grid
mkdir -p /u01/app/grid
chown -R grid:oinstall /u01/app/11.2.0.4/grid
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/
=============================
只用oracle的话,就下面这个,不看上面
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
passwd oracle
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/
chmod -R 775 /u01/
vi /home/oracle/.bash_profile
先将path,与export path删除,再加入下面
umask 022
export ORACLE_SID=qdb
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/db_1/
export PATH=$PATH:$ORACLE_HOME/bin
alias sqlplus='rlwrap sqlplus'
alias lsnrctl='rlwrap lsnrctl'
alias rman='rlwrap rman'
========================================
clone出来的的机器要修改下面几个文件,然后reboot
vi /etc/sysconfig/network
vi /etc/udev/rules.d/70-persistent-net.rules
vi /etc/sysconfig/network-scripts/ifcfg-eth0
vi /etc/hosts
vi /etc/ssh/sshd_config
========================================
#第二阶段
用oracle用户登录,在putty中设置好x11,开启xming,
localhost:0.0
cp /mnt/iso/p13390677_112040_Linux-x86-64_[12]* ./
unzip p13390677_112040_Linux-x86-64_1of7.zip
unzip p13390677_112040_Linux-x86-64_2of7.zip
cd database
#两种模式,slient mode or response file mode,区别在于-slient参数
./runInstaller -silent -noconfig -ignorePrereq -responseFile /home/oracle/db.rsp
./runInstaller -noconfig -ignorePrereq -responseFile /home/oracle/db.rsp
tail -f /u01/app/oraInventory/logs/installActions2017-01-19_11-49-57AM.log
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0.4/db_1/root.sh
设置sqlplus环境变量
[oracle@db01 ~]$ cat /u01/app/oracle/product/11.2.0.4/db_1/sqlplus/admin/glogin.sql
set sqlprompt '_date _user@&_CONNECT_IDENTIFIER> '
set pagesize 400
set linesize 400
define _editor=vi
设置服务名,对外尽量不要用sid
alter system set service_names="kyc_n,kyc_w";
db.rsp文件,与上面的脚本是匹配的,要么是图形安装到最后取消得到rsp文件,要么直接在/home/oracle/database/response/db_install.rsp路径下找这个文件进行修改得到rsp文件.
####################################################################
## Copyright(c) Oracle Corporation 1998, 2013. All rights reserved.##
## ##
## Specify values for the variables listed below to customize ##
## your installation. ##
## ##
## Each variable is associated with a comment. The comment ##
## can help to populate the variables with the appropriate ##
## values. ##
## ##
## IMPORTANT NOTE: This file contains plain text passwords and ##
## should be secured to have read permission only by oracle user ##
## or db administrator who owns this installation. ##
## ##
#################################################################### #-------------------------------------------------------------------------------
# Do not change the following system generated value.
#-------------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0 #-------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
# - INSTALL_DB_SWONLY
# - INSTALL_DB_AND_CONFIG
# - UPGRADE_DB
#-------------------------------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY #-------------------------------------------------------------------------------
# Specify the hostname of the system as set during the install. It can be used
# to force the installation to use an alternative hostname rather than using the
# first hostname found on the system. (e.g., for systems with multiple hostnames
# and network interfaces)
#-------------------------------------------------------------------------------
ORACLE_HOSTNAME=oracle-test #-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=oinstall #-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
# This is an optional parameter if installing on
# Windows based Operating System.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=/u01/app/oraInventory
#-------------------------------------------------------------------------------
# Specify the languages in which the components will be installed.
#
# en : English ja : Japanese
# fr : French ko : Korean
# ar : Arabic es : Latin American Spanish
# bn : Bengali lv : Latvian
# pt_BR: Brazilian Portuguese lt : Lithuanian
# bg : Bulgarian ms : Malay
# fr_CA: Canadian French es_MX: Mexican Spanish
# ca : Catalan no : Norwegian
# hr : Croatian pl : Polish
# cs : Czech pt : Portuguese
# da : Danish ro : Romanian
# nl : Dutch ru : Russian
# ar_EG: Egyptian zh_CN: Simplified Chinese
# en_GB: English (Great Britain) sk : Slovak
# et : Estonian sl : Slovenian
# fi : Finnish es_ES: Spanish
# de : German sv : Swedish
# el : Greek th : Thai
# iw : Hebrew zh_TW: Traditional Chinese
# hu : Hungarian tr : Turkish
# is : Icelandic uk : Ukrainian
# in : Indonesian vi : Vietnamese
# it : Italian
#
# all_langs : All languages
#
# Specify value as the following to select any of the languages.
# Example : SELECTED_LANGUAGES=en,fr,ja
#
# Specify value as the following to select all the languages.
# Example : SELECTED_LANGUAGES=all_langs
#-------------------------------------------------------------------------------
SELECTED_LANGUAGES=en,zh_CN #-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#-------------------------------------------------------------------------------
ORACLE_HOME=/u01/app/oracle/product/11.2/db_1/ #-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base.
#-------------------------------------------------------------------------------
ORACLE_BASE=/u01/app/oracle #-------------------------------------------------------------------------------
# Specify the installation edition of the component.
#
# The value should contain only one of these choices.
# - EE : Enterprise Edition
# - SE : Standard Edition
# - SEONE : Standard Edition One
# - PE : Personal Edition (WINDOWS ONLY)
#-------------------------------------------------------------------------------
oracle.install.db.InstallEdition=EE #-------------------------------------------------------------------------------
# This variable is used to enable or disable custom install and is considered
# only if InstallEdition is EE.
#
# - true : Components mentioned as part of 'optionalComponents' property
# are considered for install.
# - false : Value for 'optionalComponents' is not considered.
#-------------------------------------------------------------------------------
oracle.install.db.EEOptionsSelection=false #-------------------------------------------------------------------------------
# This property is considered only if 'EEOptionsSelection' is set to true
#
# Description: List of Enterprise Edition Options you would like to enable.
#
# The following choices are available. You may specify any
# combination of these choices. The components you choose should
# be specified in the form "internal-component-name:version"
# Below is a list of components you may specify to enable.
#
# oracle.oraolap:11.2.0.4.0 - Oracle OLAP
# oracle.rdbms.dm:11.2.0.4.0 - Oracle Data Mining RDBMS Files
# oracle.rdbms.dv:11.2.0.4.0- Oracle Database Vault option
# oracle.rdbms.lbac:11.2.0.4.0 - Oracle Label Security
# oracle.rdbms.partitioning:11.2.0.4.0 - Oracle Partitioning
# oracle.rdbms.rat:11.2.0.4.0 - Oracle Real Application Testing
#-------------------------------------------------------------------------------
oracle.install.db.optionalComponents= ###############################################################################
# #
# PRIVILEGED OPERATING SYSTEM GROUPS #
# ------------------------------------------ #
# Provide values for the OS groups to which OSDBA and OSOPER privileges #
# needs to be granted. If the install is being performed as a member of the #
# group "dba", then that will be used unless specified otherwise below. #
# #
# The value to be specified for OSDBA and OSOPER group is only for UNIX based #
# Operating System. #
# #
############################################################################### #------------------------------------------------------------------------------
# The DBA_GROUP is the OS group which is to be granted OSDBA privileges.
#-------------------------------------------------------------------------------
oracle.install.db.DBA_GROUP=dba #------------------------------------------------------------------------------
# The OPER_GROUP is the OS group which is to be granted OSOPER privileges.
# The value to be specified for OSOPER group is optional.
#------------------------------------------------------------------------------
oracle.install.db.OPER_GROUP=oper #-------------------------------------------------------------------------------
# Specify the cluster node names selected during the installation.
# Example : oracle.install.db.CLUSTER_NODES=node1,node2
#-------------------------------------------------------------------------------
oracle.install.db.CLUSTER_NODES= #------------------------------------------------------------------------------
# This variable is used to enable or disable RAC One Node install.
#
# - true : Value of RAC One Node service name is used.
# - false : Value of RAC One Node service name is not used.
#
# If left blank, it will be assumed to be false.
#------------------------------------------------------------------------------
oracle.install.db.isRACOneInstall=false #------------------------------------------------------------------------------
# Specify the name for RAC One Node Service.
#------------------------------------------------------------------------------
oracle.install.db.racOneServiceName= #-------------------------------------------------------------------------------
# Specify the type of database to create.
# It can be one of the following:
# - GENERAL_PURPOSE/TRANSACTION_PROCESSING
# - DATA_WAREHOUSE
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE #-------------------------------------------------------------------------------
# Specify the Starter Database Global Database Name.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.globalDBName= #-------------------------------------------------------------------------------
# Specify the Starter Database SID.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.SID= #-------------------------------------------------------------------------------
# Specify the Starter Database character set.
#
# One of the following
# AL32UTF8, WE8ISO8859P15, WE8MSWIN1252, EE8ISO8859P2,
# EE8MSWIN1250, NE8ISO8859P10, NEE8ISO8859P4, BLT8MSWIN1257,
# BLT8ISO8859P13, CL8ISO8859P5, CL8MSWIN1251, AR8ISO8859P6,
# AR8MSWIN1256, EL8ISO8859P7, EL8MSWIN1253, IW8ISO8859P8,
# IW8MSWIN1255, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE,
# KO16MSWIN949, ZHS16GBK, TH8TISASCII, ZHT32EUC, ZHT16MSWIN950,
# ZHT16HKSCS, WE8ISO8859P9, TR8MSWIN1254, VN8MSWIN1258
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.characterSet= #------------------------------------------------------------------------------
# This variable should be set to true if Automatic Memory Management
# in Database is desired.
# If Automatic Memory Management is not desired, and memory allocation
# is to be done manually, then set it to false.
#------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryOption=false #-------------------------------------------------------------------------------
# Specify the total memory allocation for the database. Value(in MB) should be
# at least 256 MB, and should not exceed the total physical memory available
# on the system.
# Example: oracle.install.db.config.starterdb.memoryLimit=512
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.memoryLimit= #-------------------------------------------------------------------------------
# This variable controls whether to load Example Schemas onto
# the starter database or not.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.installExampleSchemas=false #-------------------------------------------------------------------------------
# This variable includes enabling audit settings, configuring password profiles
# and revoking some grants to public. These settings are provided by default.
# These settings may also be disabled.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.enableSecuritySettings=true ###############################################################################
# #
# Passwords can be supplied for the following four schemas in the #
# starter database: #
# SYS #
# SYSTEM #
# SYSMAN (used by Enterprise Manager) #
# DBSNMP (used by Enterprise Manager) #
# #
# Same password can be used for all accounts (not recommended) #
# or different passwords for each account can be provided (recommended) #
# #
############################################################################### #------------------------------------------------------------------------------
# This variable holds the password that is to be used for all schemas in the
# starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.ALL= #-------------------------------------------------------------------------------
# Specify the SYS password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYS= #-------------------------------------------------------------------------------
# Specify the SYSTEM password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYSTEM= #-------------------------------------------------------------------------------
# Specify the SYSMAN password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.SYSMAN= #-------------------------------------------------------------------------------
# Specify the DBSNMP password for the starter database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.DBSNMP= #-------------------------------------------------------------------------------
# Specify the management option to be selected for the starter database.
# It can be one of the following:
# - GRID_CONTROL
# - DB_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.control=DB_CONTROL #-------------------------------------------------------------------------------
# Specify the Management Service to use if Grid Control is selected to manage
# the database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.gridcontrol.gridControlServiceURL= ###############################################################################
# #
# SPECIFY BACKUP AND RECOVERY OPTIONS #
# ------------------------------------ #
# Out-of-box backup and recovery options for the database can be mentioned #
# using the entries below. #
# #
############################################################################### #------------------------------------------------------------------------------
# This variable is to be set to false if automated backup is not required. Else
# this can be set to true.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.automatedBackup.enable=false #------------------------------------------------------------------------------
# Regardless of the type of storage that is chosen for backup and recovery, if
# automated backups are enabled, a job will be scheduled to run daily to backup
# the database. This job will run as the operating system user that is
# specified in this variable.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.automatedBackup.osuid= #-------------------------------------------------------------------------------
# Regardless of the type of storage that is chosen for backup and recovery, if
# automated backups are enabled, a job will be scheduled to run daily to backup
# the database. This job will run as the operating system user specified by the
# above entry. The following entry stores the password for the above operating
# system user.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.automatedBackup.ospwd= #-------------------------------------------------------------------------------
# Specify the type of storage to use for the database.
# It can be one of the following:
# - FILE_SYSTEM_STORAGE
# - ASM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.storageType= #-------------------------------------------------------------------------------
# Specify the database file location which is a directory for datafiles, control
# files, redo logs.
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation= #-------------------------------------------------------------------------------
# Specify the backup and recovery location.
#
# Applicable only when oracle.install.db.config.starterdb.storage=FILE_SYSTEM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation= #-------------------------------------------------------------------------------
# Specify the existing ASM disk groups to be used for storage.
#
# Applicable only when oracle.install.db.config.starterdb.storageType=ASM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.diskGroup= #-------------------------------------------------------------------------------
# Specify the password for ASMSNMP user of the ASM instance.
#
# Applicable only when oracle.install.db.config.starterdb.storage=ASM_STORAGE
#-------------------------------------------------------------------------------
oracle.install.db.config.asm.ASMSNMPPassword= #------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username.
#
# Example : MYORACLESUPPORT_USERNAME=abc@oracle.com
#------------------------------------------------------------------------------
MYORACLESUPPORT_USERNAME= #------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username password.
#
# Example : MYORACLESUPPORT_PASSWORD=password
#------------------------------------------------------------------------------
MYORACLESUPPORT_PASSWORD= #------------------------------------------------------------------------------
# Specify whether to enable the user to set the password for
# My Oracle Support credentials. The value can be either true or false.
# If left blank it will be assumed to be false.
#
# Example : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true
#------------------------------------------------------------------------------
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false #------------------------------------------------------------------------------
# Specify whether user doesn't want to configure Security Updates.
# The value for this variable should be true if you don't want to configure
# Security Updates, false otherwise.
#
# The value can be either true or false. If left blank it will be assumed
# to be false.
#
# Example : DECLINE_SECURITY_UPDATES=false
#------------------------------------------------------------------------------
DECLINE_SECURITY_UPDATES=true #------------------------------------------------------------------------------
# Specify the Proxy server name. Length should be greater than zero.
#
# Example : PROXY_HOST=proxy.domain.com
#------------------------------------------------------------------------------
PROXY_HOST= #------------------------------------------------------------------------------
# Specify the proxy port number. Should be Numeric and at least 2 chars.
#
# Example : PROXY_PORT=25
#------------------------------------------------------------------------------
PROXY_PORT= #------------------------------------------------------------------------------
# Specify the proxy user name. Leave PROXY_USER and PROXY_PWD
# blank if your proxy server requires no authentication.
#
# Example : PROXY_USER=username
#------------------------------------------------------------------------------
PROXY_USER= #------------------------------------------------------------------------------
# Specify the proxy password. Leave PROXY_USER and PROXY_PWD
# blank if your proxy server requires no authentication.
#
# Example : PROXY_PWD=password
#------------------------------------------------------------------------------
PROXY_PWD= #------------------------------------------------------------------------------
# Specify the proxy realm.
#
# Example : PROXY_REALM=metalink
#------------------------------------------------------------------------------
PROXY_REALM=
#------------------------------------------------------------------------------
# Specify the Oracle Support Hub URL.
#
# Example : COLLECTOR_SUPPORTHUB_URL=https://orasupporthub.company.com:8080/
#------------------------------------------------------------------------------
COLLECTOR_SUPPORTHUB_URL= #------------------------------------------------------------------------------
# Specify the auto-updates option. It can be one of the following:
# - MYORACLESUPPORT_DOWNLOAD
# - OFFLINE_UPDATES
# - SKIP_UPDATES
#------------------------------------------------------------------------------
oracle.installer.autoupdates.option=SKIP_UPDATES
#------------------------------------------------------------------------------
# In case MYORACLESUPPORT_DOWNLOAD option is chosen, specify the location where
# the updates are to be downloaded.
# In case OFFLINE_UPDATES option is chosen, specify the location where the updates
# are present.
#------------------------------------------------------------------------------
oracle.installer.autoupdates.downloadUpdatesLoc=
#------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username which has the patches download privileges
# to be used for software updates.
# Example : AUTOUPDATES_MYORACLESUPPORT_USERNAME=abc@oracle.com
#------------------------------------------------------------------------------
AUTOUPDATES_MYORACLESUPPORT_USERNAME= #------------------------------------------------------------------------------
# Specify the My Oracle Support Account Username password which has the patches download privileges
# to be used for software updates.
#
# Example : AUTOUPDATES_MYORACLESUPPORT_PASSWORD=password
#------------------------------------------------------------------------------
AUTOUPDATES_MYORACLESUPPORT_PASSWORD=
=========================================================================
桌面安装
http://www.linuxidc.com/Linux/2012-12/76584p2.htm
http://www.linuxidc.com/Linux/2013-10/91270.htm
http://www.cnblogs.com/mophee/archive/2013/06/01/3107137.html
http://www.bitscn.com/pdb/oracle/201404/195426.html
=======================================================================================================
手动命令行建库的步骤
1.创建口令文件
2.创建参数文件
3.创建所需目录结构
4.设置环境变量
5.手动建库脚本
vi createdb.sql create database lcp
USER SYS IDENTIFIED BY sys
USER SYSTEM IDENTIFIED BY manager
maxlogfiles 5
maxlogmembers 5
maxdatafiles 100
maxinstances 1
MAXLOGHISTORY 1
logfile
group 1 ('/u01/app/lcp/oradata/redo1.log') size 10m,
group 2 ('/u01/app/lcp/oradata/redo2.log') size 10m,
group 3 ('/u01/app/lcp/oradata/redo3.log') size 10m
datafile '/u01/app/lcp//oradata/system01.dbf' size 200m reuse
sysaux datafile '/u01/app/lcp/oradata/sysaux01.dbf' size 100m reuse
default tablespace users
datafile '/u01/app/lcp/oradata/users01.dbf' size 100m REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
undo tablespace undotbs1
datafile '/u01/app/lcp/oradata/undo01.dbf' size 100m REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
default temporary tablespace temp
tempfile '/u01/app/lcp/oradata/temp01.dbf' size 100m reuse
character set al32utf8
NATIONAL CHARACTER SET UTF8; !!!!!!!!!
1.'default tablespace user',bunengshi user keyword,bianchen users
2.'undo tablespace undo',yidingyaoshi undotbs1 SQL> @/home/oracle/createdb.sql
create database lcp
*
ERROR at line 1:
ORA-01501: CREATE DATABASE failed
ORA-00200: control file could not be created
ORA-00202: control file: '/u01/app/lcp/oradata/control01.ctl'
ORA-27038: created file already exists
Additional information: 1 !!!!!!!
delete all files from /u01/app/lcp/oradata/ directory,do it agian. SQL> @/home/oracle/createdb.sql
create database lcp
*
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: 11148
Session ID: 191 Serial number: 1 SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@storacle dbs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Wed Oct 26 23:21:04 2016 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount
ORACLE instance started. Total System Global Area 4275781632 bytes
Fixed Size 2260088 bytes
Variable Size 2365588360 bytes
Database Buffers 1895825408 bytes
Redo Buffers 12107776 bytes
SQL> @/home/oracle/createdb.sql Database created.
[oracle@localhost oracle]$ orapwd file=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwfgy1 password=123456
[oracle@localhost oracle]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.1.0 Production on Mon Jul 20 15:50:36 2015 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount pfile=/u01/app/oracle/admin/fgy1/pfile/init.ora
ORACLE instance started. Total System Global Area 283930624 bytes
Fixed Size 2212656 bytes
Variable Size 109055184 bytes
Database Buffers 167772160 bytes
Redo Buffers 4890624 bytes
SQL> create database fgy1
2 datafile '/u01/app/oracle/oradata/fgy1/system01.dbf' size 300M reuse autoextend on next 10240K
3 maxsize unlimited extent management local
4 sysaux
5 datafile '/u01/app/oracle/oradata/fgy1/sysaux01.dbf' size 120M reuse autoextend on next 10240K
6 maxsize unlimited
7 smallfile default temporary tablespace
8 temp
9 tempfile '/u01/app/oracle/oradata/fgy1/temp01.dbf' size 20M reuse autoextend on next 640K maxsize unlimited
10 smallfile undo tablespace "UNDOTBS1"
11 datafile '/u01/app/oracle/oradata/fgy1/undotbs01.dbf' size 200M reuse autoextend on next 5120K maxsize unlimited
12 character set zhs16gbk
13 national character set al16utf16
14 logfile group 1 ('/u01/app/oracle/oradata/fgy1/redo01.log') size 51200K,
15 group 2 ('/u01/app/oracle/oradata/fgy1/redo02.log') size 51200K,
16 group 3 ('/u01/app/oracle/oradata/fgy1/redo03.log') size 51200K
17 user sys identified by 123456
18 user system identified by 123456; Database created. 针对应用创建所需要的表空间,这里创建表空间users,
SQL> create smallfile tablespace users logging
2 datafile '/u01/app/oracle/oradata/fgy1/users01.dbf' size 5M reuse autoextend on next 1280K maxsize unlimited
3 extent management local
4 segment space management auto; Tablespace created.
并设置为数据库默认表空间
SQL> alter database default tablespace users; Database altered. SQL> create user fgy1 identified by 123456 default tablespace users; User created. SQL> grant dba to fgy1; Grant succeeded. 安装数据字典视图
SQL> @/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catalog.sql;
SQL> @/u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin/catproc.sql;
以system 用户登录,创建pl/sql资源集
SQL> connect system/123456
SQL> @/u01/app/oracle/product/11.2.0/dbhome_1/sqlplus/admin/pupbld.sql;
SQL> connect system/123456
SQL> @/u01/app/oracle/product/11.2.0/dbhome_1/sqlplus/admin/help/hlpbld.sql helpus.sql; 此时在toad中以fgy1用户便可以登录,没有创建数据字典之前,不可登录。
17:26:26 12 ~:#sqlplus fgy1/123456@fgy1
总共有两条连接,一个是toad,一个是sqlplus
oracle 2454 1 0 17:26 ? 00:00:00 oraclefgy1 (LOCAL=NO)
oracle 2419 1 0 17:12 ? 00:00:01 oraclefgy1 (LOCAL=NO) netstat -natp
tcp 0 0 ::ffff:192.168.1.70:1521 ::ffff:192.168.1.88:55289 ESTABLISHED
tcp 0 0 ::ffff:192.168.1.70:1521 ::ffff:172.16.1.44:54267 ESTABLISHED
tcp 0 0 ::ffff:127.0.0.1:1521 ::ffff:127.0.0.1:20814 ESTABLISHED
tcp 0 0 127.0.0.1:20814 127.0.0.1:1521 ESTABLISHED [oracle@localhost fgy1]$ ss -np
State Recv-Q Send-Q Local Address:Port Peer Address:Port
ESTAB 0 0 127.0.0.1:20814 127.0.0.1:1521 users:(("oracle",2100,20))
ESTAB 0 0 ::ffff:192.168.1.70:1521 ::ffff:192.168.1.88:55289 users:(("oracle",2419,14))
ESTAB 0 0 192.168.1.70:22 172.16.1.44:47037
ESTAB 0 0 ::ffff:192.168.1.70:1521 ::ffff:172.16.1.44:54267 users:(("oracle",2454,14))
ESTAB 0 0 ::ffff:127.0.0.1:1521 ::ffff:127.0.0.1:20814 users:(("tnslsnr",2290,13))
精简的手工建库过程,密码文件的作用是远程连接使用,如果没有,就不能连接数据库。
vi initbb.ora
db_name='bb'
db_create_file_dest='/u01/app/oracle/oradata/'
db_recovery_file_dest='/u01/app/oracle/fast_recovery_area/'
db_recovery_fiel_dest_size=4096M
orapwd file=orapwbb vi newdb.sql
create database bb
user sys identified by 123456
user system identified by 123456
character set zhs16gbk
national character set al16utf16
extent management local
undo tablespace undotbs
default tablespace deftbs
default temporary tablespace temptbs
archivelog sqlplus / as sysdba
startup nomount
@newdb.sql
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql
conn system
@?/sqlplus/admin/pupbld.sql
@?/sqlplus/admin/help/hlpbld.sql helpus.sql 针对管理创建所需要的用户并授予相应的权限
create user fgy1 identified by 123456;
grant sysdba to fgy1;
select * from v$pwfile_users;
create user fgy2 identified by 123456;
grant dba to fgy2;
select * from v$pwfile_users; select * from v$database;
select * from v$instance;
select * from v$logfile;
select * from v$datafile;
select * from v$pwfile_users;
select * from dba_users;
select * from v$tablespace; 针对应用创建所需要的表空间,这里创建表空间monitor
create tablespace monitor logging
extent management local
segment space management auto;
create user monitor identified by 123456 default tablespace monitor;
grant connect,resource to monitor; select * from dba_directories;
create directory aa as '/home/oracle';
grant read,write on directory aa to monitor;
create database 语句解释说明
create database /*lcp是数据库的名字,必须匹配初始化参数的db_name参数。最多8个字节长,仅包含ascii字符。
oracle写这个名字到控制文件中,如果后续提交alter database语句,它显示地规定了一个库名,
那么数据库校验那个名字与控制文件中的名字
库名大小写不敏感,被存储为大写的ascii字符。
如果没有这个库名,那么oracle使用db_name中的名字,db_name必须被设置,
如果你指定了不同于参数值db_name的名字,数据库返回错误。
也就是说,要么这里不指定,要么指定与参数一样的名字。*/ lcp /*为两个用户建立密码,不是强制的。但是如果指定一个,就必须指定另外一个,也就是说要么都出现,
要么都不出现。
如果不指定,那么oracle创建默认的密码,后续可以通过alter user来更改密码,也可以使用alter user
在数据库创建之后来添加密码管理属性。*/
user sys identified by 123456
user system identified by 123456
/*重用由初始化参数control_files标识的已存在的控制文件,覆盖内容。使用这个子句仅当重创数据库时,
而不是首次建库时用到。当首次建库时,oracle在默认目的创建一个控制文件,依赖于值或一些初始化参数
参见create controlfile。
如果你错过这个子句并且由control_files规定的任意文件已经存在,那么数据库返回一个错误。*/
controlfile reuse
/*规定控制文件的数据文件部分的初始大小,添加一个文件(它的号大于maxdatafiles但小于等于db_files)
的尝试,引起控制文件自动扩展以便数据文件部分能容纳更多的文件。
实例可访问的data files的数量也被db_files参数限制。*/
maxdatafiles
/*规定了数据库同时挂载和打开的最大数量的实例,这个值优先于参数instances,最小值是1,最大值是1055,
默认依赖于操作系统。*/
maxinstances
/*规定了数据库用来存储数据的字符集。支持的字符集和这个参数的默认值依赖于操作系统。不能指定al16utf16*/
character set al32utf8
/*规定了nchar,nclob,nvarchar2类型的数据,有效值是al16utf16和utf8,默认是al16utf16。*/
national character set al16utf16
/*使用这个子句决定了后续创建表空间和system,sysaux表空间的默认类型。要么bigfile,要么smallfile。
bigfile tablespace只包含一个数据文件或临时文件...
smallfile tablespace
如果没有这个子句,默认创建smallfile tablespace*/
set default smallfile tablespace --database_logging_clauses 决定oracle如何处理redo log files
/*
logfile
group 1
group 2
group 3
maxlogfiles
maxlogmembers
maxloghistory
archivelog
/*使用这个子句将database放入froce logging 模式。将会记录在数据库中的所有更改,除了在临时表空间和临时
segment中的更改。这个设置优先并独立于任何nologging或独立表空间的force logging设置和独立数据库对象
的nologging设置。重启关闭数据库都不影响这个模式,除非重创控制文件。
force logging --tablespace_clauses 配置system和sysaux表空间,和规定默认临时表空间和undo表空间。 /*这个子句创建一个locally managed system表空间,如果没有这个,system将使用dictionary managed。
如果你指定了这个子句,那么数据库必须有一个默认的临时表空间,因为locally managed system表空间
不能存储临时segment。
还有两条规则。
extent management local /*
指定一个或多个文件用于数据文件,所有这些文件成为system表空间的一部分
这个子句是可选的
如果你运行数据库在自动undo模式,并且为system表空间指定了一个数据文件名,那么数据库希望为所有的
表空间生成数据文件。
oracle自动这样做,如果你使用OMF的话,通过设置db_create_file_dest参数来启用OMF。
如果没有使用OMF,并且规定了这个子句,那么你必须也指定undo_tablespace和default_temp_tablespace这两个子句。
如果果没有这个子句
1并且启用了OMF,那么oracle创建一个100M的OMF文件
2没有启用OMF,那么oracle创建一个数据文件,它的名字与大小依赖于os。
*/
datafile 文件规范 /*
oracle创建system和sysaux两个表空间作为每一个数据库的一部分
如果你没有使用OMF并且想要为sysaux表空间创建一个或多个data files的话,使用这个子句。
如果你为system 表空间使用datafile子句规定了一个或多个数据文件的话,你必须使用这个子句。
如果你使用了OMF并且没有这个子句,那么在建立OMF的默认位置创建sysaux数据文件。
如果你启用了OMF并且没有这个子句,那么数据库创建sysaux表空间为online,permanent,locally managed
的带有一个100M大小的data file,并且还是logging enabled,automatic segment-space management。
*/
sysaux datafile 文件规范 /* default_tablespace
default_temp_tablespace
undo_tablespace 三个表空间子句*/ /*oracle创建一个smallfile表空间
datafile子句和extent_management_clause有相同的语义和create tablespace语句。
如果没有指定这个子句,那么system表空间是默认的永久表空间,为non-system用户。
*/
default tablespace aa
/*如果没有指定临时表空间,并且也没有自动创建temp,那么system成为临时表空间。
如果通过设置db_creat_file_dest参数已经启用了OMF的话,这个子句的tempfile子句是可选的。
如果db_create_file_dest没有设置,那么tempfile子句是必须的。
在一些操作系统上,oracle不为temp file分配空间,直到temp file block被真实访问,这样可以更快的创建。
*/
default temporary tablespace bb
/*如果你打开实例在auto undo mode(undo_management=auto,这是默认,所以可以不用指定)下
那么你可以指定一个表空间来为undo data使用。oracle强烈推荐使用自动undo mode
如果你设置了一个undo_tablespace参数值,那么这个子句可以没有
如果参数值与子句都设置了,那么表空间名必须相同。否则open数据库时会返回一个错误。
如果通过设置db_creat_file_dest参数已经启用了OMF的话,这个子句的datafile子句是可选的。
如果db_create_file_dest没有设置,那么datafile子句是必须的。*/
undo tablespace cc
--time zone
/*使用这个子句设置数据库的时区,你可以以两种方式规定时区
1规定一个偏移根据utc,有效范围是-12:00 to +14:00
2规定一个时区,要查看一个有效的时区名列表,查询v$timezone_names的tzname.
oracle推荐设置0:00,这样可以改进性能,因为没有时间转换发生
oracle规范化所有 timestamp with local time zone(这是一个datetime数据类型)数据到数据库的时区,当数据被存在磁盘上时。
如果不规定set time_zone子句,那么数据库使用server上的os time zone。
如果os time zone不是一个有效的db time zone,那么db time zone默认为utc。*/
set time_zone='0:00';