-1

I just started a new contract and have run into an issue I have never encountered before.

Their Oracle database was started under a korn shell.

oracle:x:500:100:Oracle user:/home/oracle:/usr/bin/ksh

I have all my bash scripts, have no test environment and just love bash for day to day use.

I have tried calling bash from .profile, but that gets messy when scripts need environmental variables and another shell gets spun up.

Can I simply edit /etc/passwd and start a bash shell at login without affecting a running process?

  • The Oracle installation procedure has probably modified ~/.profile to set some environment variables and added a . oraenv line. You'll need to copy those lines to ~/.bash_profile – Mark Plotnick Jul 9 '18 at 23:38
4

The database itself would probably not use the login shell for very much.

The login shell does not restrict your use of bash for writing scripts. The #!-line in a script tells the shell what interpreter to use for running the script, and this can be bash or ksh or python or perl or whatever is appropriate for the particular script.

The only thing that this makes a difference for is what the login shell is when you log in as the oracle user, and wherever else the login shell might be used (you should read the manual for your Oracle database to see where this may be, but as far as I can see, ksh, bash and csh are all supported).

Personally, I would avoid changing the login shell and instead manually start an interactive bash shell from the command line, if this is the shell you'd like to use for interactive work as the oracle user.

2

I would recommend making a personal unix account for regular use (Where you can use bash) and only use the oracle account when needed; this will help you from any surprises that might come from changing the account (or invalidating docs Oracle may send you on how to do things). It probably won't break the running process if you change the shell, it just may lead to surprises down the line.

For most of the DDL/DML work you might want to do, you don't need to be the oracle user; you can use your personal account.

1

To precisely answer the question: sure, you could change oracle's shell without affecting current processes. I'd suggest chsh instead of editing /etc/passwd, though.

Consider cron (or otherwise-scheduled) jobs that expect to run as oracle in ksh. Consider also any jobs that are spawned from existing processes that expect to run ksh as their login shell.

A quick perusal of the Oracle® Database Quick Installation Guide 11g Release 1 (11.1) for Linux x86-64 indicates some support for shells other than ksh, but you would need to set up the required shell profiles accordingly.

I would recycle the application after such a change, to make sure you got everything.

It might just be easier to set up ~/.bashrc and/or ~/.bash_profile, then just type exec bash when you're working interactively.

  • 2
    The cron daemon usually uses /bin/sh unless the SHELL variable is explicitly set in the crontab. AFAIK, it will not use the user's login shell. – Kusalananda Jul 9 '18 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.