How to create and use alias command in linux for DBA related task

An alias is a short cut command for long command. We may type short alias name to run a longer command or sql script file.


$ alias shortName="custom command here"


Aliases can be creates as temporary or permanent. A temporary alias will use for existing session only and permanent alias will work any time for quick execution of command.


Temporary alias:-

$ alias  space='df -h'

$alias lg='sqlplus apps/apps'

To run the command not need to type log command just type lg to login in oracle database using apps credential.

[appltest@apps scripts]$ lg

SQL*Plus: Release 10.1.0.5.0 - Production on Fri Sep 25 19:32:36 2020

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> show user

USER is "APPS"

Permanent alias:-

To keep permanent alias we need to add below in .bash_profile.

$vi .bash_profile

. /oracle/apps/apps_st/appl/APPS*.env

alias stopall='$ADMIN_SCRIPTS_HOME/adstpall.sh apps/***** ;sleep 20;pkill -fu applmgr'

alias startall='$ADMIN_SCRIPTS_HOME/adstrtal.sh apps/*******'

:wg!



In case you need to shutdown the ebs . Here no need to execute environment variable , login and run adstrtall.sh. You just type stopall and startall as below.


$stopall   ---> To shutdown EBS services.
$startall  ---> To start EBS services.


No comments:

Post a Comment

Thanks for reading till end. I hope this will help you more to improve your knowledge.

Now it's your turn!

What do you think? Share your experience in the comments box and subscribe for more interesting post.