$ more /u02/soft/database/response/netca.rsp
[GENERAL] RESPONSEFILE_VERSION="11.2" CREATE_TYPE="CUSTOM" [oracle.net.ca] INSTALLED_COMPONENTS={"server","net8","javavm"} INSTALL_TYPE=""typical"" LISTENER_NUMBER=1 LISTENER_NAMES={"LISTENER"} LISTENER_PROTOCOLS={"TCP;1521"} LISTENER_START=""LISTENER"" NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"} NSN_NUMBER=1 NSN_NAMES={"EXTPROC_CONNECTION_DATA"} NSN_SERVICE={"PLSExtProc"} NSN_PROTOCOLS={"TCP;HOSTNAME;1521"} 3.2 静默创建监听$ORACLE_HOME/bin/netca /silent /responsefile /u02/soft/database/response/netca.rsp
Parsing command line arguments: Parameter "silent" = true Parameter "responsefile" = /u02/soft/database/response/netca.rsp Done parsing command line arguments. Oracle Net Services Configuration: Profile configuration complete. Oracle Net Listener Startup: Running Listener Control: /u02/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start LISTENER Listener Control complete. Listener started successfully. Listener configuration complete. Oracle Net Services configuration successful. The exit code is 0 4. 静默dbca建库 4.1 编辑dbca.rsp文件$ more /u02/soft/database/response/dbca.rsp
[GENERAL] RESPONSEFILE_VERSION = "11.2.0" OPERATION_TYPE = "createDatabase" [CREATEDATABASE] GDBNAME = "jingyu" SID = "jingyu" TEMPLATENAME = "General_Purpose.dbc" [createTemplateFromDB] SOURCEDB = "myhost:1521:orcl" SYSDBAUSERNAME = "system" TEMPLATENAME = "My Copy TEMPLATE" [createCloneTemplate] SOURCEDB = "orcl" TEMPLATENAME = "My Clone TEMPLATE" [DELETEDATABASE] SOURCEDB = "orcl" [generateScripts] TEMPLATENAME = "New Database" GDBNAME = "orcl11.us.oracle.com" [CONFIGUREDATABASE] [ADDINSTANCE] DB_UNIQUE_NAME = "orcl11g.us.oracle.com" NODELIST= SYSDBAUSERNAME = "sys" [DELETEINSTANCE] DB_UNIQUE_NAME = "orcl11g.us.oracle.com" INSTANCENAME = "orcl11g" SYSDBAUSERNAME = "sys"上面就可以成功建库,但绝大多数情况[CREATEDATABASE]下还需要指定一些其他参数,
因为默认的可能不符合实际要求,尤其是你创建的数据库字符集必须要按你的设计需求显示指定:
修改引用的通用模板General_Purpose.dbc
--本次规划数据库存储目录:/u02/oradata # mkdir -p /u02/oradata && chown oracle:oinstall /u02/oradata --修改模板 $ cd $ORACLE_HOME/assistants/dbca/templates/ $ cp General_Purpose.dbc General_Purpose.dbc.bak --vi替换{ORACLE_BASE}/oradata为新的存储路径/u02/oradata $ vi General_Purpose.dbc :%s#{ORACLE_BASE}/oradata#/u02/oradata#g --或者sed直接快速替换 sed -i 's#{ORACLE_BASE}/oradata#/u02/oradata#g' General_Purpose.dbc 4.2 静默创建数据库$ORACLE_HOME/bin/dbca -silent -responseFile /u02/soft/database/response/dbca.rsp
Enter SYS user password: Enter SYSTEM user password: Copying database files 1% complete 3% complete 11% complete 18% complete 26% complete 37% complete Creating and starting Oracle instance 40% complete 45% complete 50% complete 55% complete 56% complete 60% complete 62% complete Completing Database Creation 66% complete 70% complete 73% complete 85% complete 96% complete 100% complete Look at the log file "/u02/app/oracle/cfgtoollogs/dbca/jingyu/jingyu.log" for further details.注意:如果已经在响应文件中配置sys和system密码,上面就不会提示你输入密码了。
4.3 静默删除数据库