1) help查詢dbca的選項
su - oracle
dbca -help
dbca [-silent | -progressOnly | -customCreate] {<command> <options> } | { [<command> [options] ] -responseFile <response file > } [-continueOnNonFatalErrors <true | false>] -silent:靜默選項 -responseFile:指定模板文件
2) 查找模板文件路徑
find / -name dbca.rsp
/u01/app/oracle/product/11.2.0/dbhome_1/assistants/dbca/dbca.rsp
3) 修改模板文件
修改前備份一下
cp /u01/app/oracle/product/11.2.0/dbhome_1/assistants/dbca/dbca.rsp /u01/app/oracle/product/11.2.0/dbhome_1/assistants/dbca/dbca.rsp.bak
修改模板文件只保留以下內容
修改版本號(RESPONSEFILE_VERSION),操作方式(OPERATION_TYPE),[DELETEDATABASE]下的SID(SOURCEDB)
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "deleteDatabase"
[DELETEDATABASE]
SOURCEDB = "orcl"
4) 執行dbca命令
執行前注意:
關閉監聽
dbca -silent -responseFile /u01/app/oracle/product/11.2.0/dbhome_1/assistants/dbca/dbca.rsp
輸出如下:
Connecting to database 4% complete 9% complete 14% complete 19% complete 23% complete 28% complete 47% complete Updating network configuration files 48% complete 52% complete Deleting instance and datafiles 76% complete 100% complete Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl.log" for further details.
查看日志
more /u01/app/oracle/cfgtoollogs/dbca/orcl.log
內容:
The Database Configuration Assistant will delete the Oracle instance and datafiles for your database. All information in the database will be destroyed. Do you want to proceed? Connecting to database DBCA_PROGRESS : 4% DBCA_PROGRESS : 9% DBCA_PROGRESS : 14% DBCA_PROGRESS : 19% DBCA_PROGRESS : 23% DBCA_PROGRESS : 28% DBCA_PROGRESS : 47% Updating network configuration files DBCA_PROGRESS : 48% DBCA_PROGRESS : 52% Deleting instance and datafiles DBCA_PROGRESS : 76% DBCA_PROGRESS : 100% Database deletion completed.
到此數據庫卸載完成