在LINUX平臺上手動建立多個實例(oracle11g) html
http://blog.csdn.net/sunchenglu7/article/details/39676659node
=====================================================================linux
使用命令 yum install -y 'package name' 安裝所缺的程序包,pdksh包除外。注意:要用yum安裝32 bit的程序包,可先修改 vi /etc/yum.conf,添加一行:multilib_policy=all。oracle在檢查環境的時候會要求安裝i386,但CentOS 6.4光盤中32 bit的程序包都是i686,其實都同樣,忽略這個差別問題應該不大(見下邊的安裝部分)。c++
另外能夠找一張5.8的盤或老的盤掛載安裝,它是i386的sql
安裝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程序包下載到本地express
使用命令 rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm 進行安裝(注意:該程序包與ksh衝突,若是已經安裝ksh,建議使用命令 rpm -e ksh-* 卸載)windows
====================================================================centos
數據庫模板,內核已升級,ceph已掛載。只剩安裝db軟件與裝庫。bash
靜默安裝
oracle 11gR2 11.2.0.4
一、數據庫安裝環境準備
二、準備靜默安裝響應文件
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 路徑等信息。
三、執行靜默安裝操做
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';