12c和11g环境是一样的,请参考前面
一、设置环境变量
vim /home/oracle/.bashrc ORACLE_BASE=/data/app/oracle ORACLE_HOME=$ORACLE_BASE/product/12.2.0 ORACLE_SID=orcl PATH=$PATH:$ORACLE_HOME/bin export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH source /home/oracle/.bashrc
二、设置hosts中添加主机名
vim /etc/hosts 127.0.0.1 xiaoyuer#自己的主机名 #当时我报了一个这样的错: ACTION: Ensure that the current user has required permissions to access the temporary location. mkdir -p /var/tmp/.oracle mkdir -p /tmp/.oracle 有两个文件 要给777的权限 chown -R oracle:oinstall /tmp/.oracle chown -R oracle:oinstall /var/tmp/.oracle
三、设置应答文件 db_install.rsp
vim /data/database/response/db_install.rsp #ORACLE_HOSTNAM #主机名 oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=xiaoyuer UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/data/app/oracle/inventory SELECTED_LANGUAGES=en,zh_CN ORACLE_HOME=/data/app/oracle/product/12.2.0 ORACLE_BASE=/data/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=dba oracle.install.db.OSDGDBA_GROUP=dba oracle.install.db.OSKMDBA_GROUP=dba oracle.install.db.OSRACDBA_GROUP=dba oracle.install.db.config.starterdb.type=GENERAL_PURPOSE oracle.install.db.config.starterdb.globalDBName=cdb1 oracle.install.db.config.starterdb.SID=cdb1 oracle.install.db.config.starterdb.characterSet=AL32UTF8 SECURITY_UPDATES_VIA_MYORACLESUPPORT=false DECLINE_SECURITY_UPDATES=true
启动: ./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /data/database/response/db_install.rsp
As a root user, execute the following script(s): 1. /data/app/oracle/inventory/orainstRoot.sh 2. /data/app/oracle/product/12.2.0/root.sh 出现这两个说明安装完成;会提示log文件可以监听;在root下执行
四、生成监听文件
#设置DISPLAY变量 export DISPLAY=localhost:0.0 netca -silent -responseFile /data/database/response/netca.rsp Oracle Net Listener Startup: Running Listener Control: /data/app/oracle/product/12.2.0/bin/lsnrctl start LISTENER Listener Control complete. Listener started successfully. Listener configuration complete. Oracle Net Services configuration successful. The exit code is 0 查看监听状态:stop start lsnrctl status netstat -lntup|grep 1521 tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 28351/tnslsnr 修改端口不对修改(不知道为什么我启动端口不是1521,修改这个文件重启静态就好了) /data/app/oracle/product/12.2.0/network/admin/listener.ora
五、dbca生成数据库
[oracle@xiaoyuer response]$ cat dbca.rsp|grep -Ev '^#|^$' responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0 gdbName=orcl sid=orcl databaseConfigType=SI RACOneNodeServiceName= policyManaged=false createServerPool=false serverPoolName= cardinality= force=false pqPoolName= pqCardinality= createAsContainerDatabase=true numberOfPDBs=1 pdbName=orclpdb useLocalUndoForPDBs=true pdbAdminPassword= nodelist= templateName=/data/app/oracle/product/12.2.0/assistants/dbca/templates/General_Purpose.dbc sysPassword= systemPassword= oracleHomeUserPassword= emConfiguration= emExpressPort=5500 runCVUChecks=false dbsnmpPassword= omsHost= omsPort=0 emUser= emPassword= dvConfiguration=false dvUserName= dvUserPassword= dvAccountManagerName= dvAccountManagerPassword= olsConfiguration=false datafileJarLocation={ORACLE_HOME}/assistants/dbca/templates/ datafileDestination={ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/ recoveryAreaDestination={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME} storageType=FS diskGroupName= asmsnmpPassword= recoveryGroupName= characterSet=AL32UTF8 nationalCharacterSet=AL16UTF16 registerWithDirService=false dirServiceUserName= dirServicePassword= walletPassword= listeners=LISTENER variablesFile= variables=DB_UNIQUE_NAME=orcl,ORACLE_BASE=/data/app/oracle,PDB_NAME=,DB_NAME=orcl,ORACLE_HOME=/data/app/oracle/product/12.2.0,SID=orcl initParams=undo_tablespace=UNDOTBS1,memory_target=796MB,processes=300,db_recovery_file_dest_size=2780MB,nls_language=AMERICAN,dispatchers=(PROTOCOL=TCP) (SERVICE=cdb1XDB),db_recovery_file_dest={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME},db_block_size=8192BYTES,diagnostic_dest={ORACLE_BASE},audit_file_dest={ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump,nls_territory=AMERICA,local_listener=LISTENER_CDB1,compatible=12.2.0,control_files=("{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl", "{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}/control02.ctl"),db_name=cdb1,audit_trail=db,remote_login_passwordfile=EXCLUSIVE,open_cursors=300 sampleSchema=false memoryPercentage=40 databaseType=MULTIPURPOSE automaticMemoryManagement=false totalMemory=0
memory_target=796MB 是管理内存
processes 进程
db_recovery_file_dest_size=2780MB 归档日志