Search

Top 60 Oracle Blogs

Recent comments

dbca now makes it easy to configure OMF on file systems

Up until – and including – Oracle 12.1 I always found it not-quite-so-straight-forward to create a new database using Database Creation Assistant (dbca) and configure it with Oracle Managed Files (OMF) on a file system in silent mode. I really like to use OMF in my lab databases as it saves me a lot of typing. I have also seen Oracle databases deployed in the cloud on file systems without ASM. So I was quite happy to see the syntax for dbca -silent -createDatabase was extended.

This post has been written using Oracle 18.4.0 on Linux.

Why might you want to do that?

When writing code to automatically provision databases you can’t have any interactive parts if you want an end-to-end provisioning workflow. Oracle thankfully provides options to call many GUI tools on the command line in so-called silent mode as well. This includes, but is not limited to, dbca. You can invoke the tool with a help flag, and it’ll tell you about its many options. They are so numerous that I refrain from showing them here, but you can get them from the Administration Guide.

And how does it work?

Using the minimum number of relevant options I can easily create a database using dbca and tell it to use OMF, pointing to a file system destination instead of ASM. Your choice of flags is most likely quite different from mine. This one worked for me in the lab:

[oracle@server1 ~]$ dbca -silent -createDatabase -gdbName NCDB -templateName lab_database.dbc \
-enableArchive true -archiveLogMode auto -memoryMgmtType auto_sga \
-createAsContainerDatabase false -recoveryAreaDestination /u01/fast_recovery_area \
-useOMF true -datafileDestination /u01/oradata -totalMemory 2048
[…]
Prepare for db operation
10% complete
Copying database files
40% complete
Creating and starting Oracle instance
42% complete
46% complete
50% complete
54% complete
60% complete
Completing Database Creation
66% complete
69% complete
70% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
/u01/app/oracle/cfgtoollogs/dbca/NCDB.
Database Information:
Global Database Name:NCDB
System Identifier(SID):NCDB
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/NCDB/NCDB.log" for further details.
[oracle@server1 ~]$

You might have noticed the options to enable archivelog-mode as well. I’ll write about these in the next post :) Oh and the database is really created using OMF:

SQL> select name from v$tempfile union all
2 select name from v$datafile union all
3 select member from v$logfile union all
4 select value from v$parameter2 where name = 'control_files';

NAME
------------------------------------------------------------
/u01/oradata/NCDB/datafile/o1_mf_temp_g3gt1t7w_.tmp
/u01/oradata/NCDB/datafile/o1_mf_system_g3gsyght_.dbf
/u01/oradata/NCDB/datafile/o1_mf_sysaux_g3gszkmp_.dbf
/u01/oradata/NCDB/datafile/o1_mf_undotbs1_g3gt0bq9_.dbf
/u01/oradata/NCDB/datafile/o1_mf_users_g3gt0ct3_.dbf
/u01/oradata/NCDB/onlinelog/o1_mf_3_g3gt1lpw_.log
/u01/fast_recovery_area/NCDB/onlinelog/o1_mf_3_g3gt1mp8_.log
/u01/oradata/NCDB/onlinelog/o1_mf_2_g3gt1lp4_.log
/u01/fast_recovery_area/NCDB/onlinelog/o1_mf_2_g3gt1mqt_.log
/u01/oradata/NCDB/onlinelog/o1_mf_1_g3gt1los_.log
/u01/fast_recovery_area/NCDB/onlinelog/o1_mf_1_g3gt1mq0_.log
/u01/oradata/NCDB/controlfile/o1_mf_g3gt1j3w_.ctl
/u01/fast_recovery_area/NCDB/controlfile/o1_mf_g3gt1j5o_.ctl

Final thoughts

Until now it’s been quite difficult (at least for me) to enable OMF on a file system when using dbca in CLI mode. This is no longer the case.