dbca 命令行静默方式创建Oracle RAC

2024-02-04 12:32

本文主要是介绍dbca 命令行静默方式创建Oracle RAC,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

昨天有个需求,需要用命令行建一个RAC。先Google了一些文章,最好参照了下面这篇。
Create RAC database using DBCA silent mode,感谢此文作者,写得非常简洁。

我的环境是19c, 2节点RAC。然后遇到了一系列错误。

第一个错误,Disk Group不存在:

[FATAL] [DBT-06002] Selected disk group (XXXX) is not found.ACTION: Specify a disk group that is accessible from the system.

正好,主机上还有其它数据库,查询一下:

SQL> select name from v$asm_diskgroup;NAME
------------------------------
DATAC1
RECOC1

然后改成以下:

-diskGroupName +DATAC1/{DB_UNIQUE_NAME}/ \

第2个错误,FRA地址无效,可以绕过问题或指定FRA位置,我用了后者。

[WARNING] [DBT-06303] Unable to check if location (FRA/db0623/) is on ACFS.
[FATAL] [DBT-06007] The specified location (FRA Location) is invalid.CAUSE: The specified location is not found on the system or is detected to be a file.

直接去掉以下行:

-recoveryAreaDestination FRA \

或者改为:

-recoveryAreaDestination +$FRA \

第3个错误,4G以上不能AMM管理以及字符集问题:

[FATAL] [DBT-11211] The Automatic Memory Management option is not allowed when the total physical memory is greater than 4GB.CAUSE: The current total physical memory is 754GB.
[FATAL] [DBT-11152] National character set specified (AL32UTF8) is invalid.

直接删除以下行:

-nationalCharacterSet AL32UTF8 \
-automaticMemoryManagement true \

最终命令如下,会自动创建一个PDB orclpdb1。其中node01和node02是两个RAC节点的主机名,通过hostname命令获取。

export DBPWD='ABcd123_#'
export DGNAME=DATAC1
export FRA=RECOC1
export DBNAME=db0623
export NODE1=node01
export NODE2=node02dbca -silent \
-createDatabase \
-databaseConfigType RAC \
-templateName General_Purpose.dbc \
-gdbName $DBNAME  \
-sid $DBNAME  \
-SysPassword $DBPWD \
-SystemPassword $DBPWD \
-emConfiguration NONE \
-redoLogFileSize 2048  \
-storageType ASM \
-asmSysPassword $DBPWD \
-diskGroupName +$DGNAME/{DB_UNIQUE_NAME}/ \
-recoveryAreaDestination +$FRA \
-totalMemory 10240  \
-databaseType MULTIPURPOSE \
-nodelist ${NODE1},${NODE2} \
-createAsContainerDatabase true \
-numberOfPDBs 1 \
-pdbName orclpdb1 \
-pdbAdminPassword $DBPWD

日志如下,18分钟还是蛮快的:

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/db0623.
Database Information:
Global Database Name:db0623
System Identifier(SID) Prefix:db0623
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/db0623/db06231.log" for further details.real    18m8.020s
user    0m57.199s
sys     0m14.027s$ echo $?
0

另外两次也是18分钟左右,比较一致:

real    18m36.844s
user    0m57.905s
sys     0m14.577sreal    18m34.217s
user    0m56.531s
sys     0m14.336s

访问:

$ export ORACLE_SID=db06231
$ sqlplus / as sysdba
SQL> select count(*) from gv$instance;COUNT(*)
----------2SQL> show pdbs;CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------2 PDB$SEED                       READ ONLY  NO3 ORCLPDB1                       READ WRITE NO

删除,此时数据库是打开状态:

dbca -silent -deleteDatabase -sourceDB db0623

输出:

$ dbca -silent -deleteDatabase -sourceDB db0623
Enter SYS user password:[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
52% complete
55% complete
58% complete
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/db0623/db06230.log" for further details.

最后,附上一个帮助:

$ dbca -createDatabase -help-createDatabase - Command to Create a database.-responseFile | (-gdbName,-templateName)-responseFile - <Fully qualified path for a response file>-gdbName <Global database name>-templateName <Specify an existing template in default location or the complete template path for DB Creation or provide a new template name for template creation>[-useWalletForDBCredentials <true | false> Specify true to load database credentials from wallet]-dbCredentialsWalletLocation <Path of the directory containing the wallet files>[-dbCredentialsWalletPassword <Password to open wallet with auto login disabled>][-characterSet <Character set for the database>][-dvConfiguration <true | false> Specify true to configure and enable database vault.]-dvUserName <Specify database vault owner user name>-dvUserPassword <Specify database vault owner password>[-dvAccountManagerPassword <Specify database vault account manager password>][-dvAccountManagerName <Specify separate database vault account manager>][-datafileDestination <Destination directory for all database files>][-datafileJarLocation <For database creation, pass the absolute path of the datafile backup and for template creation, pass the directory to place the datafile backup>][-runCVUChecks <Specify "true" in order to run Cluster Verification Utility checks periodically for RAC databases.>][-sid <Database system identifier>][-redoLogFileSize <Size of each redo log file in MB>][-registerWithDirService <true | false>]-dirServiceUserName <User name for directory service>[-databaseCN <Database common name>][-dirServiceCertificatePath <Path to the certificate file to use when configuring SSL between database and directory service>][-dirServicePassword <Password for directory service>][-dirServiceUser <SamAccountName in case of configuring Active Directory>][-ldapDirectoryAccessType <PASSWORD | SSL>][-useSYSAuthForLDAPAccess <true | false>][-walletPassword <Password for database wallet>][-systemPassword <SYSTEM user password>][-nodelist <Node names separated by comma for the database>][-oracleHomeUserPassword <Specify Oracle Home User Password>][-sysPassword <SYS user password>][-enableArchive <true | false> Specify true to enable archive>][-archiveLogMode <AUTO|MANUAL , the default is Automatic archiving>][-archiveLogDest <Specify archive log destinations separated by comma. If archive log destination is not specified, fast recovery area location will be used for archive log files.>][-memoryMgmtType <AUTO|AUTO_SGA|CUSTOM_SGA>][-variables <Comma separated list of name=value pairs of location variables>][-listeners <A comma separated list of listeners that the database can be configured with>][-olsConfiguration <true | false> Specify true to configure and enable Oracle Label Security.][-configureWithOID This flag configures Oracle Label Security with OID.][-createAsContainerDatabase <true | false>][-pdbName <Pluggable database name>][-numberOfPDBs <Number of pluggable databases to be created, default is 0>][-pdbStorageMAXSizeInMB <value>][-pdbStorageMAXTempSizeInMB <value>][-useLocalUndoForPDBs <true | false>  Specify false to disable local undo tablespace for PDBs.][-pdbAdminPassword <PDB Administrator user Password, required only while creating new PDB>][-pdbOptions <A comma separated list of name:value pairs with database options to enable/disable. For example JSERVER:true,DV:false>][-recoveryAreaDestination <Destination directory for all recovery files. Specify "NONE" for disabling Fast Recovery Area>][-recoveryAreaSize <Fast Recovery Area Size in MB>][-createListener <Create a new listener to register your database. Specify in format, LISTENER_NAME:PORT>][-useOMF <true | false> Specify true to use Oracle-Managed Files.][-memoryPercentage | -totalMemory][-memoryPercentage <Percentage of physical memory for oracle database>][-totalMemory <Memory allocated for Oracle in MB>][-dbOptions <A comma separated list of name:value pairs with database options to enable/disable. For example JSERVER:true,DV:false>][-sampleSchema <true | false>][-variablesFile <File name of the name=value pairs for location variables in the template>][-customScripts <A comma separated list of SQL scripts which needs to be run post db creation.The scripts are run in order they are listed>][-databaseType <MULTIPURPOSE | DATA_WAREHOUSING | OLTP>][-oracleHomeUserName <Specify Oracle Home User Name>][-initParams <Comma separated list of name=value pairs>][-initParamsEscapeChar <Specify escape character for comma when a specific initParam has multiple values.If the escape character is not specified backslash is the default escape character>][-policyManaged | -adminManaged][-policyManaged <Policy managed database, default option is Admin managed database>]-serverPoolName <Specify the single server pool name in case of create server pool or comma separated list in case of existing server pools>[-pqPoolName <value>][-createServerPool <Create a new server pool, which will be used by the database>][-pqPoolName <value>][-forceServerPoolCreation <To create server pool by force when adequate free servers are not available. This may affect the database which is already in running mode>][-pqCardinality <value>][-cardinality <Specify the cardinality of the new server pool that is to be created, default is the number of qualified nodes>][-adminManaged <Admin managed database, this is default option>][-nationalCharacterSet <National character set for the database>][-storageType < FS | ASM >]-datafileDestination <Destination directory for all database files>[-asmsnmpPassword <ASMSNMP password for ASM monitoring>][-databaseConfigType <SINGLE | RAC | RACONENODE>][-RACOneNodeServiceName <Service name for the service to be created for RAC One Node database. This option is mandatory when the databaseConfigType is RACONENODE>][-emConfiguration <DBEXPRESS | CENTRAL | BOTH | NONE>][-dbsnmpPassword <DBSNMP user password>][-emPassword <EM Admin user password>][-emUser <EM Admin username to add or modify targets>][-emExpressPort <EM database express port number. Generally used during createDatabase>][-omsHost <EM management server host name>][-omsPort <EM management server port number>][-emExpressPortAsGlobalPort <value>]

补记

2023年9月7日,在Exadata X8-2 HC 1/4配上创建RAC:

export DBPWD='Welcome1'
export DGNAME=DATAC1
export FRA=RECOC1
export DBNAME=rwp19c
export NODE1=x8hcdbadm01
export NODE2=x8hcdbadm02[oracle@x8hcdbadm01 ~]$ time dbca -silent \
> -createDatabase \
> -databaseConfigType RAC \
> -templateName General_Purpose.dbc \
> -gdbName $DBNAME  \
> -sid $DBNAME  \
> -SysPassword $DBPWD \
> -SystemPassword $DBPWD \
> -emConfiguration NONE \
> -redoLogFileSize 2048  \
> -storageType ASM \
> -asmSysPassword $DBPWD \
> -diskGroupName +$DGNAME/{DB_UNIQUE_NAME}/ \
> -recoveryAreaDestination +$FRA \
> -totalMemory 10240  \
> -databaseType MULTIPURPOSE \
> -nodelist ${NODE1},${NODE2} \
> -createAsContainerDatabase true \
> -numberOfPDBs 1 \
> -pdbName orclpdb1 \
> -pdbAdminPassword $DBPWDPrepare 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/rwp19c.
Database Information:
Global Database Name:rwp19c
System Identifier(SID) Prefix:rwp19c
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/rwp19c/rwp19c0.log" for further details.real    24m8.355s
user    1m15.377s
sys     0m13.721s

这篇关于dbca 命令行静默方式创建Oracle RAC的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/677515

相关文章

使用shardingsphere实现mysql数据库分片方式

《使用shardingsphere实现mysql数据库分片方式》本文介绍如何使用ShardingSphere-JDBC在SpringBoot中实现MySQL水平分库,涵盖分片策略、路由算法及零侵入配置... 目录一、ShardingSphere 简介1.1 对比1.2 核心概念1.3 Sharding-Sp

Spring创建Bean的八种主要方式详解

《Spring创建Bean的八种主要方式详解》Spring(尤其是SpringBoot)提供了多种方式来让容器创建和管理Bean,@Component、@Configuration+@Bean、@En... 目录引言一、Spring 创建 Bean 的 8 种主要方式1. @Component 及其衍生注解

python中的显式声明类型参数使用方式

《python中的显式声明类型参数使用方式》文章探讨了Python3.10+版本中类型注解的使用,指出FastAPI官方示例强调显式声明参数类型,通过|操作符替代Union/Optional,可提升代... 目录背景python函数显式声明的类型汇总基本类型集合类型Optional and Union(py

Linux系统管理与进程任务管理方式

《Linux系统管理与进程任务管理方式》本文系统讲解Linux管理核心技能,涵盖引导流程、服务控制(Systemd与GRUB2)、进程管理(前台/后台运行、工具使用)、计划任务(at/cron)及常用... 目录引言一、linux系统引导过程与服务控制1.1 系统引导的五个关键阶段1.2 GRUB2的进化优

IDEA与MyEclipse代码量统计方式

《IDEA与MyEclipse代码量统计方式》文章介绍在项目中不安装第三方工具统计代码行数的方法,分别说明MyEclipse通过正则搜索(排除空行和注释)及IDEA使用Statistic插件或调整搜索... 目录项目场景MyEclipse代码量统计IDEA代码量统计总结项目场景在项目中,有时候我们需要统计

C#和Unity中的中介者模式使用方式

《C#和Unity中的中介者模式使用方式》中介者模式通过中介者封装对象交互,降低耦合度,集中控制逻辑,适用于复杂系统组件交互场景,C#中可用事件、委托或MediatR实现,提升可维护性与灵活性... 目录C#中的中介者模式详解一、中介者模式的基本概念1. 定义2. 组成要素3. 模式结构二、中介者模式的特点

详解Java中三种状态机实现方式来优雅消灭 if-else 嵌套

《详解Java中三种状态机实现方式来优雅消灭if-else嵌套》这篇文章主要为大家详细介绍了Java中三种状态机实现方式从而优雅消灭if-else嵌套,文中的示例代码讲解详细,感兴趣的小伙伴可以跟... 目录1. 前言2. 复现传统if-else实现的业务场景问题3. 用状态机模式改造3.1 定义状态接口3

MySQL 数据库表操作完全指南:创建、读取、更新与删除实战

《MySQL数据库表操作完全指南:创建、读取、更新与删除实战》本文系统讲解MySQL表的增删查改(CURD)操作,涵盖创建、更新、查询、删除及插入查询结果,也是贯穿各类项目开发全流程的基础数据交互原... 目录mysql系列前言一、Create(创建)并插入数据1.1 单行数据 + 全列插入1.2 多行数据

Java异常捕获及处理方式详解

《Java异常捕获及处理方式详解》异常处理是Java编程中非常重要的一部分,它允许我们在程序运行时捕获并处理错误或不预期的行为,而不是让程序直接崩溃,本文将介绍Java中如何捕获异常,以及常用的异常处... 目录前言什么是异常?Java异常的基本语法解释:1. 捕获异常并处理示例1:捕获并处理单个异常解释:

C#控制台程序同步调用WebApi实现方式

《C#控制台程序同步调用WebApi实现方式》控制台程序作为Job时,需同步调用WebApi以确保获取返回结果后执行后续操作,否则会引发TaskCanceledException异常,同步处理可避免异... 目录同步调用WebApi方法Cls001类里面的写法总结控制台程序一般当作Job使用,有时候需要控制