分类: Oracle
2008-07-17 11:55:23
Manually database creation is one of the more frequently performed actions of a professional DBA. And, with Oracle 11g it only takes a few minutes to do :)
The procedure is same as previous which we are used for 9i and 10g.
In this database creation I used below features:
1. OMF (Oracle Managed File) for datafiles, redolog files & controlfiles
2. FRA (Flash Recovery Area) for Archivelog or backup files
3. ASM (Automatic Storage Mgmt) for Volume manager
1. Create Required Directories
E:\>mkdir e:\oracle\ORA11G
NOTE: above directory is for TRACE FOLDER.
And for ASM I already created DGRP2 group for database.
2. Set Enviourment Variable (ORACLE_HOME,ORACLE_SID,PATH)
E:\>set ORACLE_HOME=c:\app\m.taj\product\11.1.0\db_1 E:\>set PATH=c:\app\m.taj\product\11.1.0\db_1\bin E:\>set ORACLE_SID=ora11g
3. Choose a Database Administrator Authentication Method
Two authentication method we can use.
1. Password Authentication method
For Password Authentication method we need to create PASSWORD file through ORAPWD utility.
2. OS Authentication method
For OS Authentication method OS user must be member of OS DBA Group.
And SQLNET.AUTHENTICATION_SERVICES= (NTS) is set in SQLNET.ORA file
NOTE: Here I used OS authentication Method.
3. Creating INIT.ORA parameter file
Set minimum required parameter in INIT.ora file.
Open NOTEPAD file and set below parameters
db_name = 'ORA11G' #Database name. db_create_file_dest='+DGRP2' #OMF configuration for Datafile,controlfile db_create_online_log_dest_1='+DGRP2' #OMF configuration for redolog file db_recovery_file_dest='+DGRP2' db_recovery_file_dest_size=10G #FRA (FLASH RECOVERY AREA configuration) diagnostic_dest='E:\ORACLE\ORA11G' #It is new feature with 11g for trace files (bdump,udump,cdump or many others #folder created in "DIAG" folder inside "e:\oracle\ora11g" folder.
4. Create an Instance
E:\>oradim -NEW -SID ora11g -STARTMODE auto Instance created.
5. Connect to an Instance
E:\>sqlplus /nolog SQL*Plus: Release 11.1.0.6.0 - Production on Thu May 1 18:04:30 2008 Copyright (c) 1982, 2007, Oracle. All rights reserved. SQL> conn / as sysdba Connected to an idle instance.
6. Create Server Parameter file (SPFILE)
SQL> create SPFILE from PFILE='c:\temp\init.TXT'; File created.
7. Start the Instance
SQL> startup nomount ORACLE instance started. Total System Global Area 150667264 bytes Fixed Size 1331740 bytes Variable Size 92278244 bytes Database Buffers 50331648 bytes Redo Buffers 6725632 bytes
8. Create Database
SQL> create database ORA11G; Database created.
9. Create Temporary and Additional Tablespace
SQL> create temporary tablespace TEMP TEMPFILE '+DGRP2' size 5m; Tablespace created. SQL> create tablespace USERDATA DATAFILE '+DGRP2' size 5m; Tablespace created. SQL> alter database default temporary tablespace TEMP; Database altered. SQL> alter database default tablespace USERDATA; Database altered.
10. Run Scripts to build data dictionary views
SQL> @%ORACLE_HOME%/rdbms/admin/catalog.sql SQL> @%ORACLE_HOME%/rdbms/admin/catproc.sql SQL> @%ORACLE_HOME%/sqlplus/admin/pupbld.sql
11. Change Database Mode from NO-ARCHIVELOG to ARCHIVELOG.
SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL> startup mount ORACLE instance started. Total System Global Area 150667264 bytes Fixed Size 1331740 bytes Variable Size 92278244 bytes Database Buffers 50331648 bytes Redo Buffers 6725632 bytes Database mounted. SQL> alter database ARCHIVELOG; Database altered. SQL> alter database OPEN; Database altered.
NOTE: It is recommended to run database in ARCHIVELOG MODE
12. Check all database files how is look in ASM :)
SQL> select NAME from v$datafile 2 union all 3 select NAME from v$controlfile 4 union all 5 select MEMBER from v$logfile; NAME -------------------------------------------------- +DGRP2/ora11g/datafile/system.281.653595347 +DGRP2/ora11g/datafile/sysaux.280.653595371 +DGRP2/ora11g/datafile/sys_undots.279.653595393 +DGRP2/ora11g/datafile/userdata.273.653595537 +DGRP2/ora11g/controlfile/current.285.653595303 +DGRP2/ora11g/onlinelog/group_1.283.653595305 +DGRP2/ora11g/onlinelog/group_2.282.653595325 7 rows selected.