Sunday, June 14, 2009

Way to create a New database In Oracle

Any person can create a oracle database in two fashion.
1. Using DBCA ( Database Configuration Assistant )
2. Manually

1. Using DBCA: It is a utility provided by oracle and it is present in the $ORACLE_HOME/bin directory. It is a GUI utility and OUI ( Oracle Universal Installer ) installs the software it's normally run this DBCA to create the database.
You can also explicitely run this utility to create database.

2. Manually: You can create database manully using scripts. I am giving an example of creating database using scripts. For this you have to set some veriables.

First run the following command

sqlplus /nolog

Then the following command one after another.

CONNECT SYS AS SYSDBA;
ALTER SYSTEM SET DB_CREATE_FILE_DEST = ‘/user1/oracle/’;
ALTER SYSTEM SET DB_CREATE_ONLINE_LOG_DEST_1=’ /user2/oracle/’;
ALTER SYSTEM SET DB_CREATE_ONLINE_LOG_DEST_2=’ /user3/oracle/’;


Then run the following command or script

CREATE DATABASE oradba CONTROLFILE REUSE
LOGFILE
GROUP 1 ('/oracle/oradba/log01a.log', '/oracle/oradba/log01b.log') size 50M,
GROUP 2 ('/oracle/oradba/log02a.log', '/oracle/oradba/log02b.log') size 50M,
GROUP 3 ('/oracle/oradba/log03a.log', '/oracle/oradba/log03b.log') size 50M
DATAFILE
'/oracle/oradba/system.dbf' 250M
AUTOEXTEND ON MAXSIZE 500M
UNDO TABLESPACE undots
DATAFILE '/oracle/oradba/undots.dbf' 50M
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/oracle/oradba/temp.dbf' size 75M
EXTENT MANAGEMENT LOCAL
CHARACTER SET US7ASCII
MAXLOGFILES 10
MAXLOGMEMBERS 10
MAXLOGHISTORY 1
MAXDATAFILES 500;

The database named oradba will be created.

No comments:

Post a Comment

Command to do active duplicate for Oracle Database

1. First login to target server 2. Validate tns connectivity between Source DB and Target DB 3. Prepare and validate space availability 4. S...