Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
85 views

How To Create Oracle Database Manually On Linux

The document provides steps to manually create an Oracle database named "mydb" on Linux. It describes creating directories, a parameter file, tablespaces, redo logs, and control files. It then outlines executing SQL commands to start the instance, create the database, add a user tablespace, populate dictionaries, create user profiles, set passwords, and verify the database is ready.

Uploaded by

Redha Boumaza
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views

How To Create Oracle Database Manually On Linux

The document provides steps to manually create an Oracle database named "mydb" on Linux. It describes creating directories, a parameter file, tablespaces, redo logs, and control files. It then outlines executing SQL commands to start the instance, create the database, add a user tablespace, populate dictionaries, create user profiles, set passwords, and verify the database is ready.

Uploaded by

Redha Boumaza
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

How to create oracle database manually on

linux

Steps to create oracle database manually on linux


In this post, we discuss the steps to create oracle database manually in linux. These steps should be followed in
the order presented.
Decide the block size of the database. This is specified at database creation by the DB_BLOCK_SIZE
initialization parameter and cannot be changed after the database is created. If you want to change the
db_block_size ,you have to create a new database with the desired block size and export the data from old
database to the new database
Here is the steps to create a database using sql commands
In this example , the DB Name and SID name will be ‘mydb’
SID=mydb
DB_NAME=mydb

Tablespace Information
In this example , we will create the database with 5 tablespaces. Out of which 4 are system defined tablespace
and 5th one, ie USERS tablespace is user defined. For this exercise , we will have one datafile per tablespace.
Here is the structure for all the tablespaces
Tablespace Name      Datafile Location                Size
SYSTEM                       /data/mydb/sysytem.dbf   500M
SYSAUX                       /data/mydb/sysaux.dbf    100M
UNDOTBS                     /data/mydb/undo.dbf       100M
TEMP /data/mydb/temp.dbf 100M
USERS /data/mydb/usr.dbf 100M

Logfile Information
Oracle mandates to have 2 redo log groups. You may have to create more redo logs depending on the database
activity
Logfile Group Member Location Size
GROUP 1 /data/mydb/log1.ora 10M
GROUP 2 /data/mydb/log2.ora 10M

CONTROL FILE
Even though only one controlfile is mandatory , oracle recommends to have minimum 2 control files
The following is the path for contro lfiles
/data/mydb/control1.ora
/data/mydb/control2.ora

PARAMETER FILE

We will create a pfile first. Later we will see how to create a spfile from pfile.
Location of the Pfile
/wysheid/oracle_home/dbs/initmydbdb.ora
In this example /wysheid/oracle_home is the ORACLE_HOME directory. The expected path of the parameter file
is $ORACLE_HOME/dbs in Unix/Linux OS and $ORACLE_HOME/database in Windows OS
Below are the steps to create oracle database manually. Please make sure to execute them in the order given

Step 1: Create the directories for your database.


Use the following steps to recovering server parameter file or spfile

$ mkdir /data/mydb
$ mkdir /data/mydb/recovery
$ mkdir /wysheid/diag # ADR base directory

More Reading

Configure Dataguard Physical Standby Database Setup in Oracle 11g/12c

How to expire the password of an oracle user after ‘N’ days

Search Order for parameter file during instance startup

Step 2: Create the parameter file using a text editor


The following is a sample parameter file. Please make sure to create the parameter file in
$ORACLE_HOME/dbs directory. The name of the parameter file should be initmydb.ora
DB_NAME=mydbdb
DB_BLOCK_SIZE=8192
CONTROL_FILES=/data/mydb/control1.ora,/data/mydb/control1.ora
UNDO_TABLESPACE=undotbs
UNDO_MANAGEMENT=AUTO
SGA_TARGET=500M
PGA_AGGREGATE_TARGET=100M
LOG_BUFFER=5242880
DB_RECOVERY_FILE_DEST=/data/mydb/recovery
DB_RECOVERY_FILE_DEST_SIZE=2G
ADR_BASE=/wysheid/diag

Step 3: Set the environment variable and start the


instance.
$ export ORACLE_SID=mydbdb
$ export ORACLE_HOME=/wysheid/oracle_home
$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib
$ export PATH=$PATH:$ORACLE_HOME/bin
$ sqlplus
Enter User: / as sysdba
SQL>startup nomount

Step 4: Execute the ' Create Database Command'


Please note :- The create database command has to be given from “Mount ” Stage.
The command to create the database is
SQL> create database mydbdb
datafile ‘/data/mydb/sys.dbf’ size 500M
sysaux datafile ‘/data/mydb/sysaux.dbf’ size 100m
undo tablespace undotbs
datafile ‘/data/mydb/undo.dbf’ size 100m
default temporary tablespace temp
tempfile ‘/data/mydb/tmp.dbf’ size 100m
logfile
group 1 ‘/data/mydb/log1.ora’ size 50m,
group 2 ‘/data/mydb/log2.ora’ size 50m;
After the command finishes you will get the following message
Database created.
Please note: There is a semicolon (;) at the end of the above command .

Step 5: Create Additional Tablespace


After the above command finishes, the database will get mounted and opened. Now create additional
tablespaces
To create USERS tablespace
SQL> create tablespace users datafile ‘/data/mydb/usr.dbf’ size 100M;

Step 6: Populate the database with data dictionaries


Execute the following scripts in order
SQL>@/u01/oracle/rdbms/admin/catalog.sql

SQL>@/u01/oracle/rdbms/admin/catproc.sql

catalog.sql =>Creates dictionary tables and views


catproc.sql =>Creates PL/SQL procedures,functions and packages necessary.

Step 7:Create User Profiles.


SQL>conn system/manager

SQL>?@$ORACLE_HOME/sqlplus/admin/pupbld.sql

Step 8: Password Management


SQL>alter user sys identified by Welcome12#;
SQL>alter user system identified by Welcome12#;

Step 9: Verify the database creation status


SQL> select name,open_mode from v$database;
We should get the result as below
SQL> select name,open_mode from v$database;
NAME OPEN_MODE
— ———-
MYDB Read Write

You might also like