CentOs7 静默安装Oracle12.2

测试用版本信息

CentOS 版本
Description: CentOS Linux release 7.9.2009 (Core)
Release: 7.9.2009

 

oracle版本

12.2.0.1

 

1.安装依赖包

yum -y install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst  make sysstat  unixODBC unixODBC-devel

 

2.创建用户组和用户

groupadd oinstall
groupadd dba
useradd -g oinstall -G dba -m oracle
passwd oracle

 

 

 3. 配置内核参数

 [root@localhost ~]# vi /etc/sysctl.conf

 加入以下参数

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

 [root@localhost ~]# sysctl -p 

4. 修改用户限制

   [root@localhost ~]# vim  /etc/security/limits.conf

  

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240

 

 5 . 修改用户登录库文件引用

   [root@localhost ~]#   vi /etc/pam.d/login

session    required /lib64/security/pam_limits.so 
session    required pam_limits.so

6 .修改用户登录环境变量

  [root@localhost ~]#   vi /etc/profile

 

if [ $USER = "oracle" ]; then
   if [ $SHELL = "/bin/ksh" ]; then
       ulimit -p 16384
       ulimit -n 65536
    else
       ulimit -u 16384 -n 65536
   fi
fi  

 

source /etc/profile

7.创建安装目录并配置权限

 

mkdir -p /app/oracle
chown -R oracle:oinstall /app/

8 . 切换用户配置环境变量

su - oracle
vim .bash_profile 

export ORACLE_BASE=/app/oracle
export ORACLE_SID=orc
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export ORACLE_HOME=/app/oracle/product/12.2/db_1   #实际路径11.2.0改为12C,此处由于当时忘记更改,然和环境变量bash_profile文件中配置的环境变量一样
export PATH=$PATH:$ORACLE_HOME/bin
export LANG="zh_CN.UTF-8"
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'

  source ~/.bash_profile

9. 上传安装包并解压

     su - root 

      mkdir /usr/local/oracle

     上传到 /usr/local/oracle 下

     

 

     解压文件

    

[root@localhost local]# cd /usr/local/oracle/
[root@localhost oracle]# unzip V839960-01.zip

 

10. 修改oracle静默安装的响应文件 /database/response/db_install.rsp

 

####################################################################
## Copyright(c) Oracle Corporation 1998,2017. 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_v12.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 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=/app/oracle/oraInventory
#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#-------------------------------------------------------------------------------
ORACLE_HOME=/app/oracle/product/12.2/db_1

#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base.
#-------------------------------------------------------------------------------
ORACLE_BASE=/app/oracle

#-------------------------------------------------------------------------------
# Specify the installation edition of the component.
#
# The value should contain only one of these choices.
# - EE : Enterprise Edition
# - SE2 : Standard Edition 2


#-------------------------------------------------------------------------------

oracle.install.db.InstallEdition=EE
###############################################################################
# #
# PRIVILEGED OPERATING SYSTEM GROUPS #
# ------------------------------------------ #
# Provide values for the OS groups to which SYSDBA and SYSOPER 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 OSDBA_GROUP is the OS group which is to be granted SYSDBA privileges.
#-------------------------------------------------------------------------------
oracle.install.db.OSDBA_GROUP=dba

#------------------------------------------------------------------------------
# The OSOPER_GROUP is the OS group which is to be granted SYSOPER privileges.
# The value to be specified for OSOPER group is optional.
#------------------------------------------------------------------------------
oracle.install.db.OSOPER_GROUP=oinstall

#------------------------------------------------------------------------------
# The OSBACKUPDBA_GROUP is the OS group which is to be granted SYSBACKUP privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSBACKUPDBA_GROUP=oinstall

#------------------------------------------------------------------------------
# The OSDGDBA_GROUP is the OS group which is to be granted SYSDG privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSDGDBA_GROUP=oinstall

#------------------------------------------------------------------------------
# The OSKMDBA_GROUP is the OS group which is to be granted SYSKM privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSKMDBA_GROUP=oinstall

#------------------------------------------------------------------------------
# The OSRACDBA_GROUP is the OS group which is to be granted SYSRAC privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSRACDBA_GROUP=oinstall

###############################################################################
# #
# Grid Options #
# #
###############################################################################
#------------------------------------------------------------------------------
# Specify the type of Real Application Cluster Database
#
# - ADMIN_MANAGED: Admin-Managed
# - POLICY_MANAGED: Policy-Managed
#
# If left unspecified, default will be ADMIN_MANAGED
#------------------------------------------------------------------------------
oracle.install.db.rac.configurationType=

#------------------------------------------------------------------------------
# Value is required only if RAC database type is ADMIN_MANAGED
#
# Specify the cluster node names selected during the installation.
# Leaving it blank will result in install on local server only (Single Instance)
#
# 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=

#------------------------------------------------------------------------------
# Value is required only if oracle.install.db.isRACOneInstall is true.
#
# Specify the name for RAC One Node Service
#------------------------------------------------------------------------------
oracle.install.db.racOneServiceName=

#------------------------------------------------------------------------------
# Value is required only if RAC database type is POLICY_MANAGED
#
# Specify a name for the new Server pool that will be configured
# Example : oracle.install.db.rac.serverpoolName=pool1
#------------------------------------------------------------------------------
oracle.install.db.rac.serverpoolName=

#------------------------------------------------------------------------------
# Value is required only if RAC database type is POLICY_MANAGED
#
# Specify a number as cardinality for the new Server pool that will be configured
# Example : oracle.install.db.rac.serverpoolCardinality=2
#------------------------------------------------------------------------------
oracle.install.db.rac.serverpoolCardinality=

###############################################################################
# #
# Database Configuration Options #
# #
###############################################################################

#-------------------------------------------------------------------------------
# Specify the type of database to create.
# It can be one of the following:
# - GENERAL_PURPOSE
# - DATA_WAREHOUSE
# GENERAL_PURPOSE: A starter database designed for general purpose use or transaction-heavy applications.
# DATA_WAREHOUSE : A starter database optimized for data warehousing applications.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE

#-------------------------------------------------------------------------------
# Specify the Starter Database Global Database Name.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.globalDBName=orcl

#-------------------------------------------------------------------------------
# Specify the Starter Database SID.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.SID=orcl

#-------------------------------------------------------------------------------
# Specify whether the database should be configured as a Container database.
# The value can be either "true" or "false". If left blank it will be assumed
# to be "false".
#-------------------------------------------------------------------------------
oracle.install.db.ConfigureAsContainerDB=

#-------------------------------------------------------------------------------
# Specify the Pluggable Database name for the pluggable database in Container Database.
#-------------------------------------------------------------------------------
oracle.install.db.config.PDBName=

#-------------------------------------------------------------------------------
# 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=

#-------------------------------------------------------------------------------
# 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.
# The value can be either "true" or "false". If left blank it will be assumed
# to be "false".
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.installExampleSchemas=

###############################################################################
# #
# Passwords can be supplied for the following four schemas in the #
# starter database: #
# SYS #
# SYSTEM #
# 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 DBSNMP password for the starter database.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.DBSNMP=

#-------------------------------------------------------------------------------
# Specify the PDBADMIN password required for creation of Pluggable Database in the Container Database.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.password.PDBADMIN=

#-------------------------------------------------------------------------------
# Specify the management option to use for managing the database.
# Options are:
# 1. CLOUD_CONTROL - If you want to manage your database with Enterprise Manager Cloud Control along with Database Express.
# 2. DEFAULT -If you want to manage your database using the default Database Express option.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.managementOption=

#-------------------------------------------------------------------------------
# Specify the OMS host to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.omsHost=

#-------------------------------------------------------------------------------
# Specify the OMS port to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.omsPort=

#-------------------------------------------------------------------------------
# Specify the EM Admin user name to use to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.emAdminUser=

#-------------------------------------------------------------------------------
# Specify the EM Admin password to use to connect to Cloud Control.
# Applicable only when oracle.install.db.config.starterdb.managementOption=CLOUD_CONTROL
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.emAdminPassword=

###############################################################################
# #
# SPECIFY RECOVERY OPTIONS #
# ------------------------------------ #
# Recovery options for the database can be mentioned using the entries below #
# #
###############################################################################

#------------------------------------------------------------------------------
# This variable is to be set to false if database recovery is not required. Else
# this can be set to true.
#-------------------------------------------------------------------------------
oracle.install.db.config.starterdb.enableRecovery=

#-------------------------------------------------------------------------------
# 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 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 true.
#
# 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 Oracle Support Hub URL.
#
# Example : COLLECTOR_SUPPORTHUB_URL=https://orasupporthub.company.com:8080/
#------------------------------------------------------------------------------
COLLECTOR_SUPPORTHUB_URL=

 su - oracle

 cd /usr/local/oracle/database/

./runInstaller -silent -responseFile /usr/local/oracle/database/response/db_install.rsp -ignorePrereq

 完成提示 Successfully Setup Software

su - root 

1. /app/oracle/oraInventory/orainstRoot.sh
2. /app/oracle/product/12.2/db_1/root.sh

 11.安装监听程序

     

su - oracle 
netca /silent /responsefile /usr/local/oracle/database/response/netca.rsp

 

12 .开放1521端口

su - root
firewall-cmd --permanent --zone=public --add-port=1521/tcp firewall-cmd --reload firewall-cmd --permanent --zone=public --list-ports 1521/tcp

13. 配置监听地址

进入/app/oracle/product/12.2/db_1/network/admin目录配置

vim listener.ora 
#这一部分原来就会有
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.236.135)(PORT = 1521)) #将HOST修改为当前ip地址
    )
  )

#这一部分手动添加
SID_LIST_LISTENER=
             (SID_LIST =
                (SID_DESC =
                  (GLOBAL_DBNAME =  orcl)
                  (ORACLE_HOME = /app/oracle/product/12.2/db_1)
                  (SID_NAME = orcl)
                 )
               )


ADR_BASE_LISTENER = /app/oracle

 

14 . 启动监听

su - oracle
lsnrctl start

 15 . 静默库文件修改

su - oracle
mkdir /app/oracle/oradata;#创建数据文件存放的目录
#切换到root用户
su - root vi
/usr/local/oracle/database/response/dbca.rsp #修改如下 gdbName=orcl sid=orcl databaseConfigType=SI templateName=/app/oracle/product/12.2/db_1/assistants/dbca/templates/General_Purpose.dbc #不填写的时候报了[FATAL] [DBT-10503] 指定的模板文件无效。 sysPassword=oracle12c #指定sys用户密码 systemPassword=oracle12c #指定system用户密码 oracleHomeUserPassword=oracle12c datafileDestination=/app/oracle/oradata #指定数据文件存放的目录 recoveryAreaDestination=/app/oracle/flash_recovery_area #恢复数据存放目录 characterSet=ZHS16GBK
##############修改完保存#############################

su - oracle
dbca -silent -createDatabase -responseFile /usr/local/oracle/database/response/dbca.rsp


################################以下为完整文件代码###################

##############################################################################
## ##
## DBCA response file ##
## ------------------ ##
## Copyright(c) Oracle Corporation 1998,2017. 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.
#-------------------------------------------------------------------------------
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0


#-----------------------------------------------------------------------------
# Name : gdbName
# Datatype : String
# Description : Global database name of the database
# Valid values : <db_name>.<db_domain> - when database domain isn't NULL
# <db_name> - when database domain is NULL
# Default value : None
# Mandatory : Yes
#-----------------------------------------------------------------------------
gdbName=orcl


#-----------------------------------------------------------------------------
# Name : sid
# Datatype : String
# Description : System identifier (SID) of the database
# Valid values : Check Oracle12c Administrator's Guide
# Default value : <db_name> specified in GDBNAME
# Mandatory : No
#-----------------------------------------------------------------------------
sid=orcl


#-----------------------------------------------------------------------------
# Name : databaseConfigType
# Datatype : String
# Description : database conf type as Single Instance, Real Application Cluster or Real Application Cluster One Nodes database
# Valid values : SI\RAC\RACONENODE
# Default value : SI
# Mandatory : No
#-----------------------------------------------------------------------------
databaseConfigType=SI


#-----------------------------------------------------------------------------
# Name : RACOneNodeServiceName
# Datatype : String
# Description : Service is required by application to connect to RAC One
# Node Database
# Valid values : Service Name
# Default value : None
# Mandatory : No [required in case DATABASECONFTYPE is set to RACONENODE ]
#-----------------------------------------------------------------------------
RACOneNodeServiceName=


#-----------------------------------------------------------------------------
# Name : policyManaged
# Datatype : Boolean
# Description : Set to true if Database is policy managed and
# set to false if Database is admin managed
# Valid values : TRUE\FALSE
# Default value : FALSE
# Mandatory : No
#-----------------------------------------------------------------------------
policyManaged=



#-----------------------------------------------------------------------------
# Name : createServerPool
# Datatype : Boolean
# Description : Set to true if new server pool need to be created for database
# if this option is specified then the newly created database
# will use this newly created serverpool.
# Multiple serverpoolname can not be specified for database
# Valid values : TRUE\FALSE
# Default value : FALSE
# Mandatory : No
#-----------------------------------------------------------------------------
createServerPool=


#-----------------------------------------------------------------------------
# Name : serverPoolName
# Datatype : String
# Description : Only one serverpool name need to be specified
# if Create Server Pool option is specified.
# Comma-separated list of Serverpool names if db need to use
# multiple Server pool
# Valid values : ServerPool name


# Default value : None
# Mandatory : No [required in case of RAC service centric database]
#-----------------------------------------------------------------------------
serverPoolName=


#-----------------------------------------------------------------------------
# Name : cardinality
# Datatype : Number
# Description : Specify Cardinality for create server pool operation


# Valid values : any positive Integer value
# Default value : Number of qualified nodes on cluster
# Mandatory : No [Required when a new serverpool need to be created]
#-----------------------------------------------------------------------------
cardinality=


#-----------------------------------------------------------------------------
# Name : force
# Datatype : Boolean
# Description : Set to true if new server pool need to be created by force
# if this option is specified then the newly created serverpool
# will be assigned server even if no free servers are available.
# This may affect already running database.
# This flag can be specified for Admin managed as well as policy managed db.
# Valid values : TRUE\FALSE
# Default value : FALSE
# Mandatory : No
#-----------------------------------------------------------------------------
force=


#-----------------------------------------------------------------------------
# Name : pqPoolName
# Datatype : String
# Description : Only one serverpool name needs to be specified
# if create server pool option is specified.
# Comma-separated list of serverpool names if use
# server pool. This is required to
# create Parallel Query (PQ) database. Applicable to Big Cluster
# Valid values : Parallel Query (PQ) pool name
# Default value : None
# Mandatory : No [required in case of RAC service centric database]
#-----------------------------------------------------------------------------
pqPoolName=


#-----------------------------------------------------------------------------
# Name : pqCardinality
# Datatype : Number
# Description : Specify Cardinality for create server pool operation.
# Applicable to Big Cluster
# Valid values : any positive Integer value
# Default value : Number of qualified nodes on cluster
# Mandatory : No [Required when a new serverpool need to be created]
#-----------------------------------------------------------------------------
pqCardinality=


#-----------------------------------------------------------------------------
# Name : createAsContainerDatabase
# Datatype : boolean
# Description : flag to create database as container database
# Valid values : Check Oracle12c Administrator's Guide
# Default value : false
# Mandatory : No
#-----------------------------------------------------------------------------
createAsContainerDatabase=


#-----------------------------------------------------------------------------
# Name : numberOfPDBs
# Datatype : Number
# Description : Specify the number of pdb to be created
# Valid values : 0 to 4094
# Default value : 0
# Mandatory : No
#-----------------------------------------------------------------------------
numberOfPDBs=


#-----------------------------------------------------------------------------
# Name : pdbName
# Datatype : String
# Description : Specify the pdbname/pdbanme prefix if one or more pdb need to be created
# Valid values : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory : No
#-----------------------------------------------------------------------------
pdbName=


#-----------------------------------------------------------------------------
# Name : useLocalUndoForPDBs
# Datatype : boolean
# Description : Flag to create local undo tablespace for all PDB's.
# Valid values : TRUE\FALSE
# Default value : TRUE
# Mandatory : No
#-----------------------------------------------------------------------------
useLocalUndoForPDBs=


#-----------------------------------------------------------------------------
# Name : pdbAdminPassword
# Datatype : String
# Description : PDB Administrator user password
# Valid values : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory : No
#-----------------------------------------------------------------------------


pdbAdminPassword=


#-----------------------------------------------------------------------------
# Name : nodelist
# Datatype : String
# Description : Comma-separated list of cluster nodes
# Valid values : Cluster node names
# Default value : None
# Mandatory : No (Yes for RAC database-centric database )
#-----------------------------------------------------------------------------
nodelist=


#-----------------------------------------------------------------------------
# Name : templateName
# Datatype : String
# Description : Name of the template
# Valid values : Template file name
# Default value : None
# Mandatory : Yes
#-----------------------------------------------------------------------------
templateName=/app/oracle/product/12.2/db_1/assistants/dbca/templates/General_Purpose.dbc


#-----------------------------------------------------------------------------
# Name : sysPassword
# Datatype : String
# Description : Password for SYS user
# Valid values : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory : Yes
#-----------------------------------------------------------------------------
sysPassword=oracle12c


#-----------------------------------------------------------------------------
# Name : systemPassword
# Datatype : String
# Description : Password for SYSTEM user
# Valid values : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory : Yes
#-----------------------------------------------------------------------------
systemPassword=oracle12c


#-----------------------------------------------------------------------------
# Name : oracleHomeUserPassword
# Datatype : String
# Description : Password for Windows Service user
# Default value : None
# Mandatory : If Oracle home is installed with windows service user
#-----------------------------------------------------------------------------
oracleHomeUserPassword=oracle12c


#-----------------------------------------------------------------------------
# Name : emConfiguration
# Datatype : String
# Description : Enterprise Manager Configuration Type
# Valid values : CENTRAL|DBEXPRESS|BOTH|NONE
# Default value : NONE
# Mandatory : No
#-----------------------------------------------------------------------------
emConfiguration=


#-----------------------------------------------------------------------------
# Name : emExpressPort
# Datatype : Number
# Description : Enterprise Manager Configuration Type
# Valid values : Check Oracle12c Administrator's Guide
# Default value : NONE
# Mandatory : No, will be picked up from DBEXPRESS_HTTPS_PORT env variable
# or auto generates a free port between 5500 and 5599
#-----------------------------------------------------------------------------
emExpressPort=5500


#-----------------------------------------------------------------------------
# Name : runCVUChecks
# Datatype : Boolean
# Description : Specify whether to run Cluster Verification Utility checks
# periodically in Cluster environment
# Valid values : TRUE\FALSE
# Default value : FALSE
# Mandatory : No
#-----------------------------------------------------------------------------
runCVUChecks=


#-----------------------------------------------------------------------------
# Name : dbsnmpPassword
# Datatype : String
# Description : Password for DBSNMP user
# Valid values : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory : Yes, if emConfiguration is specified or
# the value of runCVUChecks is TRUE
#-----------------------------------------------------------------------------
dbsnmpPassword=


#-----------------------------------------------------------------------------
# Name : omsHost
# Datatype : String
# Description : EM management server host name
# Default value : None
# Mandatory : Yes, if CENTRAL is specified for emConfiguration
#-----------------------------------------------------------------------------
omsHost=


#-----------------------------------------------------------------------------
# Name : omsPort
# Datatype : Number
# Description : EM management server port number
# Default value : None
# Mandatory : Yes, if CENTRAL is specified for emConfiguration
#-----------------------------------------------------------------------------
omsPort=


#-----------------------------------------------------------------------------
# Name : emUser
# Datatype : String
# Description : EM Admin username to add or modify targets
# Default value : None
# Mandatory : Yes, if CENTRAL is specified for emConfiguration
#-----------------------------------------------------------------------------
emUser=


#-----------------------------------------------------------------------------
# Name : emPassword
# Datatype : String
# Description : EM Admin user password
# Default value : None
# Mandatory : Yes, if CENTRAL is specified for emConfiguration
#-----------------------------------------------------------------------------
emPassword=


#-----------------------------------------------------------------------------
# Name : dvConfiguration
# Datatype : Boolean
# Description : Specify "True" to configure and enable Oracle Database vault
# Valid values : True/False
# Default value : False
# Mandatory : No
#-----------------------------------------------------------------------------
dvConfiguration=


#-----------------------------------------------------------------------------
# Name : dvUserName
# Datatype : String
# Description : DataVault Owner
# Valid values : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory : Yes, if DataVault option is chosen
#-----------------------------------------------------------------------------
dvUserName=


#-----------------------------------------------------------------------------
# Name : dvUserPassword
# Datatype : String
# Description : Password for DataVault Owner
# Valid values : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory : Yes, if DataVault option is chosen
#-----------------------------------------------------------------------------
dvUserPassword=


#-----------------------------------------------------------------------------
# Name : dvAccountManagerName
# Datatype : String
# Description : DataVault Account Manager
# Valid values : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory : No
#-----------------------------------------------------------------------------
dvAccountManagerName=


#-----------------------------------------------------------------------------
# Name : dvAccountManagerPassword
# Datatype : String
# Description : Password for DataVault Account Manager
# Valid values : Check Oracle12c Administrator's Guide
# Default value : None
# Mandatory : No
#-----------------------------------------------------------------------------
dvAccountManagerPassword=


#-----------------------------------------------------------------------------
# Name : olsConfiguration
# Datatype : Boolean
# Description : Specify "True" to configure and enable Oracle Label Security
# Valid values : True/False
# Default value : False
# Mandatory : No
#-----------------------------------------------------------------------------
olsConfiguration=


#-----------------------------------------------------------------------------
# Name : datafileJarLocation
# Datatype : String
# Description : Location of the data file jar
# Valid values : Directory containing compressed datafile jar
# Default value : None
# Mandatory : No
#-----------------------------------------------------------------------------
datafileJarLocation=


#-----------------------------------------------------------------------------
# Name : datafileDestination
# Datatype : String
# Description : Location of the data file's
# Valid values : Directory for all the database files
# Default value : $ORACLE_BASE/oradata
# Mandatory : No
#-----------------------------------------------------------------------------
datafileDestination=/app/oracle/oradata


#-----------------------------------------------------------------------------
# Name : recoveryAreaDestination
# Datatype : String
# Description : Location of the data file's
# Valid values : Recovery Area location
# Default value : $ORACLE_BASE/flash_recovery_area
# Mandatory : No
#-----------------------------------------------------------------------------
recoveryAreaDestination=/app/oracle/flash_recovery_area


#-----------------------------------------------------------------------------
# Name : storageType
# Datatype : String
# Description : Specifies the storage on which the database is to be created
# Valid values : FS (CFS for RAC), ASM
# Default value : FS
# Mandatory : No
#-----------------------------------------------------------------------------
storageType=


#-----------------------------------------------------------------------------
# Name : diskGroupName
# Datatype : String
# Description : Specifies the disk group name for the storage
# Default value : DATA
# Mandatory : No
#-----------------------------------------------------------------------------
diskGroupName=


#-----------------------------------------------------------------------------
# Name : asmsnmpPassword
# Datatype : String
# Description : Password for ASM Monitoring
# Default value : None
# Mandatory : No
#-----------------------------------------------------------------------------
asmsnmpPassword=


#-----------------------------------------------------------------------------
# Name : recoveryGroupName
# Datatype : String
# Description : Specifies the disk group name for the recovery area
# Default value : RECOVERY
# Mandatory : No
#-----------------------------------------------------------------------------
recoveryGroupName=


#-----------------------------------------------------------------------------
# Name : characterSet
# Datatype : String
# Description : Character set of the database
# Valid values : Check Oracle12c National Language Support Guide
# Default value : "US7ASCII"
# Mandatory : NO
#-----------------------------------------------------------------------------
characterSet=ZHS16GBK


#-----------------------------------------------------------------------------
# Name : nationalCharacterSet
# Datatype : String
# Description : National Character set of the database
# Valid values : "UTF8" or "AL16UTF16". For details, check Oracle12c National Language Support Guide
# Default value : "AL16UTF16"
# Mandatory : No
#-----------------------------------------------------------------------------
nationalCharacterSet=


#-----------------------------------------------------------------------------
# Name : registerWithDirService
# Datatype : Boolean
# Description : Specifies whether to register with Directory Service.
# Valid values : TRUE \ FALSE
# Default value : FALSE
# Mandatory : No
#-----------------------------------------------------------------------------
registerWithDirService=



#-----------------------------------------------------------------------------
# Name : dirServiceUserName
# Datatype : String
# Description : Specifies the name of the directory service user
# Mandatory : YES, if the value of registerWithDirService is TRUE
#-----------------------------------------------------------------------------
dirServiceUserName=


#-----------------------------------------------------------------------------
# Name : dirServicePassword
# Datatype : String
# Description : The password of the directory service user.
# You can also specify the password at the command prompt instead of here.
# Mandatory : YES, if the value of registerWithDirService is TRUE
#-----------------------------------------------------------------------------
dirServicePassword=


#-----------------------------------------------------------------------------
# Name : walletPassword
# Datatype : String
# Description : The password for wallet to created or modified.
# You can also specify the password at the command prompt instead of here.
# Mandatory : YES, if the value of registerWithDirService is TRUE
#-----------------------------------------------------------------------------
walletPassword=


#-----------------------------------------------------------------------------
# Name : listeners
# Datatype : String
# Description : Specifies list of listeners to register the database with.
# By default the database is configured for all the listeners specified in the
# $ORACLE_HOME/network/admin/listener.ora
# Valid values : The list should be comma separated like "listener1,listener2".
# Mandatory : NO
#-----------------------------------------------------------------------------
listeners=


#-----------------------------------------------------------------------------
# Name : variablesFile
# Datatype : String
# Description : Location of the file containing variable value pair
# Valid values : A valid file-system file. The variable value pair format in this file
# is <variable>=<value>. Each pair should be in a new line.
# Default value : None
# Mandatory : NO
#-----------------------------------------------------------------------------
variablesFile=


#-----------------------------------------------------------------------------
# Name : variables
# Datatype : String
# Description : comma separated list of name=value pairs. Overrides variables defined in variablefile and templates
# Default value : None
# Mandatory : NO
#-----------------------------------------------------------------------------
variables=


#-----------------------------------------------------------------------------
# Name : initParams
# Datatype : String
# Description : comma separated list of name=value pairs. Overrides initialization parameters defined in templates
# Default value : None
# Mandatory : NO
#-----------------------------------------------------------------------------
initParams=


#-----------------------------------------------------------------------------
# Name : sampleSchema
# Datatype : Boolean
# Description : Specifies whether or not to add the Sample Schemas to your database
# Valid values : TRUE \ FALSE
# Default value : FASLE
# Mandatory : No
#-----------------------------------------------------------------------------
sampleSchema=


#-----------------------------------------------------------------------------
# Name : memoryPercentage
# Datatype : String
# Description : percentage of physical memory for Oracle
# Default value : None
# Mandatory : NO
#-----------------------------------------------------------------------------
memoryPercentage=


#-----------------------------------------------------------------------------
# Name : databaseType
# Datatype : String
# Description : used for memory distribution when memoryPercentage specified
# Valid values : MULTIPURPOSE|DATA_WAREHOUSING|OLTP
# Default value : MULTIPURPOSE
# Mandatory : NO
#-----------------------------------------------------------------------------
databaseType=


#-----------------------------------------------------------------------------
# Name : automaticMemoryManagement
# Datatype : Boolean
# Description : flag to indicate Automatic Memory Management is used
# Valid values : TRUE/FALSE
# Default value : TRUE
# Mandatory : NO
#-----------------------------------------------------------------------------
automaticMemoryManagement=


#-----------------------------------------------------------------------------
# Name : totalMemory
# Datatype : String
# Description : total memory in MB to allocate to Oracle
# Valid values :
# Default value :
# Mandatory : NO
#-----------------------------------------------------------------------------
totalMemory=

 

 16. 连接数据库

#注意/app/oracle/admin/orcl/pfile/ 下的文件名称替换成你自己电脑里的名称

需要拷贝文件 cp /app/oracle/admin/orcl/pfile/init.ora.6132023184353  /app/oracle/product/12.2/db_1/dbs/initorc.ora

 sqlplus / as sysdba;

  startup;

  # 如果出现以下错误

原因:是由于显示的目录里没有initorc.ora文件

 

 

17. 创建表空间和用户

 如果创建视图报错 视图执行 startup force

 



create tablespace Test datafile '/app/oracle/oradata/TEST.dbf' size 1024M autoextend on next 2048M maxsize 10g EXTENT MANAGEMENT local autoallocate segment space management auto; create user yxd identified by yxd default tablespace TEST; grant dba to yxd; grant connect,resource to yxd; grant create any sequence to yxd; grant create any table to yxd; grant delete any table to yxd; grant insert any table to yxd; grant select any table to yxd; grant unlimited tablespace to yxd; grant execute any procedure to yxd; grant update any table to yxd; grant create any view to yxd;

18. 设置开机自起

su - root
vi /etc/oratab
orcl:/app/oracle/product/11.2.0/db_1:Y

 

vim /etc/rc.d/rc.local
su - oracle -lc  /app/oracle/product/12.2/db_1/bin/lsnrctl start
su - oracle -lc /app/oracle/product/12.2/db_1/bin/dbstart

保存退出并授权

  chmod +x /etc/rc.d/rc.local

 

vim /app/oracle/product/12.2/db_1/bin/dbstart

将ORACLE_HOME_LISTNER=$1中的$1修改为/app/oracle/product/12.2/db_1/  #oracle安装路径

 

 19 更改编码

SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
alter database open;
ALTER DATABASE character set INTERNAL_USE ZHS16GBK;
shutdown immediate;
startup

中途出现过的错误

ORA-01507: ??????


SQL> alter database open
*1 行出现错误:
ORA-01507: ??????
  2    3    4    5
SQL>
SQL>
SQL> shutdown
ORA-01507: ??????


ORACLE 例程已经关闭。
SQL> exit
从 Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production                                                                                                         断开
[oracle@localhost dbs]$ ls
hc_orc.dat   init.ora     lkORCL     spfileorcl.ora
hc_orcl.dat  initorc.ora  orapworcl
[oracle@localhost dbs]$ yum install -y psmisc.x86_64
已加载插件:fastestmirror
您需要 root 权限执行此命令。
[oracle@localhost dbs]$ su - root
密码:
上一次登录:四 7月 13 15:18:45 CST 2023从 192.168.236.1pts/0 上
[root@localhost ~]# yum install -y psmisc.x86_64
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.bupt.edu.cn
 * extras: mirrors.bupt.edu.cn
 * updates: mirrors.aliyun.com
软件包 psmisc-22.20-17.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@localhost ~]# su - oracle
上一次登录:四 7月 13 15:18:48 CST 2023pts/0 上
[oracle@localhost ~]$ cd /app/oracle/product/12.2/db_1/db
dbjava/dbs/
[oracle@localhost ~]$ cd /app/oracle/product/12.2/db_1/dbs
[oracle@localhost dbs]$ fuser -k lkORCL
/app/oracle/product/12.2/db_1/dbs/lkORCL:  1785  1787  1789  1795  1797  1801                                                                                                          1811  1817  1821  1824  1826  1828  1830  1832  1840  1844  1846  1852
[oracle@localhost dbs]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on 星期四 7月 13 15:31:47 2023

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

已连接到空闲例程。

SQL> startup;

 

 20.导入命令

imp yxd/yxd@orcl file=/opt/jwaq.dmp ignore=y  full=y;

 

posted @ 2023-07-13 11:32  沈阳晓东  阅读(127)  评论(0编辑  收藏  举报