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./dbhome_1/assistants/dbca/dbca.rsp
3) 修改模板文件
修改前备份一下
cp /u01/app/oracle/product/11.2./dbhome_1/assistants/dbca/dbca.rsp /u01/app/oracle/product/11.2./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./dbhome_1/assistants/dbca/dbca.rsp
输出如下:
Connecting to database
% complete
% complete
% complete
% complete
% complete
% complete
% complete
Updating network configuration files
% complete
% complete
Deleting instance and datafiles
% complete
% 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 : %
DBCA_PROGRESS : %
DBCA_PROGRESS : %
DBCA_PROGRESS : %
DBCA_PROGRESS : %
DBCA_PROGRESS : %
DBCA_PROGRESS : %
Updating network configuration files
DBCA_PROGRESS : %
DBCA_PROGRESS : %
Deleting instance and datafiles
DBCA_PROGRESS : %
DBCA_PROGRESS : %
Database deletion completed.
到此数据库卸载完成