Tuesday, 2 June 2026

Creating an Oracle 26ai Database from Scratch using scripts

TL;DR: I want Scripts. Hence I am going to try and create an Oracle 26ai database purely using scripts. Specifically not recovering any templates (backupsets) delivered with the DBCA. The first attempt was interesting.

Outcome: You should probably use the DBCA, at least as a "Trusted Advisor"... 

And for Dev/Test usage: Just pull the container-images and run them. There are License-free images available as well should you need those (link). But running containers and circumventing licenses is not the scope of my current research.

The image: a script kiddy, happily playing around with toys and tools (and SQL). That is how I sometimes feel (minus all the hacking and the 1337 maybe...)


-- Quick (future) Jumps, upcoming links...:

I intend to run this little project in stages, and I hope to compose, approximately, the following items:

1. Create Database (and what goes wrong when you try that too simply)

2. Generate scripts from DBCA (and some comments and suggestions on that)

3. and subsequent: Various experiments and adjustments...

n. Adding PDBs.. and whatever we discover adding those...

End Goal: Present Usable and Portable Scripts, and a wrap-up with learnings, suggestions, and ideas.

At the time of writing (May 2026), I'm using v23.26.1, but over time I expect minor versions to come out. I will probably switch to latest versions whenever possible and I hope my scripts and demos do not change much over time (unless I find serious anomalies or bugs).


-- Background: Create a Database (from scripts ) 

The reference manual for Oracle 26ai still contains the command to Create a Database. Hence it should still be possible to create one Manually.

For fresh-installs, Oracle provides the DataBase Create Assistant (DBCA) which can help you to configure and install your database. In most cases, the DBCA will roll out a template and configure it depending on your choices in the assistant. Those templates are effectively backups from an earlier created database. 

Note: That database was Created by someone else.

There is a lot to be said for using Templates: They are configured and pre-packaged for a purpose, and should contain some "good practices". Using a template pre-empts a number of possible errors or omissions, hence is probably "safer". And the "recovery" of a template is a unit of magnitude faster than creating a database from running the scripts.

We can discuss the pro- and con- arguments for templates forever.  But I think that in the majority of cases those templates are Fine, at least for starting. Other RDBMS products also work with templates, so it is not a "new idea".

But mainly for Challenge and for Curiosity, I want to try and create a v26ai database using the original commands, scripted.

This is not a new idea: in very early versions (before 8.1?) the "creation of a database" was purely from scripts. It could be a a time-consuming process, notably on slow machines. But even with the DBCA, you could always choose "generate scripts". And there was generally a choice whereby the scripts did not "recover a template" but rather ran all the individual scripts that "compose a database".

My preferred option was to "generate the scripts", adjust them slightly to my preferences, and then carry around a set of "create scripts" so I could create one or multiple databases when needed. Some of those databases are still alive...

I'm going to try that scripted approach with v26ai.


-- The plan: Search for the Simplest Possible, linux-portable, Scripts.

As a "minimalist" I would like to have the simplest-possible script(s). Because I don't trust myself to compose really good, complete scripts. Hence I will end up working from a set of "generated scripts", provided by the DBCA.

The resulting database has to be "viable".

To ensure that I cover the essential components, later on I will Generate a set of scripts (and then try to simplify them). The aim is to have scripts that can be used with minimal effort on "any computer", provided it runs linux or unix <insert pinguin-emoticon here>.

Note that I have done this exercise on several versions of Oracle, and I have a collection of similar create-scripts going back to v7.1. Some of you may remember the scripts called "crdb<n>.sql" provided by Oracle. I liked those, I'm tempted to go back to old disks to re-inspect them...

The use of the DBCA has Not significantly changed since as far back as v8. The choice to use "scripts" rather than "recover a template" is still there. However, the resulting scripts and called-scripts have become more and more complex over time.

An my aim with this little "project" is to compose a set of scripts that are portable and usable. Not to create "the ultimate database", but rather to serve as research-material. And who knows what we can Learn in the process.


-- First Simple Attempts: It worked (but not really, not yet)

Just to see what would happen, I tried something very basic. I exported my ORACLE_HOME, ORACLE_SID, I connected, and I just tried it:

Check the above screenshot: 

First we show (echo) the $ORACLE_HOME and $ORACLE_SID. 

We use SQL*Plus to connect to the "idle" instance. 

We try to start the instance. We need to start in nomount state, as there Is No Database Yet... 

First error: it needs a pfile. 

So we touch a file with the right name.

Second error: it needs the DB_NAME in the pfile. 

Hence we echo that parameter into the file: db_name = $ORACLE_SID

And at this point we can start the instance in nomount-mode, no more errors. We see the memory-parameters of the instance and "instance started".

And with a started instance in nomount-state. We should be able to create the database:

Success. Nice.

Note, FYI: This database will be registered with the (dflt) listener but I will need a orapw-file to allow connections from, say, SQLDeveloper from another machine. 

Note also that if you happen to do this on the FREE version, your SID and your db_name have to be "FREE". That is one of the few limitations that the free version has. Check the docu (link) if you want to know more about the possibilities of the free-versions.

In a follow-up, I want to examine this Very Basic database a little further, but I already know from testing and earlier attempts that is is not really a "viable" database. The creation of a serious database needs a little more attention. 

Of course it still needs Catalog and Catproc, and long list of additional script to become a Real Database. But first, some parameters have to be set, and I would strongly recommend to make sure the datafiles are bigger and have a proper "increment" set to prevent enless re-sizing during subsequent scripts.

All of this is material for further Study.


-- First Conclusion: It works (just dont do this yet)

You can still use "Create Database", even with very basic settings.

However, it needs more work. The resulting "database" at this point had several show-stopper problems, and some more issues. I intend to use the next blogpost to dissect and discuss some of those items. 

I can also already give the spolier: The scripts generated from the DBCA Can Work and Do Work: you can create a database that way (at least I could from earlier version and from v23.26.1 with some attention to details). I'll use a few future blog-posts to walk through the process, and I will try to extract some "lessons learned" from that.

For now, please find my "absolute minimum script" in the link below. You can use it for your own amusement and experimenting. And if you do any experimenting, it will always be interesting to Someone: 

Let the world know what you find !


-- -- -- -- -- End of this Blogpost, for now -- -- -- -- --

Appendix: Links to script(s)

C000.sh : the very basic Create-stmnt, tested against the EE-version 23.26.1.

FREE.sh : if you run on the FREE version containers from Gerald.

The images used to test the create-stmnt above were the ones from gvenzl (free) and the database ee-edition from container-restry.oracle.com, both at version 23.26.1 (image created Jan 2026)

-- -- -- -- -- End of this blogpost, For Real -- -- -- -- --