Sie sind auf Seite 1von 8

ASM HANDS-ON TRAINING

Server Environment Settings and Aliases


Alejandro Vargas | Principal Support Consultant
Oracle Advanced Customer Services

INDEX

Summary.......................................................................................................................................................................2
Available Aliases...........................................................................................................................................................2
.cshrc sections...............................................................................................................................................................5
Environment variables...................................................................................................................................................5
Change and Check Environment..................................................................................................................................5
Instances.......................................................................................................................................................................5
Change Directory..........................................................................................................................................................6
Command shortcuts......................................................................................................................................................6
Start aliases...................................................................................................................................................................6
Stop aliases...................................................................................................................................................................7
Tail traces......................................................................................................................................................................7

1/8
ASM HANDS-ON TRAINING
Server Environment Settings and Aliases

Summary

The server where the labs of this seminar will work is configured with tcsh as the default oracle user shell. A .cshrc file
containing several aliases was setup to easy moving around and executing repetitive commands.

On this document there is a general explanation of how the environment can be used.

Available Aliases

At any moment you can type what to get this list of available aliases:

Aliases To Frequently Used Commands

Point Oracle Home to Version

10g
11g
------------------------------------------------------------------------------------
Display environment information

ora
------------------------------------------------------------------------------------
Change both the ORACLE_HOME and ORACLE_SID

asm
sati
sati11
sati12

2/8
ASM HANDS-ON TRAINING
Server Environment Settings and Aliases
------------------------------------------------------------------------------------
Move to frequently used directories

cdo cd $ORACLE_HOME
dbs cd $ORACLE_HOME/dbs
tns cd $ORACLE_HOME/network/admin
bkp cd /u01/app/oracle/BACKUP/sati11
swb cd /home/oracle/bin/swing2.3/swingbench/bin
osw cd /home/oracle/bin/osw/archive
------------------------------------------------------------------------------------
Execute frequently used commands

sql : execute sqlplus


emstart : start dbconsole
emstat : status dbconsole
emstop : stop dbconsole
oras : /etc/init.d/oracleasm
asmc : asmcmd
asmap : display mapping of ASM disks to physical devices
asmchk : go to menu of ASM scripts
swingbench : execute swingbench
oswg : execute OS Watcher on graphic mode
what : show this list of aliases
------------------------------------------------------------------------------------
Start instances

startasm :/home/oracle/START-STOP/startasm
startsati :/home/oracle/START-STOP/startsati
startsati11 :/home/oracle/START-STOP/start11 sati11
startsati12 :/home/oracle/START-STOP/start11 sati12
startdbc :/home/oracle/START-STOP/startdbc (start Database Control)

3/8
ASM HANDS-ON TRAINING
Server Environment Settings and Aliases
startlsnr :/home/oracle/START-STOP/startlsnr
startall :/home/oracle/START-STOP/startall
------------------------------------------------------------------------------------
Stop instances

stopasm :/home/oracle/START-STOP/stopasm
stopsati :/home/oracle/START-STOP/stopsati
stopsati11 :/home/oracle/START-STOP/stop11 sati11
stopsati12 :/home/oracle/START-STOP/stop11 sati12
stopdbc :/home/oracle/START-STOP/stopdbc (stop Database Control)
stoplsnr :/home/oracle/START-STOP/stoplsnr
stopall :/home/oracle/START-STOP/stopall
------------------------------------------------------------------------------------
Tail alertlogs of databases and ASM

alertsati11 :tail -f /u01/app/oracle/diag/rdbms/sati11/sati11/trace/alert_sati11.log


alertsati12 :tail -f /u01/app/oracle/diag/rdbms/sati12/sati12/trace/alert_sati12.log
alertsati :tail -f
alertasm :tail -f /u01/app/oracle/diag/asm/+ASM/trace/diag/asm/+asm/
+ASM/trace/alert_+ASM.log
------------------------------------------------------------------------------------

4/8
ASM HANDS-ON TRAINING
Server Environment Settings and Aliases

.cshrc sections

Environment variables
#!/bin/tcsh
# ------------------------------------------------------------------
# Environment variables
# ------------------------------------------------------------------
setenv HOME11g /u01/app/oracle/11g_db
setenv HOME10g /u01/app/oracle/10g_db
setenv ORACLE_BASE /u01/app/oracle
setenv ORACLE_HOME ${HOME11g}
setenv BASE_PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/java/jre1.5.0_10/bin:/home/oracle/bin:/sbin:/usr/sbin:/etc/init.d:/home/oracle/ASM-
SCRIPTS:/home/oracle/CRASH-AND-RECOVERY-SCRIPTS:/home/oracle/RMAN-SCRIPTS:/home/oracle/SQL-SCRIPTS:/home/oracle/START-
STOP:/home/oracle/SWBENCH:/home/oracle/ASM-SCRIPTS/CHECK-ASM:/home/oracle/bin/AMDU
setenv PATH ${ORACLE_HOME}/bin:${ORACLE_HOME}/OPatch:${BASE_PATH}

Change and Check Environment


# ------------------------------------------------------------------------
# Change and Check Environment
# ------------------------------------------------------------------------
alias ora 'clear;echo -------------;env|grep ORA;echo -------------;ps -efa|grep smon|grep -v grep;\
echo -------------;ps -efa|grep tns|grep -v grep;echo -------------;'
alias 10g 'setenv ORACLE_HOME ${HOME10g};setenv ORACLE_SID sati;setenv PATH ${ORACLE_HOME}/bin:${ORACLE_HOME}/OPatch:${BASE_PATH};ora'
alias 11g 'setenv ORACLE_HOME ${HOME11g};setenv ORACLE_SID sati11;setenv PATH ${ORACLE_HOME}/bin:${ORACLE_HOME}/OPatch:$
{BASE_PATH};ora'

Instances
# ------------------------------------------------------------------
# Instances
# ------------------------------------------------------------------
alias asm '11g;setenv ORACLE_SID +ASM; clear; ora'
alias sati '10g;setenv ORACLE_SID sati; clear; ora'
alias sati11 '11g;setenv ORACLE_SID sati11; clear; ora'

5/8
ASM HANDS-ON TRAINING
Server Environment Settings and Aliases
alias sati12 '11g;setenv ORACLE_SID sati12; clear; ora'

Change Directory
# ------------------------------------------------------------------
# Change Directory
# ------------------------------------------------------------------
alias cdo 'cd $ORACLE_HOME'
alias dbs 'cd $ORACLE_HOME/dbs'
alias tns 'cd $ORACLE_HOME/network/admin'
alias bkp 'cd /u01/app/oracle/BACKUP/sati11'
alias swb 'cd /home/oracle/bin/swing2.3/swingbench/bin; ls'
alias osw 'cd /home/oracle/bin/osw/archive;clear;ls -ltr'
alias av 'cd;source .cshrc'

Command shortcuts
# ------------------------------------------------------------------
# Command shortcuts
# ------------------------------------------------------------------
alias sql 'sqlplus / as sysdba'
alias emstart 'clear;ora; echo -------;emctl start dbconsole'
alias emstat 'clear;emctl status dbconsole;echo'
alias emstop 'clear;emctl stop dbconsole;echo'
alias oras '/etc/init.d/oracleasm'
alias asmc '11g;setenv ORACLE_SID +ASM;clear;asmcmd'
alias asmap 'chkasmmapf'
alias asmchk 'cd /home/oracle/ASM-SCRIPTS/CHECK-ASM; ./chk'
alias swingbench 'setenv DISPLAY :0;cd /home/oracle/bin/SWBENCH/swing2.3/swingbench/bin;./swingbench'
alias oswg 'setenv DISPLAY :0; setenv PATH $ORACLE_HOME/jdk/bin:$BASE_PATH; clear; java -jar /home/oracle/bin/osw/oswg.jar -i
/home/oracle/bin/osw/archive'
alias what 'cd; clear; more ./what'

Start aliases
# ------------------------------------------------------------------
# Start aliases
# ------------------------------------------------------------------
alias startasm '/home/oracle/START-STOP/startasm'
alias startsati '/home/oracle/START-STOP/startsati'
alias startsati11 '/home/oracle/START-STOP/start11 sati11'
alias startsati12 '/home/oracle/START-STOP/start11 sati12'

6/8
ASM HANDS-ON TRAINING
Server Environment Settings and Aliases
alias startdbc '/home/oracle/START-STOP/startdbc'
alias startlsnr '/home/oracle/START-STOP/startlsnr'
alias startall '/home/oracle/START-STOP/startall'

Stop aliases
# ------------------------------------------------------------------
# Stop aliases
# ------------------------------------------------------------------
alias stopasm '/home/oracle/START-STOP/stopasm'
alias stopsati '/home/oracle/START-STOP/stopsati'
alias stopsati11 '/home/oracle/START-STOP/stop11 sati11'
alias stopsati12 '/home/oracle/START-STOP/stop11 sati12'
alias stopdbc '/home/oracle/START-STOP/stopdbc'
alias stoplsnr '/home/oracle/START-STOP/stoplsnr'
alias stopall '/home/oracle/START-STOP/stopall'

Tail traces
# ------------------------------------------------------------------
# Tail traces
# ------------------------------------------------------------------
setenv v_par v\$parameter
alias alertsati11 'tail -f /u01/app/oracle/diag/rdbms/sati11/sati11/trace/alert_sati11.log'
alias alertsati12 'tail -f /u01/app/oracle/diag/rdbms/sati12/sati12/trace/alert_sati12.log'
alias alertsati 'tail -f '
alias alertasm 'tail -f /u01/app/oracle/diag/asm/+ASM/trace/diag/asm/+asm/+ASM/trace/alert_+ASM.log'
# ------------------------------------------------------------------
# eof .cshrc
# ------------------------------------------------------------------

7/8
ASM HANDS-ON TRAINING
Server Environment Settings and Aliases

End of Document

8/8

Das könnte Ihnen auch gefallen