To connect to Oracle with sqplus you need to load the environment.
You need to use the .oraenv or .profile file to load the environments.
In this article I will describe how to create a .profile file.
You can use the “How To Connect To Oracle With sqlplus” article to connect to oracle with sqlplus.
First we go to the root directory using the cd command. Then we run the following command.
1 |
vi .profile.databasename |
After opening the file, you need to edit the following contents according to your system and add it to the file.
You can learn the parameters you need to fix by using the following script.
1 |
select * FROM V$DIAG_INFO; |
There are two parameters we can not learn from the script above. I also explained below how to find these parameters.
Instance_SID:
You can find Instance_SID with the command below.
1 |
ps -ef |grep pmon |
In the section after “pmon _” you can see the SID of the instances.
uniquename:
You can find ‘uniquename’ with the command below.
1 |
select name,db_unique_name from v$database; |
Here is the content of the .profile file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
export EDITOR=vi export ORACLE_BASE=basehome_path; export ORACLE_HOME=oraclehome_path; export ASM_HOME=asmhome_path; export CRS_HOME=crshome_path; export GRID_HOME=gridhome_path; #export NLS_LANG=AMERICAN_AMERICA.AL32UTF8; export NLS_LANG; LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/ctx/lib; export LD_LIBRARY_PATH PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_HOME/OPatch:$CRS_HOME/bin; export PATH LIBPATH=$ORACLE_HOME/lib; export LIBPATH alias oh='cd $ORACLE_HOME' alias gh='cd $GRID_HOME' alias crs='cd $CRS_HOME' alias oa='cd tracefile_path' export ORACLE_SID=Instance_SID; export ORACLE_UNQNAME=uniquename; |