Monday, June 18, 2012

Manual Database Creation


D:\oracle\product\10.1.0>set ORACLE_SID=ORA10
Creating an Oracle Service
On Windows, each instance requires a Windows service. This service must first be created with oradim:
Starting the instance
D:\oracle\product\10.1.0\Db_1>oradim -new -sid %ORACLE_SID% -intpwd MYSECRETPASSWORD -startmode M
Instance created.
SQL> connect sys/MYSECRETPASSWORD as sysdba
Connected to an idle instance.
SQL*Plus tells us that we're connected to an idle instance. That means that it is not yet started. So, let's start the instance. We have to start the instance without mounting (nomount) as there is no database we could mount at the moment.
ORACLE instance started.

Total System Global Area  113246208 bytes
Fixed Size                   787708 bytes
Variable Size              61864708 bytes
Database Buffers           50331648 bytes
Redo Buffers                 262144 bytes
This created the SGA (System Global Area) and the background processes.
Creating the database
We're now ready to finally create the database:
SQL>create database ora10
  logfile   group 1 ('D:\oracle\databases\ora10\redo1.log') size 10M,
            group 2 ('D:\oracle\databases\ora10\redo2.log') size 10M,
            group 3 ('D:\oracle\databases\ora10\redo3.log') size 10M
  character set WE8ISO8859P1
  national character set utf8

 datafile 'D:\oracle\databases\ora10\system.dbf'  size 50M
 autoextend on next 10M maxsize unlimited extent management local
  sysaux datafile 'D:\oracle\databases\ora10\sysaux.dbf'
  size 10M autoextend on next 10M maxsize unlimited
  undo tablespace undo
  datafile 'D:\oracle\databases\ora10\undo.dbf' size 10M
  default temporary tablespace temp
  tempfile 'D:\oracle\databases\ora10\temp.dbf' size 10M;
OR   //######## Database Creation Code #######
CREATE DATABASE abc
USER SYS IDENTIFIED BY xyz
USER SYSTEM IDENTIFIED BY xyz
LOGFILE GROUP 1(‘/home/oracle/oracle/product/10.2.0/oradata/redo01.log’) SIZE 50 m,
GROUP 2 (‘/home/oracle/oracle/product/10.2.0/oradata/redo02.log’) SIZE 50 m,
GROUP 3 (‘/home/oracle/oracle/product/10.2.0/oradata/redo03.log’) SIZE 50 m
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET us7ascii
NATIONAL CHARACTER SET al16utf16
DATAFILE ‘/home/oracle/oracle/product/10.2.0/oradata/system01.dbf’ SIZE 325 m REUSE EXTENT MANAGEMENT LOCAL
   SYSAUX DATAFILE ‘/home/oracle/oracle/product/10.2.0/oradata/sysaux.dbf’ SIZE 400 m REUSE
    DEFAULT TABLESPACE tbs_1 DATAFILE ‘/home/oracle/oracle/product/10.2.0/oradata/users.dbf’ SIZE 200m REUSE
AUTOEXTEND ON MAXSIZE UNLIMITED
    DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE ‘/home/oracle/oracle/product/10.2.0/oradata/temp_tbs.dbf’ SIZE 20m REUSE

    undo TABLESPACE undotbs DATAFILE ‘/home/oracle/oracle/product/10.2.0/oradata/undo01.dbf’ SIZE 200m REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
5. Run the scripts necessary to build views, synonyms, and PL/SQL packages
CONNECT / AS SYSDBA
SQL>@$ORACLE_HOME/rdbms/admin/catalog.sql
SQL>@$ORACLE_HOME/rdbms/admin/catproc.sql
 6. Shutdown the instance and startup the database. Your database is ready for use!


No comments: