Mir Sayeed Hassan – Oracle Blog

Oracle DBA – Tips & Techniques | Learn with real-time examples

  • Translate

  • It’s Me






  • My Certificates

  • Links

    My Acclaim Certification : Credly Profile
    My Oracle ACE Pro Profile

  • Achievements

    Awarded Top 100 Oracle Blogs from Worldwide - #RANK 39
  • VISITORS COUNT

  • Verified International Academic Qualification from World Education Service (WES)

    Verified International Academic Qualification from World Education Service (WES)

  • Jobs

Create the Oracle database 11gR2 (11.2.0.4) using DBCA Silent mode

Posted by Mir Sayeed Hassan on October 20th, 2019

Create the Oracle database 11gR2 (11.2.0.4) using DBCA Silent mode

Set the bash profile or you can run the environment variable

[oracle@testdb ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
# Oracle variables

TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_HOSTNAME=testdb; export ORACLE_HOSTNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=testdb; export ORACLE_SID
ORACLE_UNQNAME=testdb; export ORACLE_UNQNAME
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

:wq!

Run the bash profile

[oracle@testdb ~]$ . .bash_profile

Or

You can directly set the environment variables

[oracle@testdb ~]$ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
[oracle@testdb ~]$ export PATH=$ORACLE_HOME/bin:$PATH

Check the Environment variables set

[oracle@testdb ~]$ echo $ORACLE_SID
testdb
[oracle@testdb ~]$ echo $ORACLE_BASE
/u01/app/oracle
[oracle@testdb ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1

Create a directory for datafile, controlfile, onlinelog files

[oracle@testdb ~]$ mkdir -p /u01/app/oracle/oradata/

Create the database using DBCA Silent mode as shown below

[oracle@testdb ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName testdb.mirsayeedhassan.com -sid testdb -sysPassword sys -systemPassword testdb -emConfiguration NONE -datafileDestination /u01/app/oracle/oradata -storageType FS -characterSet AL32UTF8
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 "/u01/app/oracle/cfgtoollogs/dbca/testdb/testdb.log" for further details.

Verify the created database

[oracle@testdb ~]$ . oraenv
ORACLE_SID = [testdb] ? testdb
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@testdb ~]$ sqlplus / as sysdba

SQL> select instance_name,status,version from V$instance;

INSTANCE_NAME    STATUS       VERSION
--------------- ------------ -----------------
testdb           OPEN         11.2.0.4.0
SQL> select name from V$controlfile;

NAME
-----------------------------------------------------------
/u01/app/oracle/oradata/testdb/control01.ctl
/u01/app/oracle/fast_recovery_area/testdb/control02.ctl
SQL> select name from V$datafile;

NAME
-----------------------------------------------
/u01/app/oracle/oradata/testdb/system01.dbf
/u01/app/oracle/oradata/testdb/sysaux01.dbf
/u01/app/oracle/oradata/testdb/undotbs01.dbf
/u01/app/oracle/oradata/testdb/users01.dbf
SQL> select name from v$tempfile;

NAME
-------------------------------------------
/u01/app/oracle/oradata/testdb/temp01.dbf
SQL> select member from v$logfile;

MEMBER
-------------------------------------------
/u01/app/oracle/oradata/testdb/redo03.log
/u01/app/oracle/oradata/testdb/redo02.log
/u01/app/oracle/oradata/testdb/redo01.log
[oracle@testdb ~]$ cat /etc/oratab | grep -i testdb
testdb:/u01/app/oracle/product/11.2.0/dbhome_1:N

Check the database listener

[oracle@testdb ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-OCT-2019 21:42:36
Copyright (c) 1991, 2013, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                12-JUL-2019 17:09:28
Uptime                    92 days 5 hr. 33 min. 7 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/testdb_new/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=testdb_new)(PORT=1521)))
Services Summary...
Service "testdb.mirsayeedhassan.com" has 1 instance(s).
  Instance "testdb", status READY, has 1 handler(s) for this service...
Service "testdbXDB.mirsayeedhassan.com" has 1 instance(s).
  Instance "testdb", status READY, has 1 handler(s) for this service...
The command completed successfully

=====Hence its tested & verified in our test env=====