靜默安裝Oracle資料庫11g
需求:靜默安裝Oracle資料庫11g
作業系統:centos 7
【0】配置yum源(若有yum源也可以不用配置本地)
【0】修改主機名和/etc/hosts
【1】防火牆配置
【2】Selinux配置
【3】修改/etc/sysctl.conf
【4】修改/etc/security/limits.conf
【5】修改/etc/profile
【6】建立使用者
【7】建立目錄
【8】修改oracle使用者環境變數
【9】安裝以下依賴包
【10】上傳軟體並且解壓縮
【11】修改 oraInst.loc 檔案
【12】配置應答檔案
【13】安裝 Oracle 程式
【14】執行安裝過程中的 root.sh 指令碼
【15】解除安裝Oracle
【0】配置yum源(若有yum源也可以不用配置本地)
cd /etc/yum.repos.d/
vi rhel.repo
[rhel]
name=rhel
baseurl=file:///mnt
enabled=1
gpgcheck=0
掛載光碟
mount /dev/sr0 /mnt/]()
mount: block device /dev/sr0 is write-protected, mounting read-only
設定開機自動掛載系統映象檔案
/etc/fstab新增以下內容:
[root@localhost ~]# vi /etc/fstab
/dev/sr0 /mnt iso9660 defaults,ro,loop 0 0
【0】修改主機名和/etc/hosts
[root@localhost ~]# vi /etc/sysconfig/network
HOSTNAME=ORA11
[root@localhost ~]# vi /etc/hosts
192.168.172.159 ORA11
【1】防火牆配置
作業系統:
檢視防火牆狀態
systemctl status firewalld
關閉防火牆
systemctl stop firewalld
永久禁用防火牆(開機不會啟動)
systemctl disable firewalld
【2】Selinux配置
關閉selinux
vi /etc/sysconfig/selinux
把 SELINUX=enforcing 改為 SELINUX=disabled
重啟服務reboot(臨時可以使用:setenforce 0),建議重啟
【3】修改/etc/sysctl.conf
vi /etc/sysctl.conf
# Oracle install config
fs.aio-max-nr = 3145728
fs.file-max = 6815744
kernel.shmall = 1073741824
kernel.shmmax = 370853791744
kernel.shmmni = 4096
kernel.sem = 250 32000 100 200
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
使生效:
sysctl -p
【4】修改/etc/security/limits.conf
vi /etc/security/limits.conf
#SETTING for ORACLE
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 4096
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
【5】修改/etc/profile
vi /etc/profile
if [ $USER = "oracle" ] || [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -u 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
【6】建立使用者
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
useradd -g oinstall -G dba,oper -u 1101 oracle
修改密碼
passwd oracle
【7】建立目錄
mkdir -p /u01/app/oracle/product/11.2.0/dbhome_1
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01
chmod 775 /u01/
chmod 775 /u01/app
【8】修改oracle使用者環境變數:
su - oracle
vi .bash_profile
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=test
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
source .bash_profile
【9】安裝以下依賴包:
yum install -y e2fsprogs-libs
yum install -y glibc
yum install -y glibc.i686
yum install -y glibc-devel
yum install -y glibc-devel.i686
yum install -y ksh
yum install -y libgcc
yum install -y libgcc.i686
yum install -y libstdc++
yum install -y libstdc++.i686
yum install -y libstdc++-devel
yum install -y libstdc++-devel.i686
yum install -y libaio
yum install -y libaio.i686
yum install -y libaio-devel
yum install -y libaio-devel.i686
yum install -y libXtst
yum install -y libXtst.i686
yum install -y libX11
yum install -y libX11.i686
yum install -y libXau
yum install -y libXau.i686
yum install -y libxcb
yum install -y libxcb.i686
yum install -y libXi
yum install -y libXi.i686
yum install -y net-tools
yum install -y nfs-utils
yum install -y sysstat
yum install -y smartmontools
yum install -y unixODBC
yum install -y unixODBC-devel
yum install -y make
yum -y install compat-libstdc*
yum -y install nfs-utils
yum -y install elfutils-libelf-devel*
yum install -y smartmontools
yum -y install gnome*
yum -y install compat*
yum -y install gcc*
【10】上傳軟體並且解壓縮
[root@localhost ~]# mv p13390677_112040_Linux-x86-64_* /home/oracle/
[root@localhost ~]# chown -R oracle:oinstall /home/oracle/p13390677_112040_Linux-x86-64_*
[oracle@localhost ~]$ unzip p13390677_112040_Linux-x86-64_1of7.zip
[oracle@localhost ~]$ unzip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@localhost ~]$ ll
total 2487200
drwxr-xr-x 7 oracle oinstall 136 Aug 27 2013 database
-rw-r--r-- 1 oracle oinstall 1395582860 Mar 19 10:41 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r-- 1 oracle oinstall 1151304589 Mar 19 10:41 p13390677_112040_Linux-x86-64_2of7.zip
【11】修改 oraInst.loc 檔案
[root@localhost ~]# cd /etc/
[root@localhost etc]# vi oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=oinstall
[root@localhost etc]# chown oracle:oinstall oraInst.loc
[root@localhost etc]# chmod 664 oraInst.loc
[root@localhost etc]#
[root@localhost etc]# ll oraInst.loc
-rw-rw-r-- 1 oracle oinstall 56 Mar 19 10:47 oraInst.loc
【12】配置應答檔案
[oracle@localhost ~]$ cd database/response/
[oracle@localhost response]$ ll
total 80
-rwxr-xr-x 1 oracle oinstall 44533 Aug 27 2013 dbca.rsp
-rw-r--r-- 1 oracle oinstall 25116 Aug 27 2013 db_install.rsp
-rwxr-xr-x 1 oracle oinstall 5871 Aug 27 2013 netca.rsp
[oracle@localhost response]$ mv db_install.rsp db_install.rspbak
簡版:(發現使用簡版安裝失敗,因此可以用簡版的引數配置去填寫響應檔案對應內容,在安裝過程中需要檢測全部的引數,因此安裝失敗)
[oracle@localhost response]$ vi db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=ORA11
UNIX_GROUP_NAME=dba
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0
oracle.install.db.config.starterdb.automatedBackup.enable=false
oracle.install.db.config.starterdb.control=DB_CONTROL
原版:
[oracle@ORA11 response]$ cat db_install.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=ORA11
#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=dba
#-------------------------------------------------------------------------------
# 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
#------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#------------------------------------------------------------------------------
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_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 variable 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
# oracle.rdbms.dv:11.2.0.4.0 - Oracle Database Vault
# 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=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:11.2.0.4.0,oracle.rdbms.dv:11.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0
###############################################################################
# #
# 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=dba
#------------------------------------------------------------------------------
# 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=
#------------------------------------------------------------------------------
# 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=
#------------------------------------------------------------------------------
# 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.
#
# It can be 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=
#------------------------------------------------------------------------------
# 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.storage=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=
#------------------------------------------------------------------------------
# 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. This value is used if auto-updates option is selected.
#
# 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=
#------------------------------------------------------------------------------
# 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=
【13】安裝 Oracle 程式
./runInstaller -silent -force -responseFile /home/oracle/database/response/db_install.rsp -ignorePrereq
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 45676 MB Passed
Checking swap space: must be greater than 150 MB. Actual 3967 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2021-03-19_11-49-34AM. Please wait ...[oracle@ORA11 database]$ You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2021-03-19_11-49-34AM.log
The installation of Oracle Database 11g was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2021-03-19_11-49-34AM.log' for more details.
As a root user, execute the following script(s):
1. /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Successfully Setup Software.
[安裝中,如果提示[WARNING]不必理會,此時安裝程式仍在進行,如果出現[FATAL],則安裝程式已經停止了。]
可進入 /u01/app/oraInventory/logs 檢視安裝日誌
[root@localhost logs]# ll
total 20
-rw-rw---- 1 oracle oinstall 10493 Mar 19 11:24 installActions2021-03-19_11-24-41AM.log
-rw-r--r-- 1 oracle oinstall 3527 Mar 19 11:24 oraInstall2021-03-19_11-24-41AM.err
-rw-r--r-- 1 oracle oinstall 0 Mar 19 11:24 oraInstall2021-03-19_11-24-41AM.out
-rw-r--r-- 1 oracle oinstall 47 Mar 19 11:24 time2021-03-19_11-24-41AM.log
[root@localhost logs]# tail -100f installActions2021-03-19_11-24-41AM.log
【14】執行安裝過程中的 root.sh 指令碼
[root@ORA11 ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
Check /u01/app/oracle/product/11.2.0/dbhome_1/install/root_ORA11_2021-03-19_11-51-55.log for the output of root script
[root@ORA11 ~]#
【15】解除安裝Oracle
cd /u01/app/oracle/product/11.2.0/dbhome_1/deinstall
[oracle@ORA11 deinstall]$ ./deinstall
######################### CLEAN OPERATION END #########################
####################### CLEAN OPERATION SUMMARY #######################
Cleaning the config for CCR
As CCR is not configured, so skipping the cleaning of CCR configuration
CCR clean is finished
Successfully detached Oracle home '/u01/app/oracle/product/11.2.0/dbhome_1' from the central inventory on the local node.
Successfully deleted directory '/u01/app/oracle/product/11.2.0/dbhome_1' on the local node.
Successfully deleted directory '/u01/app/oraInventory' on the local node.
Successfully deleted directory '/u01/app/oracle' on the local node.
Oracle Universal Installer cleanup was successful.
Run 'rm -rf /etc/oraInst.loc' as root on node(s) 'ORA11' at the end of the session.
Run 'rm -rf /opt/ORCLfmap' as root on node(s) 'ORA11' at the end of the session.
Run 'rm -rf /etc/oratab' as root on node(s) 'ORA11' at the end of the session.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################
############# ORACLE DEINSTALL & DECONFIG TOOL END #############
靜默安裝資料庫
【1】環境變數配置
【2】建立所需目錄
【3】生成密碼檔案
【4】建立pfile引數檔案
【5】生成spfile引數檔案
【6】執行建立資料庫語句
【7】執行 catalog.sql 和 catproc.sql 指令碼
【8】最後的檢查
【9】刪除資料庫
【1】環境變數配置
建立test資料庫
[oracle@ORA11 ~]$ env |grep ORA
HOSTNAME=ORA11
ORACLE_SID=test
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
【2】建立所需目錄
[oracle@ORA11 ~]$ mkdir -p /u01/app/oracle/admin/test/adump
[oracle@ORA11 ~]$ mkdir -p /u01/app/oracle/flash_recovery_area
[oracle@ORA11 ~]$ mkdir -p /u01/app/oracle/oradata/test
【3】生成密碼檔案
[oracle@ORA11 ~]$ cd $ORACLE_HOME/dbs
[oracle@ORA11 dbs]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
[oracle@ORA11 dbs]$ ll
total 4
-rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora
[oracle@ORA11 dbs]$ orapwd file=orapwTEST password=oracle entries=30
[oracle@ORA11 dbs]$ ll
total 12
-rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora
-rw-r----- 1 oracle oinstall 5120 Mar 19 22:00 orapwTEST
【4】建立pfile引數檔案
[oracle@ORA11 dbs]$ vi inittest.ora
db_name='test'
memory_target=1G
processes = 150
audit_file_dest='/u01/app/oracle/admin/test/adump'
audit_trail ='db'
db_block_size=8192
db_domain='ljh.com'
db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/u01/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=testXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = (/u01/app/oracle/oradata/test/control1.ctl, /u01/app/oracle/oradata/test/control2.ctl)
compatible ='11.2.0'
[oracle@ORA11 dbs]$ ll
total 16
-rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora
-rw-r--r-- 1 oracle oinstall 533 Mar 19 23:27 inittest.ora
-rw-r----- 1 oracle oinstall 5120 Mar 19 22:00 orapwTEST
【5】生成spfile引數檔案
[oracle@ORA11 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 19 23:27:14 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> create spfile from pfile;
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 671089544 bytes
Database Buffers 390070272 bytes
Redo Buffers 5517312 bytes
【6】執行建立資料庫語句
[oracle@ORA11 ~]$ vi create_db.sql
CREATE DATABASE test
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE
GROUP 1 ('/u01/app/oracle/oradata/test/redo01a.log',
'/u01/app/oracle/oradata/test/redo01b.log') SIZE 100M BLOCKSIZE 512,
GROUP 2 ('/u01/app/oracle/oradata/test/redo02a.log',
'/u01/app/oracle/oradata/test/redo02b.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u01/app/oracle/oradata/test/redo03a.log',
'/u01/app/oracle/oradata/test/redo03b.log') SIZE 100M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u01/app/oracle/oradata/test/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/u01/app/oracle/oradata/test/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/test/users01.dbf'
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/u01/app/oracle/oradata/test/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/u01/app/oracle/oradata/test/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
SQL> @create_db.sql
Database created.
SQL> set line 200 pages 999
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
------------------------------------------------ ------------------------------------
test OPEN
【7】執行 catalog.sql 和 catproc.sql 指令碼
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql (比較慢)
conn system/oracle
@?/sqlplus/admin/pupbld.sql
【8】最後的檢查
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/test/system01.dbf
/u01/app/oracle/oradata/test/sysaux01.dbf
/u01/app/oracle/oradata/test/undotbs01.dbf
/u01/app/oracle/oradata/test/users01.dbf
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/test/redo01a.log
/u01/app/oracle/oradata/test/redo01b.log
/u01/app/oracle/oradata/test/redo02a.log
/u01/app/oracle/oradata/test/redo02b.log
/u01/app/oracle/oradata/test/redo03a.log
/u01/app/oracle/oradata/test/redo03b.log
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/test/control1.ctl
/u01/app/oracle/oradata/test/control2.ctl
【9】刪除資料庫
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
[oracle@ORA11 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sat Mar 20 09:39:47 2021
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 671089544 bytes
Database Buffers 390070272 bytes
Redo Buffers 5517312 bytes
Database mounted.
SQL> drop database;
drop database
*
ERROR at line 1:
ORA-12719: operation requires database is in RESTRICTED mode
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
System altered.
SQL> drop database;
Database dropped.
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
或者
startup mount exclusive restrict;
drop database