Access FREE HP High-Availability Solutions for Exchange 2007 Tools:
Whitepaper:
Backup and Recovery Best Practices for Microsoft Exchange Server 2007 with HP
Whitepaper:
Best Practices for HP Servers and HP Enterprise Virtual Array in a Microsoft Exchange
Whitepaper:
Optimizing HP Servers with Microsoft SQL Server 2008

Free Newsletters:
DatabaseJournal  
DBANews
Database Journal
Search Database Journal:
 
HOME News MS SQL Oracle DB2 Access MySQL PostgreSQL PHP SQL Etc Scripts Links Discussion
internet.com

» HOME
» NEWS
» FEATURES
» SERIES
MS SQL
Oracle
MS Access
MySQL
DB2
» RESOURCES
Products
Scripts
Links
» DISCUSSION
» TECH JOBS

Marketplace Partners
Be a Marketplace Partner




internet.commerce
Be a Commerce Partner
Compare Prices
Imprinted Promotions
Car Donations
Desktop Computers
Domain registration
Laptop Batteries
Corporate Awards
Imprinted Gifts
Build a Server Rack
Compare Prices
Online Education
Best Price
Data Center Solutions
Memory




Google Display Ads in Your Pocket

Ballmer Ready to Move on Yahoo?

Acer Strong in Q1 With Aggressive Growth

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Linked Data Planet Conference & Expo

CA ERwin® Data Modeler Proven database design and modeling. Efficiently analyze, design and deploy effective database solutions. Whitepaper: Manage SQL Server Deployments
Try it free: CA ERwin® Data Modeler


Guide to Oracle 11g and Database Migration
Oracle Database 11g includes more features for self-management and automation, which makes it easier for customers to cost-effectively manage their data. Download this Internet.com eBook for an overview of some of the new features in 11g and for an overview of the issues you need to consider as you prepare for a database migration. »
Innovate Faster with Oracle Database 11g
Read this in-depth analysis of 56 customers, which shows significant differences between the value software vendors Oracle and SAP deliver to midsize companies. »
Oracle Business Intelligence Standard Edition One
Find out how Newport Beach, CA-based Mobilitie is shaking up the telecom industry by leveraging technology to provide an entirely different financial model for deploying, upgrading, and owning wireless and wireline network assets. »
Business Intelligence and Enterprise Performance Management: Trends for Emerging Businesses
Quickly implementing an ERP software solution can be of tremendous benefit; however, companies often struggle to balance the benefits of reducing implementation time and cost with the risks of an accelerated deployment. Read this white paper to learn about easy-to-follow best practices for achieving a successful accelerated implementation. »
Making the Case for Oracle Database on Windows
Users benefit as vendors reduce enterprise complexity and deliver integration. »

Production Manager (hands on)
Aquent
US-MA-Cambridge

Justtechjobs.com Post A Job | Post A Resume
Oracle
March 12, 2008
Create a Database Manually - When & Why?
By Sean Hull

Introduction

Oracle is a complicated beast to administer; why make our lives more difficult?  A lot of people ask that question when they look at a command line interface.  My response is always the same.  If you're trying to use the database, interfacing with it through an application, you're an end user.  So the more transparent it is the better.  For these folks the command line interface is obviously not ideal.  For those of us who are supposed to be the mechanics, the troubleshooters, the ones whom everyone else can go to when they have a problem, you want to get down and dirty, so you know what's going on.  The more layers of interface you have between you and your jet engine, the less you're going to understand how it works.  You do want to understand things don't you?

Why Create A Database Manually?

Creating a database follows along in this same way.  Sure there is a great Oracle supplied GUI tool which does it, and does a pretty good job at it too.  But what if it fails?  What if you get some warning or error, then what?  Do you want to know what it's doing behind the scenes?  Do you want to have further insight into the magic Oracle performs during database creation?  Manual database creation is an excellent way to illustrate all of this.

When you create a database manually, you issue commands at the sqlplus prompt.  Normally you add these commands to a sql script, which you then call from sqlplus.  Assuming all of the paths and options are correct, and the volumes specified exist, and do not reach capacity during database creation, it should run through smoothly.  Your script also serves as documentation of what options you used to create the database.  Furthermore, if you develop an application which you deploy on Oracle, your application may provide a database creation script, which does things your way.  This is an excellent way to provide a push-button or script with prompts for the administrator to use to install with.

When Should I Use The Manual Method?

Obviously when you're first learning Oracle, you should certainly be using the manual method.  Once you understand it inside and out, you might consider using the GUI to simplify your work.  If you want to control the naming conventions of files, however, I'd still tend to stick to the manual method.  Also when new versions of Oracle come out, be sure to check out what new options have been added to the create database syntax.  

What about if you're creating a whole bunch of databases which have similar characteristics.  Here again, the manual method appeals to us because it can help simplify our workload.

How Do I Do It?

Let's call our database DBJ.  At minimum, you would set your ORACLE_SID environment variable to DBJ, edit initDBJ.ora and add:

db_name=DBJ

Then fire up sqlplus and issue:

SQL> startup nomount;
SQL> create database;

Oracle will pick some defaults for all of the parameters it needs such as where to put datafiles, controlfiles, how much memory to allocate, and then startup without mounting any files.  The create database statement will ask Oracle to create a database with a minimal system and sysaux tablespace and so on.

In the real world, however we'd want to specify many more options.  Here's a real world example of what a create database script would look like in Oracle:

connect / as sysdba;
startup nomount;
CREATE DATABASE "dbj"
DATAFILE 
  '/u01/oradata/sysdbj01.dbf' size 500M
SYSAUX DATAFILE
  '/u01/oradata/auxdbj01.dbf' size 500M
UNDO TABLESPACE dbjundo DATAFILE
  '/u01/oradata/unddbj01.dbf' size 250M
LOGFILE
  '/u02/oradata/rdodbj01.dbf' size 10M,
  '/u02/oradata/rdodbj02.dbf' size 10M
CHARACTER SET "WE8ISO8859P1"
NATIONAL CHARACTER SET "UTF8"
EXTENT MANAGEMENT LOCAL
DEFAULT TEMPORARY TABLESPACE mytemp TEMPFILE 
  '/u01/oradata/tmpdbj01.dbf' SIZE 500M
NOARCHIVELOG
MAXDATAFILES 1000
MAXLOGFILES 10;
# create the rest of the data dictionary
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql

What's Happening At Each Stage?

When we issue "startup nomount" we're telling Oracle to do something different than when we normally startup.  What's different?  Well we tell Oracle to startup all of it's processes, and allocate memory for the system global area.  In essence, we tell Oracle to start an instance, but not a database.  Why not a database too?  Because we don't have one at this stage.  So, we have no database, which is effectively a collection of datafiles, to mount yet.

When we issue the create database command, Oracle creates a system, sysaux, undo, and temp tablespaces, and sets the character set for the database.  It's allocating datafiles with header information that specifies that we want extent management local, and archive or noarchivelog mode as well.  Once it's done all of this, it executes a magical file called sql.bsq.  I recommend you viewing this file; it should prove interesting, and educational.  It's Oracle bootstrapping code, all there for us to see and understand.  The sql.bsq file can be found in the $ORACLE_HOME/rdbms/admin directory.  Note that this file changes from release to release, so it might be illustrative to check for changes periodically.

After this is run, the Oracle data dictionary is basically built.  catalog.sql and catproc.sql merely build useful views on top of the real data dictionary, and various stored procedures, packages, and functions that every Oracle database requires.

Conclusions

Far from being the drudgery that some may associate with the command line, I find it fun and exciting.  Peering into the Oracle database creation process really pulls back the curtain on the inner workings of the database, allowing us to understand all of the levers, and pieces that make up a running Oracle database.  In the process, we learn more about init.ora, the bootstrapping scripts Oracle relies on, how the data dictionary is created, and the important differences between an instance and a database.

» See All Articles by Columnist Sean Hull

Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

Oracle Archives

Download: SQL Backup & DBA Best Practices eBook
Download: SQL Backup & DBA Best Practices eBook.
Five Trends for Application Development. Download Your Complimentary Report. Exclusive. Act Now.
Five Trends for Application Development & Program Management. Download Complimentary Report Now.
Download: Solaris 8 Migration Assistant. Run Solaris 8 apps on the latest SPARC systems and Solaris 10.


Latest Forum Threads
Oracle Forum
Topic By Replies Updated
GET DATA FROM .DBF FILE, ORACLE 9i revelation 4 April 21st, 05:13 PM
Could not locate Java runtime. Oracle installation error revelation 0 April 10th, 12:06 AM
Database Backup junOOni 4 March 20th, 06:28 AM
Helpme to How to Write Text File intelram_18 1 March 17th, 02:54 PM







JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Win Server ‘08
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES