Today, when installing and deploying the Oracle environment in Linux, I found a command line mutation problem. In fact, I encountered it before using Linux, but I never paid attention to it, I have consulted relevant Linux developers and said that there is no problem, so I have never looked for the reason. This time, I deployed the Oracle environment several times in Linux because the environment configuration was not OK, which caused me to repeat several times. Although the configuration failed several times, however, I think this process is quite enjoyable. After all, it is not a bad thing to encounter problems, just as we do in our daily work. If it is always smooth sailing, our level will always be like this, the conclusion is that to constantly improve yourself, you need to learn through the process of discovering and solving problems. At last, you will find that you are experiencing a high volume.
Next let's take a look at what the Command Behavior in Linux will become-Bash-3.2 $: First, according to the Basic installation steps of Oracle, the following command:
[Root @ localhost ~] # Groupadd oinstall
[Root @ localhost ~] # Groupadd DBA
[Root @ localhost ~] # Cd/
[Root @ localhost/] # mkdir-P/u01/Oracle
[Root @ localhost/] # useradd-G oinstall-g dba-D/u01/Oracle
[Root @ localhost ~] # Passwd Oracle
Changing password for user oracle.
New UNIX password:
Bad password: it is based on a dictionary word
Retype new Unix Password:
Passwd: All authentication tokens updated successfully.
[Root @ localhost ~] # Su-Oracle
-Bash-3.2 $:
At this time, I found that-Bash-3.2 $: appeared after Oracle switching users. What does this mean, that is, the bash environment configuration is missing, note that when I create an oracle user, the default directory of Oracle is changed. useradd-G oinstall-G DBA-D/u01/Oracle, that is to say, if this directory is not changed, the new user usually specifies/home/Oracle/by default. Let's look at the files in the default directory, as follows:
[Root @ localhost ~] # Ll-
Total 2562348
Drwxr-x --- 14 Root 4096 Feb 15.
Drwxr-XR-x 24 Root 4096 Feb 15 21:28 ..
-RW ------- 1 Root 1224 Feb 15 21:26. bash_history
-RW-r -- 1 Root 24 Jan 6 2007. bash_logout
-RW-r -- 1 Root 191 Jan 6 2007. bash_profile
-RW-r -- 1 Root 176 Jan 6 2007. bashrc
-RW-r -- 1 Root 100 Jan 6 2007. cshrc
Let's take a look at the default directory after Oracle changes, as shown below:
[Root @ localhost ~] # Su-Oracle
[Oracle @ localhost ~] $ LS-
The directory is empty, and the problem is found, that is, the user environment configuration file is missing. Why does this file need to be related to the Linux mechanism, in Linux, every time a user is created through useradd, all configuration files are copied from/etc/skel to the Home Directory of the new user, generally, the new user's home directory under home is used by default, and the/etc/skel directory is mainly used by useradd.
Through the above parsing, it is not difficult to find out why the command becomes in bash format after the user switches, copy the/etc/skel user environment configuration file to the specified default directory, as shown below:
[Root @ localhost ~] # Su-Oracle
[Oracle @ localhost ~] $ LS-
... Bash_history. bash_logout. bash_profile. bashrc
[Oracle @ localhost ~] $
Now the command line is normal.