Database creation using dbca is preferred by
most Oracle DBAs, because it is a more automated approach, and your database is
ready to use when DBCA completes. DBCA can be
launched by the Oracle Universal Installer (OUI), depending upon the type of
install that you select. It can also be used to delete a database or
configure other options of a database.
Sometimes when working remotely, you may not
have access to a GUI, or simply using GUI may be annoyingly slow for example
when exporting display for a server installed in the cloud, as was my case.
In such situations and others, you can use dbca
in silent mode to create your instance.
In this article we
will look at how we can create a database using a
non-interactive silent mode.
Creating Database Using DBCA Silent Mode
The “silent” argument is
passed to DBCA to achieve this. Other options like password for SYS and SYSTEM
users, which template to use and where to put datafiles are also provided to
the DBCA as an argument.
Most of the options
are optional and you can skip them. However, if you miss the mandatory option
the DBCA command line will ask for their values before creating the database.
Some of the parameters
which we will be used to create a database;
-Silent
Instructs dbca to run in silent mode
-createDatabase
The argument will instruct the DBCA to create
a database.
-templateName
Specifies the template to use to create the
database. A template is advantageous as you don’t have to specify a bevy of
other options like datafile and control file locations.
-gdbname
The global database name.
-sid
The database instance name.
-characterSet
The character set that the newly created
database will be using.
-memoryPercentage
The argument will specify the percentage of
total memory that can be use by the SGA and PGA combined.
-emConfiguration
Whether the database should be configured to
use EM or not.
Below are steps to
achieve this;
1. Confirm your
ORACLE_HOME and ORACLE_BASE before proceeding
2. Confirm the template to be used has the correct parameters. The template is locate at the ‘$ORACLE_HOME/assistants/dbca/templates’ directory by default unless otherwise specified. Make changes to it if necessary
3. Run dbca in silent mode
dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname tqv5 -sid tqv5 -responseFile NO_VALUE -characterSet AL32UTF8 -memoryPercentage 20 -emConfiguration NONE |
You will be able to
monitor the progress as seen above. The logfile can also be accessed.
The beauty of the silent
install is that it can be scheduled to run at any desired time as a cronjob.
The instance is
successfully been created and can be verified,
You can also create an instance using CREATE DATABASE command.
ReplyDeleteoption1:
STEPS:
1. create a pfile with the following entries:
db_name='testdb'
control_files='/location_1/control01.ctl','/location_2/control02.ctl'
2. startup nomount pfile='/u01/app/oracle/product/12.1/db_1/dbs/inittestdb.ora'
3. create spfile from pfile='/u01/app/oracle/product/12.1/db_1/dbs/inittestdb.ora';
4. shu immediate
5. startup nomount ---> to start the db using the newly created spfile
6. issue create database command:
CREATE DATABASE playdb2
USER SYS IDENTIFIED BY pass123
USER SYSTEM IDENTIFIED BY pass123
LOGFILE GROUP 1 ('/playground/app/oracle/oradata/playdb2/redo01a.log','/playground/app/oracle/oradata/playdb2/redo01b.log') SIZE 50M BLOCKSIZE 512,
GROUP 2 ('/playground/app/oracle/oradata/playdb2/redo02a.log','/playground/app/oracle/oradata/playdb2/redo02b.log') SIZE 50M BLOCKSIZE 512,
GROUP 3 ('/playground/app/oracle/oradata/playdb2/redo03a.log','/playground/app/oracle/oradata/playdb2/redo03b.log') SIZE 50M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL (if not specified the db creates dictionary-managed tbs which are deprecated)
DATAFILE '/playground/app/oracle/oradata/playdb2/system01.dbf' SIZE 325M REUSE ----> REUSE:- if df exists reuse it
SYSAUX DATAFILE '/playground/app/oracle/oradata/playdb2/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users DATAFILE '/playground/app/oracle/oradata/playdb2/users01.dbf' SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE '/playground/app/oracle/oradata/playdb2/temp01.dbf' SIZE 20M REUSE
UNDO TABLESPACE undotbs DATAFILE '/playground/app/oracle/oradata/playdb2/undotbs01.dbf' SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
6. run scripts to build data dictionary views as sysdba in the following order:
SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
SQL> @?/rdbms/admin/utlrp.sql
--
option2: Using Oracle Managed Files
--
1. create pfile:
DB_CREATE_FILE_DEST='/u01/app/oracle/oradata'
db_name='testdb'
memory_target=1G
2. startup DB using the newly create pfile:
startup nomount pfile='/u01/app/oracle/product/12.1/db_1/dbs/inittest.ora'
create spfile from pfile='/u01/app/oracle/product/12.1/db_1/dbs/inittest.ora';
shu immediate
startup nomount
3. Issue create database command
CREATE DATABASE playdb3
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
EXTENT MANAGEMENT LOCAL
DEFAULT TEMPORARY TABLESPACE temp
UNDO TABLESPACE undotbs1
DEFAULT TABLESPACE users;
run scripts above after creation
SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
SQL> @?/rdbms/admin/utlrp.sql
Verify your DB
Great!
Delete