Thursday, March 20, 2014

Oracle: Create New Database

Login as oracle
$ export ORACLE_SID=BMP

$ cat initBMP.ora

db_name='BMP'
memory_target=1G
processes = 150
audit_file_dest='/usr2/app/oracle/admin/BMP/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/usr2/app/oracle/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/usr2/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=BMPXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
control_files = (/dbfs/BMP/ora_control1, /dbfs/BMP/ora_control2)
compatible ='11.1.0'

$cat newBMP.sql
CREATE DATABASE BMP
   USER SYS IDENTIFIED BY think4me
   USER SYSTEM IDENTIFIED BY think4me
   LOGFILE GROUP 1 ('/dbfs/BMP/redo01.log') SIZE 100M,
           GROUP 2 ('/dbfs/BMP/redo02.log') SIZE 100M,
           GROUP 3 ('/dbfs/BMP/redo03.log') SIZE 100M
   MAXLOGFILES 5
   MAXLOGMEMBERS 5
   MAXLOGHISTORY 1
   MAXDATAFILES 100
   CHARACTER SET US7ASCII
   NATIONAL CHARACTER SET AL16UTF16
   EXTENT MANAGEMENT LOCAL
   DATAFILE '/dbfs/BMP/system01.dbf' SIZE 325M REUSE
   SYSAUX DATAFILE '/dbfs/BMP/sysaux01.dbf' SIZE 325M REUSE
   DEFAULT TABLESPACE users
      DATAFILE '/dbfs/BMP/users01.dbf'
      SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
   DEFAULT TEMPORARY TABLESPACE tempts1
      TEMPFILE '/dbfs/BMP/temp01.dbf'
      SIZE 20M REUSE
   UNDO TABLESPACE undotbs1
      DATAFILE '/dbfs/BMP/undotbs01.dbf'
      SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

$ mkdir /dbfs/BMP
$ export ORACLE_SID=BMP
$ sqlplus / as sysdba

SQL> create SPFILE FROM PFILE;
SQL> startup nomount
SQL> @/var/tmp/oracle/newBMP.sql
SQL> shutdown immediate
SQL> startup
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size                  2235208 bytes
Variable Size             616563896 bytes
Database Buffers          444596224 bytes
Redo Buffers                5541888 bytes
Database mounted.
Database opened.

Create password file in $ORACLE_HOME/dbs
$ orapwd file=orapwBMP entries=10

Run Scripts to Build Data Dictionary Views

SQL> CONNECT / AS SYSDBA
SQL> spool /var/tmp/bmp.log
SQL> @/u01/oracle/rdbms/admin/catalog.sql
SQL> @/u01/oracle/rdbms/admin/catproc.sql
SQL> spool off
SQL> EXIT
 
 
Reference: http://docs.oracle.com/cd/B19306_01/server.102/b14231/create.htm 

No comments:

Post a Comment