本文共 19418 字,大约阅读时间需要 64 分钟。
在Oracle Linux 7.1,数据库为Oracle 12cr2中使用dbca静默方式创建数据库的语法如下:
[oracle@jytest1 ~]$ dbca -silent -createDatabase helphelp -createDatabase - Command to Create a database. -responseFile | (-gdbName,-templateName) -responseFile - -gdbName -templateName [-characterSet ] [-createAsContainerDatabase ] [-numberOfPDBs ] [-pdbAdminPassword ] [-pdbName ] [-pdbOptions ] [-pdbStorageMAXSizeInMB ] [-pdbStorageMAXTempSizeInMB ] [-useLocalUndoForPDBs Specify false to disable local undo tablespace for PDBs.] [-createListener ] [-customScripts ] [-databaseConfigType ] [-RACOneNodeServiceName ] [-databaseType ] [-datafileDestination ] [-datafileJarLocation ] [-dbOptions ] [-dvConfiguration Specify true to configure and enable database vault.] -dvUserName -dvUserPassword [-dvAccountManagerName ] [-dvAccountManagerPassword ] [-emConfiguration ] [-dbsnmpPassword ] [-emExpressPort ] [-emPassword ] [-emUser ] [-omsHost ] [-omsPort ] [-enableArchive Specify true to enable archive>] [-archiveLogDest ] [-archiveLogMode] [-initParams ] [-initParamsEscapeChar ] [-listeners ] [-memoryMgmtType ] [-memoryPercentage | -totalMemory] [-memoryPercentage ] [-totalMemory ] [-nationalCharacterSet ] [-nodelist ] [-olsConfiguration Specify true to configure and enable Oracle Label Security.] [-configureWithOID This flag configures Oracle Label Security with OID.] [-oracleHomeUserName ] [-oracleHomeUserPassword ] [-policyManaged | -adminManaged] [-policyManaged ] -serverPoolName [-createServerPool ] [-cardinality ] [-force ] [-pqCardinality ] [-pqPoolName ] [-pqPoolName ] [-adminManaged ] [-recoveryAreaDestination ] [-recoveryAreaSize ] [-redoLogFileSize ] [-registerWithDirService ] -dirServiceUserName [-databaseCN ] [-dirServicePassword ] [-walletPassword ] [-runCVUChecks ] [-sampleSchema ] [-sid ] [-storageType < FS | ASM >] -datafileDestination [-asmsnmpPassword ] [-sysPassword ] [-systemPassword ] [-useOMF Specify true to use Oracle-Managed Files.] [-useWalletForDBCredentials Specify true to load database credentials from wallet] -dbCredentialsWalletLocation [-dbCredentialsWalletPassword ] [-variables ] [-variablesFile ]
使用dbca -silent方式来创建RAC数据库jycs,节点信息为jytest1,jytest2,磁盘组为test
[oracle@jytest1 ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName jycs -sid jycs -createAsContainerDatabase true -numberOfPDBs 1 -pdbName jycspdb -sysPassword xxzx7817600 -systemPassword xxzx7817600 -datafileDestination 'test/' -redoLogFileSize 50 -recoveryAreaDestination 'test/' -storageType -responseFile NO_VALUE -characterset ZHS16GBK -nationalCharacterSet AL16UTF16 -initParams log_archive_dest_1='location=+test/' -sampleSchema true -automaticMemoryManagement false -totalMemory 1024 -databaseType MULTIPURPOSE -nodeinfo jytest1,jytest2[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.
上面报错的原因是因为如果使用ASM磁盘组来存储数据文件时,指定磁盘组名称时,其格式为+diskgroup_name,而在11g中为diskgroup_name
修磁盘组格式后再次执行
[oracle@jytest1 ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName jycs -sid jycs -createAsContainerDatabase true -numberOfPDBs 1 -pdbName jycspdb -sysPassword xxzx7817600 -systemPassword xxzx7817600 -datafileDestination '+test/' -redoLogFileSize 50 -recoveryAreaDestination '+test/' -storageType ASM -characterset ZHS16GBK -nationalCharacterSet AL16UTF16 -initParams log_archive_dest_1='location=+test/' -sampleSchema true -automaticMemoryManagement false -totalMemory 1024 -databaseType MULTIPURPOSE -nodeinfo jytest1,jytest2 Enter PDBADMIN User Password: [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.[WARNING] [DBT-06208] The 'PDBADMIN' 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-09102] Target environment does not meet some optional requirements. CAUSE: Some of the optional prerequisites are not met. See logs for details. /u01/app/oracle/cfgtoollogs/dbca/trace.log_2017-04-26_09-55-10-AM ACTION: Find the appropriate configuration from the log file or from the installation guide to meet the prerequisites and fix this manually.Copying database filesDBCA Operation failed.Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/jycs/jycs.log" for further details.
查看具体错误原因,说是检查磁盘组test是否注册到集群中
[root@jytest1 ~]# cat /u01/app/oracle/cfgtoollogs/dbca/jycs/jycs0.log[ 2017-04-26 10:21:55.793 CST ] Copying database files[ 2017-04-26 10:21:55.942 CST ] PRCR-1070 : Failed to check if resource ora.TEST/.dg is registeredCRS-5161 : The entity name contains invalid characters.
检查集群资源可以看到磁盘组test状态正常,两个节点都为online状态,而由于12c中的语法多了listeners参数,所以猜测是由于没有指定监听程序的原因
[grid@jytest1 ~]$ crsctl stat res -t--------------------------------------------------------------------------------Name Target State Server State details --------------------------------------------------------------------------------Local Resources--------------------------------------------------------------------------------ora.ASMNET1LSNR_ASM.lsnr ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.CRS.dg ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.DATA.dg ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.LISTENER.lsnr ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.TEST.dg ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.chad ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.net1.network ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.ons ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.proxy_advm OFFLINE OFFLINE jytest1 STABLE OFFLINE OFFLINE jytest2 STABLE--------------------------------------------------------------------------------Cluster Resources--------------------------------------------------------------------------------ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE jytest2 STABLEora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE jytest1 STABLEora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE jytest1 STABLEora.MGMTLSNR 1 ONLINE ONLINE jytest1 169.254.123.145 88.8 8.88.1,STABLEora.asm 1 ONLINE ONLINE jytest1 Started,STABLE 2 ONLINE ONLINE jytest2 Started,STABLE 3 OFFLINE OFFLINE STABLEora.cvu 1 ONLINE ONLINE jytest1 STABLEora.jy.db 1 ONLINE ONLINE jytest1 Open,HOME=/u01/app/o racle/product/12.2.0 /db,STABLE 2 ONLINE ONLINE jytest2 Open,HOME=/u01/app/o racle/product/12.2.0 /db,STABLEora.jytest1.vip 1 ONLINE ONLINE jytest1 STABLEora.jytest2.vip 1 ONLINE ONLINE jytest2 STABLEora.mgmtdb 1 ONLINE ONLINE jytest1 Open,STABLEora.orcl.db 1 ONLINE ONLINE jytest1 Open,HOME=/u01/app/o racle/product/12.2.0 /db/,STABLE 2 ONLINE ONLINE jytest2 Open,HOME=/u01/app/o racle/product/12.2.0 /db/,STABLEora.qosmserver 1 ONLINE ONLINE jytest1 STABLEora.scan1.vip 1 ONLINE ONLINE jytest2 STABLEora.scan2.vip 1 ONLINE ONLINE jytest1 STABLEora.scan3.vip 1 ONLINE ONLINE jytest1 STABLE--------------------------------------------------------------------------------
增加listeners参数后再次执行
[oracle@jytest1 ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName jycs -sid jycs -databaseConfigType RAC -createAsContainerDatabase true -numberOfPDBs 1 -pdbName jycspdb -sysPassword xxzx7817600 -systemPassword xxzx7817600 -redoLogFileSize 50 -storageType ASM -datafileDestination '+test/' -asmsnmpPassword xxzx7817600 -characterset ZHS16GBK -nationalCharacterSet AL16UTF16 -initParams log_archive_dest_1='location=+TEST/',sga_target=1G,sga_max_size=1G -sampleSchema true -listeners ASMNET1LSNR_ASM,LISTENER,LISTENER_SCAN1 -automaticMemoryManagement false -totalMemory 2048 -databaseType MULTIPURPOSE -nodeinfo jytest1,jytest2 Enter PDBADMIN User Password: [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.[WARNING] [DBT-06208] The 'PDBADMIN' 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-09102] Target environment does not meet some optional requirements. CAUSE: Some of the optional prerequisites are not met. See logs for details. /u01/app/oracle/cfgtoollogs/dbca/trace.log_2017-04-26_12-34-00-PM ACTION: Find the appropriate configuration from the log file or from the installation guide to meet the prerequisites and fix this manually.Copying database files1% complete11% complete21% completeCreating and starting Oracle instance23% complete25% complete26% complete27% complete30% complete33% complete34% complete35% completeCreating cluster database views37% complete50% completeCompleting Database Creation51% complete53% complete55% complete57% completeCreating Pluggable Databases61% complete78% completeExecuting Post Configuration Actions100% completeLook at the log file "/u01/app/oracle/cfgtoollogs/dbca/jycs/jycs3.log" for further details.
数据库创建成功,检查是否将数据库jycs注册到集群中,从下面的结果可以看到已经注册了
[grid@jytest1 ~]$ crsctl stat res -t--------------------------------------------------------------------------------Name Target State Server State details --------------------------------------------------------------------------------Local Resources--------------------------------------------------------------------------------ora.ASMNET1LSNR_ASM.lsnr ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.CRS.dg ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.DATA.dg ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.LISTENER.lsnr ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.TEST.dg ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.chad ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.net1.network ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.ons ONLINE ONLINE jytest1 STABLE ONLINE ONLINE jytest2 STABLEora.proxy_advm OFFLINE OFFLINE jytest1 STABLE OFFLINE OFFLINE jytest2 STABLE--------------------------------------------------------------------------------Cluster Resources--------------------------------------------------------------------------------ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE jytest2 STABLEora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE jytest1 STABLEora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE jytest1 STABLEora.MGMTLSNR 1 ONLINE ONLINE jytest1 169.254.123.145 88.8 8.88.1,STABLEora.asm 1 ONLINE ONLINE jytest1 Started,STABLE 2 ONLINE ONLINE jytest2 Started,STABLE 3 OFFLINE OFFLINE STABLEora.cvu 1 ONLINE ONLINE jytest1 STABLEora.jy.db 1 ONLINE ONLINE jytest1 Open,HOME=/u01/app/o racle/product/12.2.0 /db,STABLE 2 ONLINE ONLINE jytest2 Open,HOME=/u01/app/o racle/product/12.2.0 /db,STABLEora.jycs.db 1 ONLINE ONLINE jytest1 Open,HOME=/u01/app/o racle/product/12.2.0 /db,STABLE 2 ONLINE ONLINE jytest2 Open,HOME=/u01/app/o racle/product/12.2.0 /db,STABLEora.jytest1.vip 1 ONLINE ONLINE jytest1 STABLEora.jytest2.vip 1 ONLINE ONLINE jytest2 STABLEora.mgmtdb 1 ONLINE ONLINE jytest1 Open,STABLEora.orcl.db 1 OFFLINE OFFLINE Instance Shutdown,ST ABLE 2 OFFLINE OFFLINE Instance Shutdown,ST ABLEora.qosmserver 1 ONLINE ONLINE jytest1 STABLEora.scan1.vip 1 ONLINE ONLINE jytest2 STABLEora.scan2.vip 1 ONLINE ONLINE jytest1 STABLEora.scan3.vip 1 ONLINE ONLINE jytest1 STABLE--------------------------------------------------------------------------------
小结:
12c中使用dbca -silent方式来创建数据库之前的版本相比,增加了listeners参数,减少了指定ASM磁盘组的diskGroupName参数,并且指定磁盘组名称时需要指定+号,之前版本不需要指定+号。当然还增加了许多其它参数,有兴趣的可以测试一下。来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26015009/viewspace-2138017/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26015009/viewspace-2138017/