前几篇博文完整介绍了如何从搭建VirtualBox环境到安装配置Oracle 19c RAC的过程,传送门如下:
利用VirtualBox在Oracle Linux 7安装Oracle 19c RAC Part1-安装虚拟机
利用VirtualBox在Oracle Linux 7安装Oracle 19c RAC Part2-准备系统环境
利用VirtualBox在Oracle Linux 7安装Oracle 19c RAC Part3-安装Oracle Grid Infrastructure 19c
利用VirtualBox在Oracle Linux 7安装Oracle 19c RAC Part4-数据库安装和配置
本来整个系列文章算是完结,但是实在对于Oracle 18c后创建数据库的漫长时间难于忍受,因此在创建数据库时个人总是会用静默安装代替图形界面的安装。云时代,软件的安装部署本来应该是越来越简便快捷才对,不明白O记为啥会自己作死,非得要做一个这么漫长的过程,真是会让你等得怀疑人生。刚开始安装的时候老是会怀疑电脑是不是挂掉了。
这一篇文章算是画蛇添足,介绍怎么生成响应文件并静默安装。
DBCA静默安装数据库
有人会说我也知道静默安装方便,但是响应文件的指令不熟悉,不知从何入手去写,网上找到的响应文件资源也不一定适合。那该如何生成适合自己环境的响应文件呢?
这要从上一节利用VirtualBox在Oracle Linux 7安装Oracle 19c RAC Part4-数据库安装和配置说起。我们可以在图形向导运行dbca,在第14步dbca总结页面时,按“Save Response File…”,把响应文件保存起来,这样就得到了适合当前环境的dbca响应文件了。在这一步,直接按Cancel,取消数据库的创建。
用oracle用户登录系统,运行dbca -silent -createDatabase命令静默安装方式创建数据库。
[oracle@ol7-19-rac1 ~]$ source db_env
[oracle@ol7-19-rac1 ~]$ dbca -silent -createDatabase \
-responseFile /home/oracle/dbca.rsp \
-sysPassword mypassword\
-systemPassword mypassword \
-dbsnmpPassword mypassword \
-pdbAdminPassword mypassword \
-ignorePreReqs
Prepare for db operation
7% complete
Copying database files
27% complete
Creating and starting Oracle instance
28% complete
31% complete
35% complete
37% complete
40% complete
Creating cluster database views
41% complete
53% complete
Completing Database Creation
57% complete
59% complete
60% complete
Creating Pluggable Databases
64% complete
80% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/u01/app/oracle/cfgtoollogs/dbca/cdbrac.
Database Information:
Global Database Name:cdbrac
System Identifier(SID) Prefix:cdbrac
Look at the log file “/u01/app/oracle/cfgtoollogs/dbca/cdbrac/cdbrac0.log” for further details.
[oracle@ol7-19-rac1 ~]$
利用静默安装的方式创建数据库,会比图形界面方式快很多。
删除数据库
如果运行dbca静默安装过程中出现数据库名已存在的[DBT-10317]等错误提示,可以用dbca -silent -deleteDatabase命令从系统中清除数据库信息,重新运行dbca -silent -createDatabase命令。
[FATAL] [DBT-10317] Specified GDB Name (cdbrac) already exists.
ACTION: Specify a different GDB Name that does not already exist.
[WARNING] [DBT-10328] Specified GDB Name (cdbrac) may have a potential conflict with an already existing database on the system.
ACTION: Specify a different GDB Name that does not conflict with existing databases on the system.
[WARNING] [DBT-10331] Specified SID Prefix (cdbrac) may have a potential conflict with an already existing database on the system.
CAUSE: The specified SID Prefix without the trailing numeric characters (cdbrac) may have a potential conflict with an already existing database on the system.
ACTION: Specify a different SID Prefix that does not conflict with existing databases on the system.
以下是静默运行删除数据库命令的示例输出。
[WARNING] [DBT-11503] The instance (cdbrac1) is not running on the local node. This may result in partial delete of Oracle database.
CAUSE: A locally running instance is required for complete deletion of Oracle database instance and database files.
ACTION: Specify a locally running database, or execute DBCA on a node where the database instance is running.
[WARNING] [DBT-19202] The Database Configuration Assistant will delete the Oracle instances and datafiles for your database. All information in the database will be destroyed.
Prepare for db operation
32% complete
Connecting to database
39% complete
42% complete
45% complete
48% complete
[WARNING] The data files for database with DB_NAME “cdbrac” could not be determined because the database could not be started. DBCA will proceed with the database deletion.
65% complete
Updating network configuration files
68% complete
Deleting instances and datafiles
77% complete
87% complete
97% complete
100% complete
Database deletion completed.
Look at the log file “/u01/app/oracle/cfgtoollogs/dbca/cdbrac/cdbrac.log” for further details.