Create Oracle 10g Database
Overview
This note describes how to create Oracle 10g Database.
Requirements
We assume you already have complete a binary install of the database following the provided instructions
InstallOracle10gBinaries. Moreover, since this database installation uses asynchronous I/O, it requires the following packages for RedHat Advanced Server 2.1 ES/AS: libaio-0.3.13-3.i386.rpm and libaio-devel-0.3.13-3.i386.rpm (for RedHat Advanced Server 3.0 ES/AS: libaio-0.3.96-5.rpm and libaio-devel-0.3.96-5.rpm).
It is possible to do the deployment onto a different configuration. We have tried to make the configuration and installation scripts easy to configure in these sorts of circumstances. We cannot help you debug your existing configuration, but can guide in what you might have to change in the scripts to work with a different hardware configuration.
Of course, all patches to the installation and configuration scripts to support other Oracle configurations are welcome!
It is important to do all the installation/configuration steps as the oracle user.
Get the scripts
The configuration scripts for the database creation are contained in the
CreateDatabase10g bundle in the File Upload section of savannah. Direct links:
Download this bundle and unpack it. When run, these scripts will download additional resources from the portal as required. It's contents are the following:
CreateDatabase10g-<VERSION>/
db-creation/
create-standard-roles.sql
CustomDatabase-big.dbt.template
CustomDatabase-small.dbt.template
custom-scripts.sql.template
db-config.txt
db-creation
listener.ora.template
tnsnames.ora.template
env-modification/
bashrc-modify.sh
remove_oracle.sh
These contain the following:
db-creation
- Script to create the directories and data files for the 10g database. Running this is a pre-requisite to deploying actual users and other needed structures into the database.
db-config.txt
- In this file you may set variables for ASM disks (ASM_DISKS) and disk group (DISK_GROUP_NAME) if you want to install the database with datafiles, redolog files and control files managed by ASM. The ASM_DISKS should be separated by comma (see the example in the file itself). If you want a standard installation with files stored in a filesystem, please leave these parameters without any values set. The disks to be used by ASM must be appropriately prepared:
- rawdevices must be configured for them (see the /etc/sysconfig/rawdevices)
- service rawdevices must be running
- the oracle user and its group should have the 600 access rights to the rawdevices
- parameters which allow for more customized memory distribution for Oracle and leave the SGA and PGA management to server itself. These new configuration parameters are SGA_TARGET and PGA_AGGREGATE_TARGET. They represent percentage of physical memory which is given to Oracle. If not set the default values are 40 (%) for SGA and 92M for PGA. See the comments in the file itself for more details concerning their settings.
custom-scripts.sql.template
- If you want to run your specific sql commands/scripts at the end of the process of database creation, you can add calls to them at the end of this file. For example, if you want to create your own schemas in the database, you can add the 'create user..' command at the end of this file. When the installation is finished, please remove the custom-scripts.sql file which had been generated in the process. This file contains settings for DBSNMP schema and its password which is set up to the same as your system and sys accounts!
env-modification
- Script which updates the environment and set all variables needed to connect and run the newly created database.
Database Creation
To create the Oracle 10g database, you use the scripts in the db-creation sub-directory. There is one main script, called db-creation Since version 2.0.0 this script uses dbca to create a database and dbca needs running X Window server otherwise it hangs.
Therefore you need to set your DISPLAY variable to point to a server or PC where Xwindows or an Xemulator such as eXceed is running and will allow incoming X11 calls. If you don't set up this the installation will hang.
db-creation has the following usage:
usage: db-creation --sid SID --password PWD [ --base PATH ] [-v]
Options:
--sid SID The system identifier of the db to set as default (up to 8 alphanumeric characters)
--password PWD The system password
--base PATH The path to ORACLE_BASE. Defaults to
"/ORA/dbs01/oracle"
--v verbose mode
Example:
./db-creation --sid MY_SID --password MY_PASSWORD
The
--sid
argument will be used as the
ORACLE_SID
value for the deployment, along with the corresponding system password (
--password
option).
Running this script will produce some output on your screen, as it creates needed structures in the filesystem. Since version 2.0.0 at the point of creating the database itself this script waits until the database is created (by dbca) together with all the tables, users and views in the database. It may take about 20 minutes for dbca to execute the installation therefore please be patient and wait for the prompt to come back.
In earlier versions running this script will produce a lot of output on your screen, as it runs SQL to create all the tables, users and views in the database. It should take about 20 minutes to run.
Updating the environment
To update your environment and set all environment variables needed to connect and run the newly created database, run the following script in your current shell:
/CreateDatabase10g-<VERSION>/
env-modification/
bashrc-modify.sh
This script has the following usage:
usage: bashrc-modify <my_sid>
Where
is the same as provided for the db-creation script.
Example:
. ./bashrc-modify.sh MY_SID
Now you can run sqlplus to connect to your new Oracle 10g database.
Database removal
To remove the whole Oracle10g installation run the following script in your current shell:
CreateDatabase10g-<VERSION>/
remove_oracle.sh
Example:
. ./remove_oracle.sh
In case of ASM has been used remember to format the ASM disks before reusing them later.