Solve the Problem of invalid Oracle environment variables in Linux
When you maintain the Oracle database in Linux today, view the listener status and execute
# Lsnrctl status
Error:-bash: lsnrctl: command not found. This is not the case in the past. I thought about it for a moment and found the problem. I remotely log on to the server as the root user. When maintaining oracle, I directly su oracle. Although the user switches to oracle, however, the environment variable is still the root environment variable, so an environment variable error will be reported. The correct command is su-oracle, so that the environment variable will be switched to the oracle environment variable.
Let's take a look at the man page of the su command.
NAME
Su-run a shell with substitute user and group IDs
SYNOPSIS
Su [OPTION]... [-] [USER [ARG]...]
DESCRIPTION
Change the valid tive user id and group id to that
USER.
-,-L, -- login
Make the shell a login shell, clears all envvars
Before t for TERM, initializes HOME, SHELL, USER,
LOGNAME and PATH
...
A mere-implies-l. If USER not given, assume root.
After the-option is added, the environment variables except the term are cleared and the HOME, SHELL, USER, LOGNAME, and PATH are reinitialized.
So pay more attention to the details, especially in Linux. A little difference may lead to completely different results.