Tuesday, February 23, 2010

DBCA (Database Configuration Assistant)

We can use DBCA for creation of database, creation of database using default templates, managing templates and configuring existing databases. It can be used in GUI mode or in silent mode with a template. Silent mode can be used to run without X Display (i.e. if GUI mode unavailable)You can use a default template or a template you've created earlier. In order to create database, you must use the following parameters:

-silent [must be use to run without any X Display]

-createDatabase [defines the DBCA operation, i.e. create a database]

-templateName [defines the name of the template you want to use to create your database. The template files are located in $ORACLE_HOME/assistants/dbca/templates and end with the .dbc extension (e.g General_Purpose.dbc)]

-gdbName [defines the global database name of the database. That impacts the dbname and db_domain parameters. (e.g. ORCL)]

-sid [defines the instance SID (e.g. ORCL).]

-SysPassword [defines the password for the SYS user that will be created in the password file and in the database (e.g mypass)]

-SystemPassword [defines the password for the SYSTEM user (e.g manager)]

-emConfiguration [allows you to register an Enterprise Manager Database Control or to register the database in an existing Enterprise Manager GridControl if an Agent has been installed previously (e.g. CENTRALLOCALALLNOBACKUPNOEMAILNONE)]

-datafileDestination [defines the location of all the files remaining on a filesystem]

-redoLogFileSize [allows you to define the redolog file size in MB (e.g. 100)]

-storageType [allows you to specify the type of storage you want to use. It can be a filesystem (FS), ASM (ASM), or a set of raw devices (RAW).]

-asmSysPassword [defines the password for the ASM SYS user. This parameter is mandatory if you plan to use an existing ASM instance (e.g change_on_install)]

-diskGroupName [defines the name of the diskgroup if ASM is used (e.g. DGDATA)]

-characterSet [defines the character set to be used (e.g. WE8ISO8859P1);]

-initParams [enables specific initialization parameters]

-totalMemory [specify the value for MEMORY_TARGET in megabytes (e.g. 500)]

SAMPLE FOR CREATE DATABASE:

dbca -silent -createDatabase -gdbName mytest -sid mytest -templateName General_Purpose.dbc -SysPassword oracle -SystemPassword oracle -storageType FS

-datafileDestination /u01/oradata/test/data –totalMemory 500

Create a clone template from an existing database by specifying the following parameters (Note: While creating the template the source database will be closed i.e. it will be brought to Mount stage):

-createCloneTemplate

-sourceSID <source database sid>

-templateName <new template name>

[-sysDBAUserName <user name with SYSDBA privileges from source db >

-sysDBAPassword <password for sysDBAUserName user name from source db >]

[-maintainFileLocations <true false>]

[-datafileJarLocation <directory to place the datafiles in a compressed format>]

SAMPLE FOR CREATE CLONE TEMPLATE:

dbca -silent -createCloneTemplate –sourceSID mytest2 –templateName mytest_temp –sysDBAUserName sys –sysDBAPassword oracle –maintainFileLocations false

Generate scripts to create database by specifying the following parameters:

-generateScripts

-templateName <name of an existing template>

-gdbName <global database name>

[-scriptDest <destination for all the scriptfiles>]

SAMPLE FOR GENERATING SCRIPT FROM TEMPLATE:

dbca –silent –generateScripts –templateName mytest_temp –gdbName mytest –scriptDest /u01/oradata/test

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>]

SAMPLE FOR DELETING A DATABASE:

dbca -silent -deleteDatabase -sourceDB mytest -sysDBAUserName sys -sysDBAPassword oracle