by Jeff Hunter, Sr. Database Administrator Article Translations: •
Contents Overview Configuring Oracle Cluster Synchronization Services (CSS) Creating the ASM Instance Identify RAW Devices Starting the ASM Instance Verify RAW / Logical Disk Are Discovered Creating Disk Groups Using Disk Groups Startup Scripts
Overview g g ggg
Configuring Oracle Cluster Synchronization Services (CSS) Oracle Cluster Synchronization Services Oracle Cluster Ready Services root.sh
groot.sh ggroot.sh $ORACLE_HOME/bin/localconfig%ORACLE_HOME%\bin\localconfig.batroot.sh $ su
# $ORACLE_HOME/bin/localconfig all /etc/oracle does not exist. Creating it now. Successfully accumulated necessary OCR keys. Creating OCR keys for user 'root', privgrp 'root'.. Operation successful. Configuration for local CSS has been initialized Adding to inittab Startup will be queued to init within 90 seconds. Checking the status of new Oracle init process... Expecting the CRS daemons to be up within 600 seconds. CSS is active on these nodes. linux3 CSS is active on all nodes. Oracle CSS service is installed and running under init(1M)
Database Configuration Assistantlocalconfig add gCustom installcustomroot.shroot.shlocalconfig add
Creating the ASM Instance +ASMgTESTDBoracle
Create Admin Directories adminORACLE_BASEadminTESTDB$ORACLE_BASE/admin/TESTDB+ASMTESTDB
UNIX mkdir mkdir mkdir mkdir mkdir
-p -p -p -p -p
$ORACLE_BASE/admin/+ASM/bdump $ORACLE_BASE/admin/+ASM/cdump $ORACLE_BASE/admin/+ASM/hdump $ORACLE_BASE/admin/+ASM/pfile $ORACLE_BASE/admin/+ASM/udump
Microsoft Windows mkdir mkdir mkdir mkdir mkdir
%ORACLE_BASE%\admin\+ASM\bdump %ORACLE_BASE%\admin\+ASM\cdump %ORACLE_BASE%\admin\+ASM\hdump %ORACLE_BASE%\admin\+ASM\pfile %ORACLE_BASE%\admin\+ASM\udump
Create Instance Parameter File init.ora$ORACLE_BASE/admin/+ASM/pfile
UNIX
$ORACLE_BASE/admin/+ASM/pfile/init.ora ########################################### # Automatic Storage Management ########################################### # _asm_allow_only_raw_disks=false # asm_diskgroups='TESTDB_DATA1' # Default asm_diskstring values for supported platforms: # Solaris (32/64 bit) /dev/rdsk/* # Windows NT/XP \\.\orcldisk* # Linux (32/64 bit) /dev/raw/* # HPUX /dev/rdsk/* # HPUX(Tru 64) /dev/rdisk/* # AIX /dev/rhdisk/* # asm_diskstring='' ########################################### # Diagnostics and Statistics ########################################### background_dump_dest=/u01/app/oracle/admin/+ASM/bdump core_dump_dest=/u01/app/oracle/admin/+ASM/cdump user_dump_dest=/u01/app/oracle/admin/+ASM/udump ########################################### # Miscellaneous ########################################### instance_type=asm compatible=10.1.0.4.0 ########################################### # Pools ########################################### large_pool_size=12M ########################################### # Security and Auditing ########################################### remote_login_passwordfile=exclusive
Microsoft Windows %ORACLE_BASE%\admin\+ASM\pfile\init.ora ########################################### # Automatic Storage Management ########################################### # _asm_allow_only_raw_disks=false # asm_diskgroups='TESTDB_DATA1' # Default asm_diskstring values for supported platforms: # Solaris (32/64 bit) /dev/rdsk/* # Windows NT/XP \\.\orcldisk* # Linux (32/64 bit) /dev/raw/* # HPUX /dev/rdsk/* # HPUX(Tru 64) /dev/rdisk/* # AIX /dev/rhdisk/* # asm_diskstring='' ###########################################
# Diagnostics and Statistics ########################################### background_dump_dest=C:\oracle\product\10.1.0\admin\+ASM\bdump core_dump_dest=C:\oracle\product\10.1.0\admin\+ASM\cdump user_dump_dest=C:\oracle\product\10.1.0\admin\+ASM\udump ########################################### # Miscellaneous ########################################### instance_type=asm compatible=10.1.0.4.0 ########################################### # Pools ########################################### large_pool_size=12M ########################################### # Security and Auditing ########################################### remote_login_passwordfile=exclusive $ORACLE_BASE/admin/+ASM/pfile/init.ora $ ln -s $ORACLE_BASE/admin/+ASM/pfile/init.ora $ORACLE_HOME/dbs/init+ASM.ora
Identify RAW Devices # ls -l /dev/raw/raw[1234] crw-rw---- 1 oracle dba 162, crw-rw---- 1 oracle dba 162, crw-rw---- 1 oracle dba 162, crw-rw---- 1 oracle dba 162,
1 2 3 4
Jun Jun Jun Jun
2 2 2 2
22:04 22:04 22:04 22:04
/dev/raw/raw1 /dev/raw/raw2 /dev/raw/raw3 /dev/raw/raw4
Attention Linux Users! /etc/init.d/oracleasm createdisk
Attention Windows Users! gasmtoolasmtool
Starting the ASM Instance
Attention Windows Users! ORADIM
UNIX # su - oracle $ ORACLE_SID=+ASM; export ORACLE_SID $ sqlplus "/ as sysdba" SQL> startup ASM instance started Total System Global Area 75497472 Fixed Size 777852 Variable Size 74719620 Database Buffers 0 Redo Buffers 0 ORA-15110: no diskgroups mounted
bytes bytes bytes bytes bytes
SQL> create spfile from pfile='/u01/app/oracle/admin/+ASM/pfile/init.ora'; SQL> shutdown ASM instance shutdown SQL> startup ASM instance started
Microsoft Windows C:\> oradim -new -asmsid +ASM -syspwd change_on_install -pfile C:\oracle\product\10.1.0\admin\+ASM\pfile\init.ora -spfile -startmode manual -shutmode immediate Instance created. C:\> oradim -edit -asmsid +ASM -startmode a C:\> set oracle_sid=+ASM C:\> sqlplus "/ as sysdba" SQL> startup pfile='C:\oracle\product\10.1.0\admin\+ASM\pfile\init.ora'; ASM instance started Total System Global Area 125829120 bytes Fixed Size 769268 bytes Variable Size 125059852 bytes Database Buffers 0 bytes Redo Buffers 0 bytes ORA-15110: no diskgroups mounted SQL> create spfile from pfile='C:\oracle\product\10.1.0\admin\+ASM\pfile\init.ora'; File created. SQL> shutdown ASM instance shutdown
SQL> startup ASM instance started ORA-15110: no diskgroups mounted asm_diskgroups
Verify RAW / Logical Disk Are Discovered asm_diskstringasm_diskstring
Operating System
Default Search String /dev/rdsk/* \\.\orcldisk* /dev/raw/* /dev/rdsk/* /dev/rdisk/* /dev/rhdisk/*
# ls -l /dev/raw/raw[1234] crw-rw---- 1 oracle dba 162, 1 Jun crw-rw---- 1 oracle dba 162, 2 Jun crw-rw---- 1 oracle dba 162, 3 Jun crw-rw---- 1 oracle dba 162, 4 Jun V$ASM_DISK $ ORACLE_SID=+ASM; export ORACLE_SID $ sqlplus "/ as sysdba"
2 2 2 2
22:04 22:04 22:04 22:04
/dev/raw/raw1 /dev/raw/raw2 /dev/raw/raw3 /dev/raw/raw4
SQL> SELECT group_number, disk_number, mount_status, header_status, state, path 2 FROM v$asm_disk GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU ------------ ----------- ------- -----------0 0 CLOSED CANDIDATE 0 1 CLOSED CANDIDATE 0 2 CLOSED CANDIDATE 0 3 CLOSED CANDIDATE
Creating Disk Groups disk groupTESTDB_DATA1NORMAL REDUNDANCY /dev/raw/raw 1 /dev/raw/raw
STATE -------NORMAL NORMAL NORMAL NORMAL
PATH --------------/dev/raw/raw1 /dev/raw/raw2 /dev/raw/raw3 /dev/raw/raw4
2 /dev/raw/raw 3 /dev/raw/raw 4 /dev/raw/raw 1 /dev/raw/raw 2 /dev/raw/raw3/dev/raw/raw4/dev/raw/raw1/dev/raw/raw2/dev/raw/raw3/dev/raw/raw4
SQL> CREATE DISKGROUP testdb_data1 NORMAL REDUNDANCY 2 FAILGROUP controller1 DISK '/dev/raw/raw1', '/dev/raw/raw2' 3 FAILGROUP controller2 DISK '/dev/raw/raw3', '/dev/raw/raw4'; Diskgroup created.
SQL> select group_number, name, total_mb, free_mb, state, type 2 from v$asm_diskgroup; GROUP_NUMBER NAME TOTAL_MB FREE_MB STATE TYPE ------------ -------------- ---------- ---------- ----------- -----1 TESTDB_DATA1 388 282 MOUNTED NORMAL SQL> select group_number, disk_number, mount_status, header_status, state, path, failgroup 2 from v$asm_disk; GROUP_NUMBER DISK_NUMBER MOUNT_S HEADER_STATU FAILGROUP ------------ ----------- ------- ----------------------1 0 CACHED MEMBER CONTROLLER1 1 1 CACHED MEMBER CONTROLLER1 1 2 CACHED MEMBER CONTROLLER2 1 3 CACHED MEMBER CONTROLLER2
Using Disk Groups TESTDB $ ORACLE_SID=TESTDB; export ORACLE_SID $ sqlplus "/ as sysdba" SQL> @dba_files_all
STATE
PATH
-------- --------------NORMAL
/dev/raw/raw1
NORMAL
/dev/raw/raw2
NORMAL
/dev/raw/raw3
NORMAL
/dev/raw/raw4
Tablespace Name File Class Filename File Size ----------------------------------------------------------------------------- -------------SYSAUX /u05/oradata/TESTDB/datafile/o1_mf_sysaux_19cv6mwk_.dbf 241,172,480 SYSTEM /u05/oradata/TESTDB/datafile/o1_mf_system_19cv5rmv_.dbf 471,859,200 TEMP /u05/oradata/TESTDB/datafile/o1_mf_temp_19cv6sy9_.tmp 24,117,248 UNDOTBS1 /u05/oradata/TESTDB/datafile/o1_mf_undotbs1_19cv6c37_.dbf 214,958,080 USERS /u05/oradata/TESTDB/datafile/o1_mf_users_19cv72yw_.dbf 5,242,880 [ CONTROL FILE ] /u03/oradata/TESTDB/controlfile/o1_mf_19cv5m84_.ctl [ CONTROL FILE ] /u04/oradata/TESTDB/controlfile/o1_mf_19cv5msk_.ctl [ CONTROL FILE ] /u05/oradata/TESTDB/controlfile/o1_mf_19cv5n34_.ctl [ ONLINE REDO LOG ] /u03/oradata/TESTDB/onlinelog/o1_mf_1_19cv5n8d_.log 10,485,760 [ ONLINE REDO LOG ] /u03/oradata/TESTDB/onlinelog/o1_mf_2_19cv5o6l_.log 10,485,760 [ ONLINE REDO LOG ] /u03/oradata/TESTDB/onlinelog/o1_mf_3_19cv5pdy_.log 10,485,760 [ ONLINE REDO LOG ] /u04/oradata/TESTDB/onlinelog/o1_mf_1_19cv5nbr_.log 10,485,760 [ ONLINE REDO LOG ] /u04/oradata/TESTDB/onlinelog/o1_mf_2_19cv5oml_.log 10,485,760 [ ONLINE REDO LOG ] /u04/oradata/TESTDB/onlinelog/o1_mf_3_19cv5pt4_.log 10,485,760 [ ONLINE REDO LOG ] /u05/oradata/TESTDB/onlinelog/o1_mf_1_19cv5nsf_.log 10,485,760 [ ONLINE REDO LOG ] /u05/oradata/TESTDB/onlinelog/o1_mf_2_19cv5p1b_.log 10,485,760 [ ONLINE REDO LOG ] /u05/oradata/TESTDB/onlinelog/o1_mf_3_19cv5q8j_.log 10,485,760 -------------sum 1,051,721,728
SQL> create tablespace users2 datafile '+TESTDB_DATA1' size 100m; Tablespace created. CREATE TABLESPACE+TESTDB_DATA1TESTDB_DATA1TESTDB SQL> @dba_files_all Tablespace Name File Class Filename File Size ----------------------------------------------------------------------------- -------------SYSAUX /u05/oradata/TESTDB/datafile/o1_mf_sysaux_19cv6mwk_.dbf 241,172,480 SYSTEM /u05/oradata/TESTDB/datafile/o1_mf_system_19cv5rmv_.dbf 471,859,200
TEMP 24,117,248 UNDOTBS1 214,958,080 USERS 5,242,880 USERS2 104,857,600 [ CONTROL FILE [ CONTROL FILE [ CONTROL FILE [ ONLINE REDO LOG 10,485,760 [ ONLINE REDO LOG 10,485,760 [ ONLINE REDO LOG 10,485,760 [ ONLINE REDO LOG 10,485,760 [ ONLINE REDO LOG 10,485,760 [ ONLINE REDO LOG 10,485,760 [ ONLINE REDO LOG 10,485,760 [ ONLINE REDO LOG 10,485,760 [ ONLINE REDO LOG 10,485,760
/u05/oradata/TESTDB/datafile/o1_mf_temp_19cv6sy9_.tmp /u05/oradata/TESTDB/datafile/o1_mf_undotbs1_19cv6c37_.dbf /u05/oradata/TESTDB/datafile/o1_mf_users_19cv72yw_.dbf +TESTDB_DATA1/testdb/datafile/users2.256.560031579 ] ] ] ]
/u03/oradata/TESTDB/controlfile/o1_mf_19cv5m84_.ctl /u04/oradata/TESTDB/controlfile/o1_mf_19cv5msk_.ctl /u05/oradata/TESTDB/controlfile/o1_mf_19cv5n34_.ctl /u03/oradata/TESTDB/onlinelog/o1_mf_1_19cv5n8d_.log
]
/u03/oradata/TESTDB/onlinelog/o1_mf_2_19cv5o6l_.log
]
/u03/oradata/TESTDB/onlinelog/o1_mf_3_19cv5pdy_.log
]
/u04/oradata/TESTDB/onlinelog/o1_mf_1_19cv5nbr_.log
]
/u04/oradata/TESTDB/onlinelog/o1_mf_2_19cv5oml_.log
]
/u04/oradata/TESTDB/onlinelog/o1_mf_3_19cv5pt4_.log
]
/u05/oradata/TESTDB/onlinelog/o1_mf_1_19cv5nsf_.log
]
/u05/oradata/TESTDB/onlinelog/o1_mf_2_19cv5p1b_.log
]
/u05/oradata/TESTDB/onlinelog/o1_mf_3_19cv5q8j_.log
-------------sum 1,156,579,328
Startup Scripts dboradboradbora/etc/init.d dbora$ORACLE_HOME/bin/dbstart$ORACLE_HOME/bin/dbshutinit/etc/oratab
Create dbora File dbora/etc/init.d
/etc/init.d/dbora # # # # #
+------------------------------------------------------------------------+ | FILE : dbora | | DATE : 09-AUG-2006 | | HOSTNAME : linux3.idevelopment.info | +------------------------------------------------------------------------+
# # # #
+---------------------------------+ | FORCE THIS SCRIPT TO BE IGNORED | +---------------------------------+ exit
# +---------------------------------+ # | PRINT HEADER INFORMATION | # +---------------------------------+ echo " " echo "+----------------------------------+" echo "| Starting Oracle Database Script. |" echo "| 0 : $0 |" echo "| 1 : $1 |" echo "+----------------------------------+" echo " " # +-----------------------------------------------------+ # | ALTER THE FOLLOWING TO REFLECT THIS SERVER SETUP | # +-----------------------------------------------------+ HOSTNAME=linux3.idevelopment.info ORACLE_HOME=/u01/app/oracle/product/10.1.0/db_1 SLEEP_TIME=120 ORACLE_OWNER=oracle DATE=`date "+%m/%d/%Y %H:%M"` export HOSTNAME ORACLE_HOME SLEEP_TIME ORACLE_OWNER DATE # +----------------------------------------------+ # | VERIFY THAT ALL NEEDED SCRIPTS ARE AVAILABLE | # | BEFORE CONTINUING. | # +----------------------------------------------+ if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]; then echo " " echo "+-------------------------------------+" echo "| ERROR: |" echo "| Oracle startup: cannot start |" echo "| cannot find dbstart |" echo "+-------------------------------------+" echo " " exit fi # +---------------------------+ # | START/STOP CASE STATEMENT | # +---------------------------+ case "$1" in start) echo echo echo echo echo echo echo
" " "+----------------------------------------+" "| ************************************** |" "| >>>>>>>>> START PROCESS <<<<<<<<<< |" "| ************************************** |" "+----------------------------------------+" " "
echo "Going to sleep for $SLEEP_TIME seconds..." sleep $SLEEP_TIME echo " " su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart" echo " "
echo echo echo echo echo
"+---------------------------------------------------+" "| About to start the listener process in |" "| $ORACLE_HOME |" "+---------------------------------------------------+" " "
su - $ORACLE_OWNER -c "lsnrctl start listener" touch /var/lock/subsys/dbora ;; stop) echo echo echo echo echo echo echo
" " "+----------------------------------------+" "| ************************************** |" "| >>>>>>>>>> STOP PROCESS <<<<<<<<<< |" "| ************************************** |" "+----------------------------------------+" " "
echo echo echo echo echo echo
" " "+-------------------------------------------------------+" "| About to stop the listener process in |" "| $ORACLE_HOME |" "+-------------------------------------------------------+" " "
su - $ORACLE_OWNER -c "lsnrctl stop listener" echo echo echo echo echo echo
" " "+-------------------------------------------------------+" "| About to stop all Oracle databases |" "| running. |" "+-------------------------------------------------------+" " "
su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut" rm -f /var/lock/subsys/dbora ;; *) echo $"Usage: $prog {start|stop}" exit 1 esac echo echo echo echo echo exit
" " "+----------------------+" "| ENDING ORACLE SCRIPT |" "+----------------------+" " "
dbora # chmod 755 dbora # chown root:root dbora # # # #
ln -s /etc/init.d/dbora /etc/rc5.d/S99dbora ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora ln -s /etc/init.d/dbora /etc/rc6.d/K10dbora exit
Modify oratab File /etc/oratabdbora+ASMTESTDBNY
... +ASM:/u01/app/oracle/product/10.1.0/db_1:Y TESTDB:/u01/app/oracle/product/10.1.0/db_1:Y ...
Modify /etc/inittab File /etc/inittabrespawninit.cssdbefore • • • • • • • • • • • • •
/etc/inittab (...) # System initialization. si::sysinit:/etc/rc.d/rc.sysinit
• • • • • • • • • • • • •
/etc/inittab (...) # System initialization. si::sysinit:/etc/rc.d/rc.sysinit
l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 l3:3:wait:/etc/rc.d/rc 3 l4:4:wait:/etc/rc.d/rc 4 l5:5:wait:/etc/rc.d/rc 5 l6:6:wait:/etc/rc.d/rc 6 (...) h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1
l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 h1:35:respawn:/etc/init.d/init.cssd run >/dev/null 2>&1
/etc/inittabinit.cssdbefore • • • • • •
• • • • • •
/etc/inittab (...) s2:23:wait:/sbin/rc2 >/dev/msglog s3:3:wait:/sbin/rc3 >/dev/msglog s5:5:wait:/sbin/rc5 >/dev/msglog (...) h1:3:respawn:/etc/init.d/init.cssd /etc/inittab (...) s2:23:wait:/sbin/rc2 >/dev/msglog h1:3:respawn:/etc/init.d/init.cssd s3:3:wait:/sbin/rc3 >/dev/msglog s5:5:wait:/sbin/rc5 >/dev/msglog (...)
2<>/dev/msglog /dev/msglog /dev/msglog /dev/null 2>&1
2<>/dev/msglog run >/dev/null 2<>/dev/msglog 2<>/dev/msglog
Bug: 3458327
&1
/etc/inittabinit.cssddbstartdbshutASM aware/etc/inittabdboraocssd.bin ORA-29701: unable to connect to Cluster Manager /etc/inittabinitS96init.cssdS99dbora /etc/rc5.d/S99dboradbora/etc/init.d/init.cssdlocalconfig allinit.cssd/etc/rc3.d/S96init.cssd sleep 120dboradboraocssd.bin