Tuesday, September 18, 2012

STEPS TO CREATE ORACLE DATABASE MANUALLY ON LINUX



Step 1:
Prepare the database creation script. Following is my script "testdb.sql"

CREATE DATABASE TESTDB
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/opt/oracle/TESTDB/redo01.log'  SIZE 50M BLOCKSIZE 512,
  GROUP 2 '/opt/oracle/TESTDB/redo02.log'  SIZE 50M BLOCKSIZE 512,
  GROUP 3 '/opt/oracle/TESTDB/redo03.log'  SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
  '/opt/oracle/TESTDB/system01.dbf' SIZE 200M,
 '/opt/oracle/TESTDB/users01.dbf' SIZE 100M
sysaux datafile '/opt/oracle/TESTDB/sysaux01.dbf' SIZE 200M
undo tablespace undotbs1
datafile '/opt/oracle/TESTDB/undotbs01.dbf' SIZE 100M
CHARACTER SET WE8MSWIN1252
;

NOTE :  You can get this similar script , when you perform ‘ALTER DATABASE BACKUP CONTROLFILE TO TRACE’, we can edit this script.

Step 2:
Create all the necessary directories.
Oracle:/opt/oracle $ mkdir TESTDB
Similarly create all necessary directories 


Step 3:
Prepare the init file(pfile) [initTESTDB.ora]
TESTDB.__db_cache_size=436207616
TESTDB.__java_pool_size=4194304
TESTDB.__large_pool_size=4194304
TESTDB.__oracle_base='/opt/oracle'#ORACLE_BASE set from environment
TESTDB.__pga_aggregate_target=432013312
TESTDB.__sga_target=641728512
TESTDB.__shared_io_pool_size=0
TESTDB.__shared_pool_size=184549376
TESTDB.__streams_pool_size=0
*.audit_file_dest='/opt/oracle/admin/TESTDB/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/opt/oracle/TESTDB/control01.ctl','/opt/oracle/fra/TESTDB/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='TESTDB'
*.db_recovery_file_dest='/opt/oracle/fra'
*.db_recovery_file_dest_size=4227858432
*.diagnostic_dest='/opt/oracle/'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=TESTDBXDB)'
#*.local_listener='LISTENER_TESTDB'
*.memory_target=1073741824
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS'

Step 4:
Now perform the following steps:

$ export ORACLE_SID=TESTDB
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Thu May 22 17:35:28 2008
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL >
SQL> startup nomount  pfile=/u01/app/oracle/product/10.2.0/db_1/dbs/initTESTDB.ora
ORACLE instance started.
Total System Global Area 603979776 bytes
Fixed Size 1263176 bytes
Variable Size 167774648 bytes
Database Buffers 427819008 bytes
Redo Buffers 7122944 bytes
SQL> @testdb.sql
Database created.

Step 5:
So your database is created. Now just run the catalog.sql and catproc.sql scripts.
You will find the in $ cd $ORACLE_HOME/rdbms/admin

SQL> @$ORACLE_HOME/rdbms/admin/catalog.sql
SQL> @$ORACLE_HOME/rdbms/admin/catproc.sql

This will create all dictionary views, now verify

SQL> select name from v$database;
NAME
---------
TESTDB

Okay, now your database is ready to use.


0 comments:

Post a Comment

Auto Scroll Stop Scroll