1、静默安装Oracle 19c软件
1.1、适用场景
如果无windows环境用于图形安装oracle软件,需要使用静默方式安装数据库,脚本如下:
1.2、静默安装Oracle
$ su - oracle
$ cd $ORACLE_HOME
$ ./runInstaller -ignorePrereq -waitforcompletion -silent \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/u01/app/oraInventory \
ORACLE_HOME=${ORACLE_HOME} \
ORACLE_BASE=${ORACLE_BASE} \
oracle.install.db.InstallEdition=EE \
oracle.install.db.OSDBA_GROUP=dba \
oracle.install.db.OSOPER_GROUP=oper \
oracle.install.db.OSBACKUPDBA_GROUP=backupdba \
oracle.install.db.OSDGDBA_GROUP=dgdba \
oracle.install.db.OSKMDBA_GROUP=kmdba \
oracle.install.db.OSRACDBA_GROUP=racdba \
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
DECLINE_SECURITY_UPDATES=true \
oracle.install.db.rootconfig.executeRootScript=false
# ----------------------------------------------
# 安装日志
Launching Oracle Database Setup Wizard...
[WARNING] [INS-32047] The location (/u01/app/oraInventory) specified for the central inventory is not empty.
ACTION: It is recommended to provide an empty location for the inventory.
[WARNING] [INS-13014] Target environment does not meet some optional requirements.
CAUSE: Some of the optional prerequisites are not met. See logs for details. installActions2022-04-20_03-49-57PM.log
ACTION: Identify the list of failed prerequisite checks from the log: installActions2022-04-20_03-49-57PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.
The response file for this session can be found at:
/u01/app/oracle/product/19.3.0/db_1/install/response/db_2022-04-20_03-49-57PM.rsp
You can find the log of this install session at:
/tmp/InstallActions2022-04-20_03-49-57PM/installActions2022-04-20_03-49-57PM.log
As a root user, execute the following script(s):
1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/19.3.0/db_1/root.sh
Execute /u01/app/oraInventory/orainstRoot.sh on the following nodes:
[server100]
Execute /u01/app/oracle/product/19.3.0/db_1/root.sh on the following nodes:
[server100]
Successfully Setup Software with warning(s).
Moved the install session logs to:
/u01/app/oraInventory/logs/InstallActions2022-04-20_03-49-57PM
[oracle@server100 db_1]$ exit
logout
# 使用root用户执行脚本
[root@server100 db_1]# sh /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@server100 db_1]# sh /u01/app/oracle/product/19.3.0/db_1/root.sh
Check /u01/app/oracle/product/19.3.0/db_1/install/root_server100_2022-04-20_15-52-56-229585574.log for the output of root script
2、静默创建数据库
2.1、适用场景
如果无windows环境用于图形创建oracle数据库,需要使用静默方式创建数据库,脚本如下:
2.2、创建容器数据库
容器数据库主要是用于多租户场景。
$ dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-responseFile NO_VALUE \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName ${PDB_NAME} \
-pdbAdminPassword BSOFT \
-gdbname ${ORACLE_SID} -sid ${ORACLE_SID} \
-characterSet ZHS16GBK \
-sysPassword BSOFT \
-systemPassword BSOFT \
-databaseType OLTP \
-totalMemory 8192 \
-storageType FS \
-datafileDestination '/data' \
-recoveryAreaDestination '/data/flash_recovery_area' \
-redoLogFileSize 50 \
-emConfiguration NONE \
-ignorePreReqs
2.3、创建非容器数据库
非容器数据库主要使用单实例用户场景。
$ dbca -silent -createDatabase \
-templateName General_Purpose.dbc \
-responseFile NO_VALUE \
-gdbname ${ORACLE_SID} -sid ${ORACLE_SID} \
-characterSet ZHS16GBK \
-sysPassword BSOFT \
-systemPassword BSOFT \
-databaseType OLTP \
-totalMemory 8192 \
-storageType FS \
-datafileDestination '/data' \
-recoveryAreaDestination '/data/flash_recovery_area' \
-redoLogFileSize 50 \
-emConfiguration NONE \
-ignorePreReqs
# ----------------------------------------------
# 执行日志
[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
Prepare for db operation
10% complete
Copying database files
40% complete
Creating and starting Oracle instance
42% complete
46% complete
50% complete
54% complete
60% complete
Completing Database Creation
66% complete
69% complete
70% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/u01/app/oracle/cfgtoollogs/dbca/demo.
Database Information:
Global Database Name:demo
System Identifier(SID):demo
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/demo/demo.log" for further details.
2.4、删除oracle实例
dbca -silent -deleteDatabase -sourceDB 实例名