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.
到此数据库卸载完成