dbca [-silent | -progressOnly | -customCreate] {<command> <options> } | { [<command> [options] ] -responseFile <response file > } [-continueOnNonFatalErrors <true | false>]
Please refer to the manual for details.
You can enter one of the following command:
Create a database by specifying the following parameters:
-createDatabase
-templateName <name of an existing template in default location or the complete template path>
[-cloneTemplate]
-gdbName <global database name>
[-sid <database system identifier>]
[-sysPassword <SYS user password>]
[-systemPassword <SYSTEM user password>]
[-emConfiguration <CENTRAL|LOCAL|ALL|NONE> ------->>>>是否配置EM
-dbsnmpPassword <DBSNMP user password>
-sysmanPassword <SYSMAN user password>
[-hostUserName <Host user name for EM backup job>
-hostUserPassword <Host user password for EM backup job>
-backupSchedule <Daily backup schedule in the form of hh:mm>]
[-centralAgent <Enterprise Manager central agent home>]]
[-disableSecurityConfiguration <ALL|AUDIT|PASSWORD_PROFILE|NONE>
[-datafileDestination <destination directory for all database files> | -datafileNames <a text file containing database objects such as controlfiles, tablespaces, redo log files and spfile to their corresponding raw device file names mappings in name=value format.>]
[-redoLogFileSize <size of each redo log file in megabytes>] ------>>>>redolog大小,一般默认就是50M
[-recoveryAreaDestination <destination directory for all recovery files>]
[-datafileJarLocation <location of the data file jar, used only for clone database creation>]
[-storageType < FS | ASM > ----->>>>设定存储类型是ASM还是文件系统
[-asmsnmpPassword <ASMSNMP password for ASM monitoring>]
-diskGroupName <database area disk group name>
-recoveryGroupName <recovery area disk group name>
[-characterSet <character set for the database>] ----->>>>数据库字符集
[-nationalCharacterSet <national character set for the database>] ------>>>>国家语言字符集
[-registerWithDirService <true | false>
-dirServiceUserName <user name for directory service>
-dirServicePassword <password for directory service >
-walletPassword <password for database wallet >]
[-listeners <list of listeners to configure the database with>]
[-variablesFile <file name for the variable-value pair for variables in the template>]]
[-variables <comma separated list of name=value pairs>]
[-initParams <comma separated list of name=value pairs>]
[-sampleSchema <true | false> ] ------->>>>是否安装实例程序,就是那个scott用户
[-memoryPercentage <percentage of physical memory for Oracle>]
[-automaticMemoryManagement ]
[-totalMemory <memory allocated for Oracle in MB>]
[-databaseType <MULTIPURPOSE|DATA_WAREHOUSING|OLTP>]]
Configure a database by specifying the following parameters:
-configureDatabase
-sourceDB <source database sid>
[-sysDBAUserName <user name with SYSDBA privileges>
-sysDBAPassword <password for sysDBAUserName user name>]
[-registerWithDirService|-unregisterWithDirService|-regenerateDBPassword <true | false>
-dirServiceUserName <user name for directory service>
-dirServicePassword <password for directory service >
-walletPassword <password for database wallet >]
[-disableSecurityConfiguration <ALL|AUDIT|PASSWORD_PROFILE|NONE>
[-enableSecurityConfiguration <true|false>
[-emConfiguration <CENTRAL|LOCAL|ALL|NONE>
-dbsnmpPassword <DBSNMP user password>
-sysmanPassword <SYSMAN user password>
[-hostUserName <Host user name for EM backup job>
-hostUserPassword <Host user password for EM backup job>
-backupSchedule <Daily backup schedule in the form of hh:mm>]
[-centralAgent <Enterprise Manager central agent home>]]
Create a template from an existing database by specifying the following parameters:
-createTemplateFromDB
&xTZN^�Q ����,d8��U-'��4�z���/�]�� ��T��{�� 9�)��I�QE|�a�z��K����D�r�N̶��R�Nda_w.�ydcoD�>`���Um�߅�qqR��I�1��\�ӆ^ 5�:�)n�� �dK�,�1��¡��"�W���aa���ys���i�g9���V��K��E���V��G���d�:JC�q��2��YL4��!�� -sysDBAUserName <user name with SYSDBA privileges>
-sysDBAPassword <password for sysDBAUserName user name>
[-maintainFileLocations <true | false>]
Create a clone template from an existing database by specifying the following parameters:
-createCloneTemplate
-sourceSID <source database sid>
-templateName <new template name>
[-sysDBAUserName <user name with SYSDBA privileges>
-sysDBAPassword <password for sysDBAUserName user name>]
[-maintainFileLocations <true | false>]
[-datafileJarLocation <directory to place the datafiles in a compressed format>]
Generate scripts to create database by specifying the following parameters:
-generateScripts
-templateName <name of an existing template in default location or the complete template path>
-gdbName <global database name>
[-scriptDest <destination for all the scriptfiles>]
Delete a database by specifying the following parameters:
-deleteDatabase
-sourceDB <source database sid>
[-sysDBAUserName <user name with SYSDBA privileges>
-sysDBAPassword <password for sysDBAUserName user name>]
Query for help by specifying the following options: -h | -help
例子如下:
下面-redoLogFileSize 50默认也是以M为单位,不要加上M了,否则会报错。
-automaticMemoryManagement
-totalMemory <memory allocated for Oracle in MB>
如果上面两个参数同时加了,也会报错。我的例子中只加了个-totalMemory
下面的这个东西就是咱们在建库的时候选择的模板,general purpose还是Data warehouing还是custom。
General_Purpose.dbc
这个东西在这下面$ORACLE_HOME/assistants/dbca/templates
[oracle@rh64 templates]$ pwd
/u01/app/oracle/11g/assistants/dbca/templates ----我的ORACLE_HOME是/u01/app/oracle/11g/
[oracle@rh64 templates]$ ls -ltr
total 301548
-rw-r--r-- 1 oracle oinstall 11489 May 1 08:24 New_Database.dbt ------自定义的模板
-rw-r--r-- 1 oracle oinstall 5104 Aug 24 12:08 Data_Warehouse.dbc -----数据仓库的模板
-rw-r--r-- 1 oracle oinstall 4984 Aug 24 12:08 General_Purpose.dbc ----general purpose的模板
-rwxr-xr-x 1 oracle oinstall 1507328 Aug 27 12:45 example.dmp
-rwxr-xr-x 1 oracle oinstall 21741568 Aug 27 12:45 example01.dfb
-rwxr-xr-x 1 oracle oinstall 9748480 Aug 27 12:46 Seed_Database.ctl ---这个就是恢复的种子数据库的控制文件
-rwxr-xr-x 1 oracle oinstall 275750912 Aug 27 12:46 Seed_Database.dfb -----这个就是种子数据库的备份片,加上控制文件就能恢复出一个数据库来
-rw-r----- 1 oracle oinstall 5028 Oct 30 11:29 orcl.dbc
[oracle@rh64 ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname ora11g -sid ora11g -sysPassword oracle -systemPassword oracle -responseFile NO_VALUE -datafileDestination /u01/app/oracle/oradata/ora11g -redoLogFileSize 50 -recoveryAreaDestination /u01/app/oracle/fast_recovery_area -storageType FS -characterSet ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -memoryPercentage 30 -totalMemory 200 -databaseType OLTP -emConfiguration NONE
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
57% 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 "/u01/app/oracle/cfgtoollogs/dbca/ora11g/ora11g.log" for further details.
[oracle@rh64 ~]$
-datafileDestination /u01/app/oracle/oradata/ora11g ---->>>>我这个路径多加了个ora11g,其实它会自己创建目录,不用指定名字,我加了之后就会在这下面再建一个ora11g,
只需要给他指定目录即可/u01/app/oracle/oradata/,他自动会建以实例名的目录,存放数据库文件。
如果参数较多,觉得麻烦,可以搞一个responseFile方便。
总之,图形界面也是调的命令,用图形界面能做到的事情,命令界面一样可以做到,只是使用习惯的问题。
顺便说下,想看官档在这里:
Administrator's Guide --->>>Creating and Configuring an Oracle Database--->>>Creating a Database with DBCA
有些人干了N年了,也考了OCM,就会查个Metalink,连官档在电脑上都没有离线存一份,更不要说有多么熟悉官档了,一旦没有网络,MOS上没有相应案例,手机查不到,官档哪个地方不知道,那就等着被鄙视吧。
现在11gR2的官档基本上已经不更新了,最新版是E11882_01,最新的是11.2.0.4的,11204也新加了一些功能。下载地址在这里:
http://www.oracle.com/technetwork/database/enterprise-edition/documentation/index.html