• No results found

Create the database

In document Oracle DBA (Page 32-39)

Step 1 Set your ORACLE_SID

export ORACLE_SID=INDIAN

Step 2 Create a minimal init.ora ( In Default Location -$ORACLE_HOME/dbs/init<sid>.ora) control_files = +DB_DATA undo_management = AUTO db_name = test db_block_size = 8192 sga_max_size = 1073741824 sga_target = 1073741824 db_create_file_dest = +DB_DATA db_create_online_log_dest_1 = +DB_DATA

Step 3 Create a password file

$ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/pwd<sid>.ora password=oracle entries=5

Step 4 Start the instance

sqlplus / as sysdba startup nomount

Step 5 Create the database

create database indian

character set WE8ISO8859P1 national character set utf8 undo tablespace undotbs1

default temporary tablespace temp;

Step 6 Run catalog and catproc @?/rdbms/admin/catalog.sql @?/rdbms/admin/catproc.sql

(Implement ASM Enable Database on Solaris)

Now we are ready to implement ASM Instance on Solaris. We divided all task in following Section:

Section A: Install Oracle binaries

Section B: Prepare Disk for ASM (Read Adding Disk/ Create Partition in Solaris section) Section C: Set ownership of Disk

Section D: Create ASM Instance – Manually Section E: Create ASM Enable Database

SECTION-A Install Oracle binaries Go to page 20.

SECTION - B Prepare Disk for ASM Take help of System Administrator

SECTION - C Set ownership of Disk

Default owner is root:sys needs to be changed to oracle:dba .We need to set oracle:dba ( here oracle is a Oracle owner and dba is a group) ownership of the disk. As root we have take partition s0 of disk (c0d1s0 and c1d1s0)

Check ownership of Disk. Execute following command as a root user. bash-3.00# ls -lhL /dev/rdsk/c0d1s0

crw-r--- 1 root sys 118, 64 Feb 16 02:10 /dev/rdsk/c0d1s0 bash-3.00# ls -lhL /dev/rdsk/c1d1s0

crw-r--- 1 root sys 118, 64 Feb 16 02:10 /dev/rdsk/c1d1s0 bash-3.00# chown oracle:dba /dev/rdsk/c0d1s0

bash-3.00# chown oracle:dba /dev/rdsk/c1d1s0

SECTION - D Create ASM Instance (Manually) Step 1 If CSS service is not there; create it by executing the following batch file: $<ORACLE_HOME/bin/localconfig add

Important: Cluster Synchronization Services (CSS) is required to enable synchronization

between an Automatic Storage Management (ASM) instance and the database instances. Step 2 Create Admin Directories

$mkdir /oracle/ASM/bdump $mkdir /oracle/ASM/cdump $mkdir /oracle/ASM/udump

$mkdir /oracle/ASM/pfile

Step 3 Create ASM Instance Parameter file. In /oracle/ASM/pfile directory INSTANCE_TYPE=ASM DB_UNIQUE_NAME=+ASM LARGE_POOL_SIZE=16M BACKGROUND_DUMP_DEST = '/oracle/ASM/bdump' USER_DUMP_DEST=‘/oracle/ASM/udump‘ CORE_DUMP_DEST = '/oracle/ASM/cdump' ASM_DISKGROUPS='DB_DATA' ASM_DISKSTRING =‘/dev/rdsk/*‘ Important:

If you do not want to use above parameter just set only one parameter INSTANCE_TYPE=ASM. ASM instance will start with default values for other parameters.

Bellow I am giving you 5 key parameter that you must configure for ASM instance. INSTANCE_TYPE

DB_UNIQUE_NAME

ASM_POWER_LIMIT (Indicate the maximum speed to be used by this ASM instance during a disk rebalancing operation. Default is 1 and the range 1 to 11)

ASM_DISKSTRING (set the disk location for oracle to consider during a disk-discovery process)

ASM_DISKGROUP (specify the name of any disk group that you want the ASM instance to automatically mount at instance startup)

ASM instance uses the LARGE_POOL_SIZE memory buffer. We should allocate at least 8MB .

Step 4 Creating ASM Instance $export ORACLE_SID=+ASM $sqlplus /nolog

SQL> connect / as sysdba

SQL> startup nomount pfile='/oracle/ASm/pfile/init+ASM.ora'

IMPORTANT: We can find error "ORA-29701: unable to connect to Cluster Manager" at the time of ASM instance startup. The Cause of error is Connect to CM failed or timed out. Just delete the CM local configuration and add local configuration by using. /localconfig delete and. /localconfig add command. This shall script is reside in $ORACLE_HOME/bin directory.

Let's start by determining if Oracle can find these four new disks: The view V$ASM_DISK can be queried from the ASM instance to determine which disks are being used or may potentially be used as ASM disks.

$export oracle_sid=+ASM $sqlplus "/ as sysdba"

SQL> SELECT group_number, disk_number, mount_status, header_status, state, path FROM v$asm_disk

Note:

The value of zero in the GROUP_NUMBER column for all four disks. This indicates that a disk is available but hasn't yet been assigned to a disk group.

Using SQL*Plus, the following will create a disk group with normal redundancy and two failure groups:

SQL> CREATE DISKGROUP DB_DATA NORMAL REDUNDANCY FAILGROUP controller1 DISK ' c0d1s0'

FAILGROUP controller2 DISK ' c1d1s0'; Diskgroup created.

Step 6 ALTER DISKGROUP ALL MOUNT;

Now your ASM Instance has been created. Restart the ASM Instance. SECTION - E Create (OMF) Database Step 1 Set your ORACLE_SID

export ORACLE_SID=INDIAN

Step 2 Create a minimal init.ora ( In Default Location -$ORACLE_HOME/dbs/init<sid>.ora) control_files = +DB_DATA undo_management = AUTO db_name = test db_block_size = 8192 sga_max_size = 1073741824 sga_target = 1073741824 db_create_file_dest = +DB_DATA db_create_online_log_dest_1 = +DB_DATA

Step 3 Create a password file

$ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/pwd<sid>.ora password=oracle entries=5

Step 4 Start the instance

sqlplus / as sysdba startup nomount

Step 5 Create the database

create database indian

character set WE8ISO8859P1 national character set utf8 undo tablespace undotbs1

default temporary tablespace temp;

Step 6 Run catalog and catproc @?/rdbms/admin/catalog.sql @?/rdbms/admin/catproc.sql

(Implement Database on Linux RAW Device) Now we will implement database on Linux RAW Device.

How we will achieve this:

 We will use the entire /dev/sdb hard drive for the Oracle database.

 Next, we will create an LVM Physical Volume called /dev/pv1 for the entire /dev/sdb hard drive.

 Next, we will create an LVM Volume Group.

 After creating the LVM Volume Group, then we will create an LVM Logical Volume for each datafile, controlfile, and online redo log file for our new database.

 Next , we bind the RAW devices to LVM Logical Volume Step 1 Removing Any Partitions on Hard Drive

# dd if=/dev/zero of=/dev/sdb bs=1K count=1 1+0 records in

1+0 records out

# blockdev --rereadpt /dev/sdb

At this point, you should have a hard drive recognized as /dev/sdb with no partitions Step 2 Create the LVM Physical Volume

We will create an LVM Physical Volume called /dev/pv1 for the entire hard disk /dev/sdb. pvcreate /dev/sdb

pvcreate -- physical volume "/dev/sdb" successfully created Step 3 Create the LVM Volume Group

We will create an LVM Volume Group that will contain the LVM Physical Volume /dev/pv1. # vgcreate -l 256 -p 256 -s 128k /dev/vg1 /dev/sdb

vgcreate -- volume group "vg1" successfully created and activated Step 4 Create Logical Volumes for database

Now we create all of the Logical Volumes that will be used to house all of the Oracle database files.

# lvcreate –L 15m /dev/vg1 #Control File 1 lvcreate -- logical volume "lvol0" successfully created

# lvcreate –L 15m /dev/vg1 #Control File 2 lvcreate -- logical volume "lvol1" successfully created

# lvcreate –L 15m /dev/vg1 #Control file 3 lvcreate -- logical volume "lvol2" successfully created

# lvcreate –L 20m /dev/vg1 # Redo group 1 lvcreate -- logical volume "lvol3" successfully created

# lvcreate –L 20m /dev/vg1 # redo group 2 lvcreate -- logical volume "lvol4" successfully created

# lvcreate –L 20m /dev/vg1 #Redo group 3 lvcreate -- logical volume "lvol5" successfully created

# lvcreate –L 500m /dev/vg1 # System tablesapce lvcreate -- logical volume "lvol6" successfully created

# lvcreate –L 500m /dev/vg1 #SysAux Tablesapce lvcreate -- logical volume "lvol7" successfully created

# lvcreate –L 1024m /dev/vg1 #UNDO lvcreate -- logical volume "lvol8" successfully created

# lvcreate –L 1024m /dev/vg1 #TEMP lvcreate -- logical volume "lvol9" successfully created Step 5 Create RAW Bindings

# vgchange -a y /dev/vg1

vgchange -- volume group "vg1" successfully activated # /usr/bin/raw /dev/raw/raw1 /dev/vg1/lvol0 # /usr/bin/raw /dev/raw/raw2 /dev/vg1/lvol1 # /usr/bin/raw /dev/raw/raw3 /dev/vg1/lvol2 # /usr/bin/raw /dev/raw/raw4 /dev/vg1/lvol3 # /usr/bin/raw /dev/raw/raw5 /dev/vg1/lvol4 # /usr/bin/raw /dev/raw/raw6 /dev/vg1/lvol5 # /usr/bin/raw /dev/raw/raw7 /dev/vg1/lvol6 # /usr/bin/raw /dev/raw/raw8 /dev/vg1/lvol7 # /usr/bin/raw /dev/raw/raw9 /dev/vg1/lvol8

# /usr/bin/raw /dev/raw/raw10 /dev/vg1/lvol9

Step 6 modify ownership on RAW Devices

In document Oracle DBA (Page 32-39)