Thursday, 29 August 2019

How to connect to sqlplus in linux

To connect in linux server where your DB is installed follow as below

1) First you should know your oracle home as we required to SET this in linux server.

We can find easily Oracle_home using below query.

 select SYS_CONTEXT ('USERENV','ORACLE_HOME') from dual;











2) Connect to Linux server (Where DB is installed) using Putty or any other Tool which you prefer


sh-4.2$ export ORACLE_HOME=/scratch/oraofss/app_18c/product/18.3.0.0/dbhome_1
sh-4.2$ export PATH=/scratch/oraofss/app_18c/product/18.3.0.0/dbhome_1/bin

sh-4.2$ sqlplus user_name/password@Oracle_Database
















Refer screenshot, Its connected to SQL.

How to KILL EXPDP JOB

When we are doing export, After some time , we dont want to continue Export Dump now so we terminated .

Usually we need to KILL job manually as it runs in background if we just assume that we terminated with CTL+C in command prompt.

Just run below query to cross verify whether your job is running currently or not.

SELECT owner_name, job_name, operation, job_mode, state FROM dba_datapump_jobs;








In My case there 1 job is in  "running" status, so now i need to kill those jobs as i don't required.

So first Note down job name from above query and then do as follows:

Step 1:

type expdp attch=<job_name>  // here job name which we identified from above query
and then it will prompt for schema credentials where this job is running as below.




Once you had provided credentials , it will come to Export prompt as below 

Step 2:

type "KILL_JOB" and provide Yes for "Are you sure you wish to stop this job". It will take some time to KILL JOB.








Parallelly, we can verify in below query to check whether its Killed or not.

SELECT owner_name, job_name, operation, job_mode, state FROM dba_datapump_jobs