Silently build and delete databases
In many cases, the customer site or test environment does not necessarily have graphical tools such as xm, and new libraries or deletions need to be carried out through the command line.
Silently build the library:
SYS@pro > select * from v$version where rownum [- asmsnmpPassword]-diskGroupName-recoveryGroupName [- characterSet] [- nationalCharacterSet] [- registerWithDirService-dirServiceUserName -dirServicePassword-walletPassword] [- listeners] [- variablesFile]] [- variables] [- initParams] [- sampleSchema] [- memoryPercentage] [- automaticMemoryManagement] [- totalMemory] [- databaseType]] configure the database by specifying the following parameters:-configureDatabase-sourceDB [- sysDBAUserName-sysDBAPassword] [- registerWithDirService |-unregisterWithDirService |-regenerateDBPassword-dirServiceUserName -dirServicePassword-walletPassword] [- disableSecurityConfiguration [- enableSecurityConfiguration [- emConfiguration-dbsnmpPassword-sysmanPassword [- hostUserName-hostUserPassword] -backupSchedule] [- centralAgent]] create a template using an existing database by specifying the following parameters:-createTemplateFromDB-sourceDB-templateName-sysDBAUserName-sysDBAPassword [- maintainFileLocations] by specifying The following parameters create a clone template using an existing database:-createCloneTemplate-sourceSID-templateName [- sysDBAUserName-sysDBAPassword] [- maintainFileLocations] [- datafileJarLocation] generate a script to create data by specifying the following parameters Library:-generateScripts-templateName-gdbName [- scriptDest] delete the database by specifying the following parameters:-deleteDatabase-sourceDB [- sysDBAUserName-sysDBAPassword] query help by specifying the following options:-h |-help
Method 1:
[oracle@prodb-s pro] $dbca-silent-createDatabase-templateName General_Purpose.dbc-gdbname orcl-sid orcl-sysPassword admin-systemPassword admin-dbsnmpPassword admin-sysmanPassword admin-characterSet AL32UTF8-memoryPercentage 30-emConfiguration LOCAL replication database file 1% completed 3% completed 11% completed 18% completed 26% completed 37% created and started Oracle instance 40% completed 45% completed 50% Completed 55% completed 56% completed 60% completed 62% database creation in progress 66% completed 73% completed 85% completed 96% completed 100% completed [oracle@prodb-s pro] $emctl status dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.4.0 Copyright (c) 1996 2013 Oracle Corporation. All rights reserved. https://prodb-s:5500/em/console/aboutApplicationOracle Enterprise Manager 11g is running. -Logs are generated in directory / u01/app/oracle/product/11.2.0/dbhome_1/prodb-s_orcl/sysman/log [oracle@prodb-s pro] $ps-ef | grep pmonoracle 3789 10963 0 06:09 Pts/5 00:00:00 grep pmonoracle 29995 1 0 05:48? 00:00:00 ora_pmon_orcl
Method 2:
You can also create the database by configuring the dbca.rsp file:
You can also create a database by configuring the dbca.rsp file: [oracle@prodb-s ~] $cd / u01/app/oracle/product/11.2.0/dbhome_1/assistants/dbca/ [oracle @ prodb-s dbca] $more create_dbca.rsp [GENERAL] RESPONSEFILE_VERSION = "11.2.0" OPERATION_TYPE = "createDatabase" [CREATEDATABASE] GDBNAME = "orcl" SID = "orcl" TEMPLATENAME = "General_Purpose.dbc" characterSet = "ZHS16GBK" memoryPercentage = "20 "sysPassword =" oracle "systemPassword =" oracle "dbsnmpPassword =" oracle "sysmanPassword =" oracle "EMCONFIGURATION =" LOCAL "[oracle@prodb-s dbca] $dbca-silent-responseFile create_dbca.rsp
You can view the creation progress:
[oracle@prodb-s] $tail-f / u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log [oracle@prodb-s ~] $tail-f / u01/app/oracle/cfgtoollogs/dbca/orcl/trace.log
Delete the database instance:
Method 1:
[oracle@prodb-s pro] $dbca-silent-deleteDatabase-sourceDB orcl is connecting to the database 4% complete 9% completed 14% completed 19% completed 23% completed 28% completed 47% completed updating network profile 48% completed 52% deleted instance and data files 76% completed 100% completed details See the log file "/ u01/app/oracle/cfgtoollogs/dbca/orcl.log".
Method 2:
[oracle@prodb-s dbca] $cat del_dbca.rsp [GENERAL] RESPONSEFILE_VERSION = "11.2.0" OPERATION_TYPE = "deleteDatabase" [DELETEDATABASE] SOURCEDB = "orcl" [oracle@prodb-s dbca] $dbca-silent-responseFile del_dbca.rsp
Reference: Creating a Database with Noninteractive/Silent DBCA