Orace 11gr2 DB Creation in ASM -Script

vi inittilak.ora
db_name=nijam
COMPATIBLE=11.2.0
diagnostic_dest=’/home/oracle/oradata/tilak/dump/’
control_files=’+DG1′
sga_max_size=1500M
sga_target=512M
undo_management=AUTO
undo_tablespace=UNDOTBS
db_create_online_log_dest_1=’+DG1′
db_create_file_dest=’+DG1′

vi create.sql
CREATE DATABASE nijam
DATAFILE ‘+DG1’ SIZE 1000M
SYSAUX DATAFILE ‘+DG1’ SIZE 1000M
DEFAULT TEMPORARY TABLESPACE TEMP TEMPFILE ‘+DG1’ SIZE 1000M
UNDO TABLESPACE “UNDOTBS” DATAFILE ‘+DG1’ SIZE 1000M
LOGFILE
GROUP 1 ‘+DG1’ SIZE 10M,
GROUP 2 ‘+DG1’ SIZE 10M;

$ cd $ORACLE_HOME/dbs
vi init+asm.ora

instance_name=+asm
instance_type=asm
asm_diskgroups=DG1, FRA

Step by Step Process to Create Single Instance Database using DBCA with screen shot

1. Launch DBCA and Choose Database Operation:Launch DBCA by executing dbca command on unix prompt. If DBCA is not executing, Set appropriate Environment variables.


[oracle@database ~] dbca 



Image


This is just a welcome screen, User need not to give any input on this other than click on “Next“. 


Image


 Since, We have only Oracle Database S/W installed i.e. no grid Software So we will see only single instance related operations on the welcome screen. Though, Grid Software also has option to create Single instance database.



2. Choose Type of Database: Here, DBA has to choose which type of database he wants to create. There are not so much differences. I am going with default option “General Purpose or Transaction purpose“. 


Image


Click on “Next” after choosing the database type.


3. Provide Instance Name for Database:  Database Instance name is the unique name give to the database on database host machine. i.e. you can’t have more than one database with same SID. The length of SID should not be more that 8 characters. 


Image


Global Database Name is database name with it’s domain name. I choose database name as “newdb” and domain name for organization is oracle.com so the Global Database Name would be “newdb.oracle.com”.


4. Database Control Configuration: This step give you detail about configuring database with database control.


Image


Let it be with default option and move forward by clicking “Next“. 


5. Password for Sys and System user: Provide password for sys, system and DBSNMP user. Make sure you follow Oracle password policy otherwise you will see warning, though you can move forward by bypassing that warning.


Image

I am giving same password for all listed accounts, DBA can easily change these passwords in future if needed. 



6. Database Files Location Details:  We are using flat file system to store all database related files and “File System”  is default storage type chosen. So let’s move forward with default option.


Image 

 Click “Next” button.


7. Provide Recovery Configuration: Database administrator has to provide Database recovery path details in this step. Default location is $ORACL_BASE/fast_revoery_aren. DBA can also enable archive log by clicking “Enable Archiving“.

Image

 DBA can also change Recovery area size by giving appropriate input into Fast Recovery Area Size text box. I face a small challenge during this step show below. 

Image

DBA has to either reduce Fast Recovery Area Size in above input box or get some more free space at provided OS location. Click “Next” after filling these details.


8. Database Content Setting: If you want some sample schema to be installed in your database then click on “Sample Schemas check box and this will install HumanResources, Order entry and Product Media like schemas into the database. 

Image

 If DBA has to configure some scripts which automatically run after database creation In that case DBA can give their detail at Custom Scripts tab on this page.
 Image

After configuring all these Click on “Next” to move forward.


9. Initialization Parameter Inputs: If you wants to change some initialization parameter like SGA Size, PGA size, Database block size, Number of process, Character set and Connection mode use this GUI to do so. DBA can also change these value after database creation. 
Image 

Change required parameters or go with default setting and click “Next”.

  

10 Database Storage Summary: This page will show DBA database storage summary, You can expend a tree in the left panel of this Screen. This page doesn’t need any input for DBA.
Image

Click “Next” to move forward.
11. Database Creation Options: Here you will find three options Create Database(default), Save as a database Template and Generate Database Creation Scripts.


Create database will create a database only for this time.

Save database template will save this template for future use, In future DBA can use same template for database creation and this template will have all customizations done by Database Administrator. 
Generate Database Creation Scripts will create a script for database creation which can can execute manually as well.


Database administrator can chose multiple options at one time or all options as well. Here, I am just creating a database.


Image 

Click “Finish” to move forward. This will show you a summary of database going to create. 


Image

Click on “OK” button. Next database creation will start automatically. see below screen.
Image
Database creation will take around 15 to 20 Minutes, Database Administrator can also see the Percentage of work done using above screen. One this process is done you will see a password management screen like below.
Image
 If you want’s to unlock few uses Click “Password Management” and provide password for user or you can do this manually after database creation. DBA can also see log files for database creation at location given in this screen “/etc/oracle/cfgtoollogs/dbca/newdb“. Here You are done with RAC database creation with DBCA.
Now, check if you database is working or not using below unix command. This will list the database running by name newdb.
ps -ef | grep newdb
To create database using DBCA, Database Administrator need GUI access of the system, but in some cases which is not possible. In that situation DBA can use Manual Database Creation Script.

Since DBA has created database, Next step would be configure Listener.ora and Tnsname.ora to access database from outside. DBA can use Quick Steps to Configure Tnsnames.ora and Listener.ora file.

Create 12c database manually create using script method

OS version:
[root@O12c pfile]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
[root@O12c pfile]#

Database version:
[oracle@O12c ~]$ sqlplus
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jul 18 07:35:10 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 – 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

Create following directory on server and give permission to oracle user and oinstall group.
[root@O12c cdb1]#mkdir -p /u01/app/oracle/admin/orcl/dpdump
[root@O12c cdb1]#mkdir -p /u01/app/oracle/admin/orcl/adump
[root@O12c cdb1]#mkdir -p /u01/app/oracle/admin/orcl/pfile
[root@O12c cdb1]#mkdir -p /u01/app/oracle/oradata/orcl/controlfile
[root@O12c cdb1]#mkdir -p/u01/app/oracle/fast_recovery_area/orcl/controlfile/
[root@O12c cdb1]#chomd 775 /u01/app/oracle/
[root@O12c cdb1]#chown oracle:oinstall /u01/app/oracle/

Create pfile(init_orcl.ora) in pfile directory
[root@O12c cdb1]$ cd /u01/app/oracle/admin/orcl/pfile

[root@O12c pfile]$ vi init_orcl.ora
##############################################################################
# Copyright (c) 1991, 2013 by Oracle Corporation
##############################################################################
###########################################
# Cache and I/O
###########################################
db_block_size=8192
###########################################
# Cursors and Library Cache
###########################################
open_cursors=300
###########################################
# Database Identification
###########################################
db_domain=””
db_name=”orcl”
###########################################
# File Configuration
###########################################
db_create_file_dest=”/u01/app/oracle/oradata”
db_recovery_file_dest=”/u01/app/oracle/fast_recovery_area”
db_recovery_file_dest_size=4800m
###########################################
# Miscellaneous
###########################################
compatible=12.1.0.0.0
diagnostic_dest=/u01/app/oracle
###########################################
# Processes and Sessions
###########################################
processes=300
###########################################
# SGA Memory
###########################################
sga_target=1269m
###########################################
# Security and Auditing
###########################################
audit_file_dest=”/u01/app/oracle/admin/orcl/adump”
audit_trail=db
remote_login_passwordfile=EXCLUSIVE
###########################################
# Shared Server
###########################################
dispatchers=”(PROTOCOL=TCP) (SERVICE=cdb1XDB)”
###########################################
# Sort, Hash Joins, Bitmap Indexes
###########################################
pga_aggregate_target=423m
###########################################
# System Managed Undo and Rollback Segments
###########################################
undo_tablespace=UNDOTBS1
control_files=(“/u01/app/oracle/oradata/orcl/controlfile/o1_mf_bsmgyw36_.ctl”,
“/u01/app/oracle/fast_recovery_area/orcl/controlfile/o1_mf_bsmgyw7v_.ctl”)

Set ORACLE_SID variable
[oracle@O12c dbs]$ export ORACLE_SID=orcl
[oracle@O12c dbs]$ echo $ORACLE_SID
orcl
[oracle@O12c dbs]$

Create password file
[oracle@O12c dbs]$orapwd file=/u01/app/oracle/product/12.1.0.2/db_1/dbs/orapworcl password=Admin entries=10
[oracle@O12c dbs]$ cd /u01/app/oracle/product/12.1.0.2/db_1/dbs
[oracle@O12c dbs]$ ls -ltr
total 32
-rw-r–r– 1 oracle oinstall 2992 Feb 3 2012 init.ora
-rw-rw—- 1 oracle oinstall 1544 Jul 6 04:48 hc_cdb1.dat
-rw-r—– 1 oracle oinstall 24 Jul 6 04:48 lkCDB1
-rw-r—– 1 oracle oinstall 7680 Jul 6 04:51 orapwcdb1
-rw-r—– 1 oracle oinstall 3584 Jul 18 07:30 spfilecdb1.ora
-rw-r—– 1 oracle oinstall 7680 Jul 18 08:41 orapworcl

Login to database
[oracle@O12c dbs]$ sqlplus
SQL*Plus: Release 12.1.0.1.0 Production on Sat Jul 18 08:46:42 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Enter user-name: /as sysdba
Connected to an idle instance.

SQL> create spfile from pfile=’/u01/app/oracle/admin/orcl/pfile/init_orcl.ora’;
File created.

SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1336176640 bytes
Fixed Size 2288104 bytes
Variable Size 469763608 bytes
Database Buffers 855638016 bytes
Redo Buffers 8486912 bytes

SQL>@DBcreation.sql;
Database created.

Create database script (DBcreation.sql)..
[root@O12c ~]# cd /u01/app/oracle/product/12.1.0.2/db_1/dbs

[root@O12c dbs]# vi DBcreation.sql
CREATE DATABASE orcl
USER SYS IDENTIFIED BY sys_password
USER SYSTEM IDENTIFIED BY system_password
LOGFILE GROUP 1 (‘/u01/app/oracle/oradata/orcl/redo01a.log’,’/u01/app/oracle/oradata/orcl/redo01b.log’) SIZE 100M BLOCKSIZE 512,
GROUP 2 (‘/u01/app/oracle/oradata/orcl/redo02a.log’,’/u01/app/oracle/oradata/orcl/redo02b.log’) SIZE 100M BLOCKSIZE 512,
GROUP 3 (‘/u01/app/oracle/oradata/orcl/redo03a.log’,’/u01/app/oracle/oradata/orcl/redo03b.log’) SIZE 100M BLOCKSIZE 512
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 1024
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE ‘/u01/app/oracle/oradata/orcl/system01.dbf’
SIZE 700M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SYSAUX DATAFILE ‘/u01/app/oracle/oradata/orcl/sysaux01.dbf’
SIZE 550M REUSE AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
DEFAULT TABLESPACE users
DATAFILE ‘/u01/app/oracle/oradata/orcl/users01.dbf’
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE ‘/u01/app/oracle/oradata/orcl/temp01.dbf’
SIZE 20M REUSE AUTOEXTEND ON NEXT 640K MAXSIZE UNLIMITED
UNDO TABLESPACE UNDOTBS1
DATAFILE ‘/u01/app/oracle/oradata/orcl/undotbs01.dbf’
SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
USER_DATA TABLESPACE usertbs
DATAFILE ‘/u01/app/oracle/oradata/orcl/usertbs01.dbf’
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

—> Run below script for build database scripts
SQL>@/u01/app/oracle/product/12.1.0.2/db_1/rdbms/admin/catalog.sql;
(Creates the views of the data dictionary tables, the dynamic performance views,
And public synonyms for many of the views. Grants PUBLIC access to the synonyms)

SQL>@/u01/app/oracle/product/12.1.0.2/db_1/rdbms/admin/catproc.sql;
(Runs all scripts required for or used with PL/SQL.)

SQL> alter user system
2 identified by manager;
User altered.

SQL> alter user system account unlock;
User altered.

SQL>conn system/manager
Connected.
SQL>

SQL>@/u01/app/oracle/product/12.1.0.2/db_1/sqlplus/admin/pupbld.sql;
(Required for SQL*Plus. Enables SQL*Plus to disable commands by user.)

—> Bounce the database
SQL> startup force;
ORACLE instance started.
Total System Global Area 1336176640 bytes
Fixed Size 2288104 bytes
Variable Size 469763608 bytes
Database Buffers 855638016 bytes
Redo Buffers 8486912 bytes
Database mounted.
Database opened.

SQL> select name from v$database;
NAME
———
ORCL
1 row selected.

SQL> select file_name from dba_data_files;
FILE_NAME
——————————————————————————–
/u01/app/oracle/oradata/orcl/system01.dbf
/u01/app/oracle/oradata/orcl/sysaux01.dbf
/u01/app/oracle/oradata/orcl/undotbs01.dbf
/u01/app/oracle/oradata/orcl/users01.dbf
/u01/app/oracle/oradata/orcl/usertbs01.dbf
5 rows selected.

–>Create extra tablespace..

SQL>CREATE TABLESPACE apps_tbs LOGGING
DATAFILE ‘/u01/app/oracle/oradata/orcl/apps01.dbf’
SIZE 500M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;
Tablespace created.



— Create a tablespace for indexes, separate from user tablespace (optional)
SQL> CREATE TABLESPACE indx_tbs LOGGING
DATAFILE ‘/u01/app/oracle/oradata/orcl/indx01.dbf’
SIZE 100M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;
Tablespace created.

SQL> select NAME from v$tablespace;
NAME
——————————
SYSTEM
SYSAUX
UNDOTBS1
TEMPTS1
USERS
USERTBS
APPS_TBS
INDX_TBS
8 rows selected.
SQL>
Note:- database is a simple database not container database

Creating Oracle 11g Database manually

Creating Database in 11g is very simple.In 10g you need to create additional
directories bdump,cdump,udump instead of diagnostic dump directory.Below are the
steps:

Step 1:Create Directory structure with Oracle ownership and permission as below:

[oracle@localhost ~]$ cd /u03

[oracle@localhost u03]$ mkdir testdb

[oracle@localhost u03]$ chmod -R 777 /u03/testdb/*

[oracle@localhost u03]$ chown -R oracle:oinstall /u03/testdb/*

[oracle@localhost testdb]$ mkdir adump diag flash_recovery_area

[oracle@localhost u03]$ chmod -R 777 /u03/testdb/*

[oracle@localhost u03]$ chown -R oracle:oinstall /u03/testdb/*

Step 2:Create Parameter file in $ORACLE_HOME/dbs location:

[oracle@localhost testdb]$ cd $ORACLE_HOME/dbs

[oracle@localhost dbs]$ vi init_testdb.ora

db_name=’testdb’
memory_target=1G
processes = 150
audit_file_dest=’/u03/testdb/adump’
audit_trail =’db’
db_block_size=8192
db_domain=”
db_recovery_file_dest=’/u03/testdb/flash_recovery_area’
db_recovery_file_dest_size=2G
diagnostic_dest=’/u03/testdb/diag’
dispatchers='(PROTOCOL=TCP) (SERVICE=testdb)’
open_cursors=300
remote_login_passwordfile=’EXCLUSIVE’
undo_tablespace=’UNDOTBS1′
# You may want to ensure that control files are created on separate physical
# devices
control_files = (/u03/testdb/ora_control1.ctl,/u03/testdb/ora_control2.ctl)
compatible =’11.2.0′

Step 3:Prepare Create Database script :

[oracle@localhost u03]$ cd /u03/testdb/

[oracle@localhost testdb]$ vi createdb_shaik.sql

CREATE DATABASE testdb
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXDATAFILES 100
MAXINSTANCES 1
LOGFILE
GROUP 1 ‘/u03/testdb/redo1.log’ SIZE 10M,
GROUP 2 ‘/u03/testdb/redo2.log’ SIZE 10M,
GROUP 3 ‘/u03/testdb/redo3.log’ SIZE 10M
DATAFILE
‘/u03/testdb/system.dbf’ size 200M REUSE
sysaux datafile ‘/u03/testdb/sysaux.dbf’ size 100m
undo tablespace UNDOTBS1
datafile ‘/u03/testdb/undo1.dbf’ size 100m
DEFAULT TEMPORARY TABLESPACE temp1
TEMPFILE ‘/u03/testdb/temp01.dbf’
SIZE 100M REUSE
CHARACTER SET AL32UTF8
;
:wq

Step 4:Set the Oracle ENVIRONMENT and SID of Database in the Operating System:

[root@localhost testdb]# su – oracle

[oracle@localhost ~]$ vi .bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_SID=orcl
export TNS_ADMIN=/u01/app/oracle/product/11.2.0/dbhome_1/network/admin

:wq
[oracle@localhost ~]$ . .bash_profile
     This will set the Oracle Environment variables in Unix-based operating system.

[oracle@localhost ~]$export ORACLE_SID=testdb
     This will set the SID of the current Database in Unix-based operating system.

Step 5:Create the Password file.

[oracle@localhost ~]$orapwd file=$ORACLE_HOME/dbs/orapwtestdb
password=Oracle entries=10

Step 6:Create server parameter file.

[oracle@localhost dbs]$ sqlplus “/as sysdba”

SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 28 14:08:02 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL>create spfile from pfile=’$ORACLE_HOME/dbs/init_testdb.ora’;

step 7:Start the Database in nomount State.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 1071333376 bytes
Fixed Size                  1341312 bytes
Variable Size             620759168 bytes
Database Buffers          444596224 bytes
Redo Buffers                4636672 bytes
SQL> select status from v$instance;

STATUS
————
STARTED

Note:Common issue memory_target not supported,refer the below link for resolving:

http://rafioracledba.blogspot.in/2011/06/ora-00845-memorytarget-not-supported-on.html

Step 8:Execute Create Database script created in Step 3

SQL> @/u03/testdb/createdb_shaik.sql

Database created

Step 9:Execute the catalog.sql,catproc.sql and pupbld.sql scripts:
a)catalog.sql =>Creates dictionary tables and views
b)catproc.sql =>Creates PL/SQL procedures,functions and packages necessary.
c)pupbld.sql  =>Creates user profiles.

So our database is created. Now just run the catalog.sql,catproc.sql and pupbld.sql
scripts.
WE will find catalog.sql and catproc.sql in $ORACLE_HOME/rdbms/admin path and
pupbld.sql in $ORACLE_HOME/sqlplus/admin path.

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

SQL>@$ORACLE_HOME/sqlplus/admin/pupbld.sql

SQL> alter user system identified by manager;

User altered.

SQL> conn system
Enter password:
Connected.
SQL> @$ORACLE_HOME/sqlplus/admin/pupbld.sql
DROP SYNONYM PRODUCT_USER_PROFILE
             *
ERROR at line 1:
ORA-01434: private synonym to be dropped does not exist

  DATE_VALUE FROM PRODUCT_USER_PROFILE
                  *
ERROR at line 3:
ORA-00942: table or view does not exist

DROP TABLE PRODUCT_USER_PROFILE
           *
ERROR at line 1:
ORA-00942: table or view does not exist

ALTER TABLE SQLPLUS_PRODUCT_PROFILE ADD (LONG_VALUE LONG)
*
ERROR at line 1:
ORA-00942: table or view does not exist

Table created.

DROP TABLE PRODUCT_PROFILE
           *
ERROR at line 1:
ORA-00942: table or view does not exist

DROP VIEW PRODUCT_PRIVS
*
ERROR at line 1:
ORA-00942: table or view does not exist

View created.

Grant succeeded.

DROP PUBLIC SYNONYM PRODUCT_PROFILE
                    *
ERROR at line 1:
ORA-01432: public synonym to be dropped does not exist

Synonym created.

DROP SYNONYM PRODUCT_USER_PROFILE
             *
ERROR at line 1:
ORA-01434: private synonym to be dropped does not exist

Synonym created.

DROP PUBLIC SYNONYM PRODUCT_USER_PROFILE
                    *
ERROR at line 1:
ORA-01432: public synonym to be dropped does not exist

Synonym created.

Step 10:Verify the Dictionary views created.

SQL> select name from v$database;

Step 11:Change the Database mode from noarchive log to archive log mode
Changing to archive log mode:

——————————–

SQL> archive log list
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     1
Current log sequence           3
SQL> shut immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 1071333376 bytes
Fixed Size                  1341312 bytes
Variable Size             620759168 bytes
Database Buffers          444596224 bytes
Redo Buffers                4636672 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> select status from v$instance;

STATUS
————
MOUNTED

SQL> alter database open;

Database altered.

SQL> select status from v$instance;

STATUS
————
OPEN

SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     1
Next log sequence to archive   3
Current log sequence           3

step by step configure oracle asm 10Gg using vmware linux platform and manual db creation using script(shell script) mode

1)vm–>setting–>hard disk–>add–>create virual disk–>click independent–>5gb–>finish

2) add more disk and restart server
  #init 6

 fdisk /dev/sdb
 fdisk /dev/sdc
 fdisk /dev/sdd
 fdisk /dev/sde

3)#n–>p–>1–>w
4)#fdisk -l
5)mkdir raw
vi /etc/sysconfig/rawdevices
/dev/raw/raw1  /dev/sdb1
/dev/raw/raw2  /dev/sdc1
/dev/raw/raw3  /dev/sdd1
/dev/raw/raw4  /dev/sde1

6)#service rawdevices restart
chown oracle:oinstall /dev/raw/raw*
chmod 755 /dev/raw/raw*

7)
vi /etc/rc.local
chown oracle:oinstall /dev/raw/raw*
chmod 755 /dev/raw/raw*

8)check raw devices
[root@teng raw]# ls -lrt /dev/raw
total 0
crwxr-xr-x 1 oracle oinstall 162, 1 May 15 07:18 raw1
crwxr-xr-x 1 oracle oinstall 162, 2 May 15 07:18 raw2
crwxr-xr-x 1 oracle oinstall 162, 3 May 15 07:18 raw3
crwxr-xr-x 1 oracle oinstall 162, 3 May 15 07:18 raw4

9) just download and run below rpm for asm disk creation befor that u need to check ur
vm->setting->option->shared_folder ->ok
#cp  -r /mnt/hgfs/ASMLib/ /home/oracle/
#cd /home/oracle/ASMLib/
#cd /media/Enterprise\ Linux\ dvd\ 20100405/Server/
rpm -Uvh oracleasm-support-2.1.3-1.el5.i386.rpm
rpm -Uvh oracleasmlib-2.0.4-1.el5.i386.rpm
rpm -Uvh oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpm

10)/etc/init.d/oracleasm configure

Default user to own the driver interface []: oracle
Default group to own the driver interface []: oinstall
Start Oracle ASM library driver on boot (y/n) [n]:
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
Dropping Oracle ASMLib disks:                              [  OK  ]
Shutting down the Oracle ASMLib driver:                    [  OK  ]
[root@teng raw]# ps -ef|grep oracleasm
root     27230  4673  0 12:58 pts/1    00:00:00 grep oracleasm
[root@teng raw]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets (‘[]’).  Hitting without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface [oracle]: oracle
Default group to own the driver interface [oinstall]:
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver:                     [  OK  ]
Scanning the system for Oracle ASMLib disks:
                                                           [  OK  ]
#init 6

 11)#
/etc/init.d/oracleasm createdisk disk1 /dev/sdb1
/etc/init.d/oracleasm createdisk disk2 /dev/sdc1
/etc/init.d/oracleasm createdisk disk3 /dev/sdd1
/etc/init.d/oracleasm createdisk disk4 /dev/sde1

   
Marking disk “disk1” as an ASM disk:                       [  OK  ]

[root@teng raw]# /etc/init.d/oracleasm listdisks
DISK1
DISK2
DISK3
DISK4

12) for css initialize
[root@teng ~]# cd /u01/app/oracle/product/10.2.0/db_1/bin
[root@teng bin]# ./localconfig add

13)check status of css
[root@teng bin]# ps -ef |grep css

14) #init 6

15)10g asm initialization file creation

cd $ORACLE_HOME/dbs
vi init+ASM.ora

instance_name=+ASM
instance_type=asm
asm_diskgroups=’DG1′

16) startup 10g asm instance
export ORACLE_SID=+ASM
sqlplus / as sysdba
startup
ASM instance started

Total System Global Area   79691776 bytes
Fixed Size                  1217812 bytes
Variable Size              53308140 bytes
ASM Cache                  25165824 bytes
ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup “DG1”

solution:-
SQL> create diskgroup DG1 external redundancy disk ‘/dev/raw/raw1’ size 5114m;

Diskgroup created.

SQL>FOR NORMAL
create diskgroup DG1 normal redundancy
failgroup FG1 disk ‘/dev/raw/raw1′,’/dev/raw/raw2’ size 5114m
failgroup FG2 disk ‘/dev/raw/raw3′,’/dev/raw/raw4’ size 5114m;

Diskgroup created.

17)SQL> shut immediate;
ASM diskgroups dismounted
ASM instance shutdown

18)SQL> startup;
ASM instance started
Total System Global Area   79691776 bytes
Fixed Size                  1217812 bytes
Variable Size              53308140 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted

19)FOR NORMAL
SQL> select name, state, type, total_mb, free_mb from v$asm_diskgroup;

NAME                           STATE       TYPE     TOTAL_MB    FREE_MB
—————————— ———– —— ———- ———-
DG1                            MOUNTED     NORMAL      20456      20350

SQL> create tablespace tbs datafile ‘+dg1’ size 10m;

Tablespace created.

20)Listing client databases
The following command shows all the database instances connected to the ASM instance.
SQL> select INSTANCE_NAME,STATUS,SOFTWARE_VERSION,COMPATIBLE_VERSION from v$asm_client;

INSTANCE_NAME        STATUS       SOFTWARE_VERSION     COMPATIBLE_VERSION
——————– ———— ——————– ——————–
kfc                  CONNECTED    10.2.0.1.0           10.2.0.0.0

SQL>  select name, path, mode_status, state, disk_number from v$asm_disk;

NAME                 PATH                           MODE_ST STATE    DISK_NUMBER
——————– —————————— ——- ——– ———–
                     ORCL:DISK1                     ONLINE  NORMAL             4
                     ORCL:DISK2                     ONLINE  NORMAL             5
                     ORCL:DISK3                     ONLINE  NORMAL             6
                     ORCL:DISK4                     ONLINE  NORMAL             7
DG1_0000             /dev/raw/raw1                  ONLINE  NORMAL             0
DG1_0001             /dev/raw/raw2                  ONLINE  NORMAL             1
FG12_0001            /dev/raw/raw4                  ONLINE  NORMAL             1
FG12_0000            /dev/raw/raw3                  ONLINE  NORMAL             0

8 rows selected.

…………………………………………………………………………………….
IF U DON’T WANT TO OCCUR THIS BELOW ERROR IN 15’TH STEP
U NEED USE THIS BELOW SCRIPT INSTEAD OF 15’TH STEP

ORA-15032: not all alterations performed
ORA-15063: ASM discovered an insufficient number of disks for diskgroup “DG1”

15’TH SCRIPT STEP

export ORACLE_SID=+ASM
sqlplus / as sysdba
startup nomount;
create diskgroup DG1 external redundancy disk ‘/dev/raw/raw1’ size 5114m;
shut immediate;
startup;
………………………………………………………………………………………
21) SCRIPT MODE 10G ASM MANUAL DB CREATTION

vi db.sh
mkdir kfc
cd kfc
mkdir admin oradata
cd admin
mkdir pfile adump bdump cdump udump
cd ..  
cd oradata
mkdir control log archive data
cd        
cp /home/oracle/pf /home/oracle/kfc/admin/pfile/initkfc.ora
cd
export ORACLE_SID=kfc
sqlplus / as sysdba <<eof
startup pfile=’/home/oracle/kfc/admin/pfile/initkfc.ora’ nomount;
create database kfc
datafile ‘+DG1’ size 400m
sysaux datafile ‘+DG1’ size 300m
logfile group 1 ‘+DG1’ size 10m,
        group 2 ‘+DG1’ size 10m;
@?/rdbms/admin/catalog.sql;
@?/rdbms/admin/catproc.sql;
create spfile from pfile=’/home/oracle/kfc/admin/pfile/initkfc.ora’;

vi pf
db_name=kfc
sga_target=600m
compatible=10.2.0
control_files=’+DG1′
audit_file_dest=’/home/oracle/kfc/admin/adump’
core_dump_dest=’/home/oracle/kfc/admin/cdump’
background_dump_dest=’/home/oracle/kfc/admin/bdump’
user_dump_dest=’/home/oracle/kfc/admin/udump’

22)run the db creation script this will create db.
sh db.sh

23)
note:-

SQL> show parameter control_file

NAME                                 TYPE        VALUE
———————————— ———– ——————————
control_file_record_keep_time        integer     7
control_files                        string      +DG1/kfc1/controlfile/current.
                                                 271.913266591, +DG1/kfc1/contr
                                                 olfile/current.270.913266593

SQL> create spfile from pfile=’/home/oracle/kfc/admin/pfile/initkfc.ora’;

File created.

SQL> create pfile from spfile;

File created.

24) restart the db will get the below error
SQL> startup force;
ORACLE instance started.

Total System Global Area  629145600 bytes
Fixed Size                  1220964 bytes
Variable Size             171970204 bytes
Database Buffers          452984832 bytes
Redo Buffers                2969600 bytes
ORA-00205: error in identifying control file, check alert log for more info

solution:-

SQL> alter system set control_files=’+DG1/kfc/controlfile/current.257.913439613′ scope
  2
SQL> alter system set control_files=’+DG1/kfc/controlfile/current.257.913439613′ scope=spfile;

System altered.

SQL>
SQL> startup force;
ORACLE instance started.

Total System Global Area  629145600 bytes
Fixed Size                  1220964 bytes
Variable Size             171970204 bytes
Database Buffers          452984832 bytes
Redo Buffers                2969600 bytes
Database mounted.
Database opened.

25)if ur server is shut down when restart u need to  run below
[root@teng ~]# cd /u01/app/oracle/product/10.2.0/db_1/bin/
[root@teng bin]# ./localconfig add

——>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>—————->>>>>>>>>>>>>>>>>>>>>>>>—————–

[oracle@teng ~]$ . .bash_profile
[oracle@teng ~]$ export ORACLE_SID=+ASM
[oracle@teng ~]$ asmcmd
ASMCMD> ls
DG1/
ASMCMD> DG1
        commands:
        ——–
        cd
        du
        find
        help
        ls
        lsct
        lsdg
        mkalias
        mkdir
        pwd
        rm
        rmalias
ASMCMD> cd DG1
ASMCMD> ls
KFC/
ASMCMD> cd kfc
ASMCMD> ls
CONTROLFILE/
DATAFILE/
ONLINELOG/
ASMCMD> cd controlfile
ASMCMD> ls
Current.256.917583353
Current.262.918355715
Current.267.918358463
Current.272.918365263
Current.276.918365369
ASMCMD>