I have been busy with projects recently and encountered a very tangled problem in the process. Other shell scripts can be called only after the shell script training database is executed. Here we will summarize and share it with you.
The script is as follows:
The shell script is as follows:
#! /Bin/sh
SQL _dir =/home/Tang/Tek/SQL/Tek
Shell_dir =/home/Tang/Tek/SH/Tek
Log_dir =/home/Tang/Tek/logs
./Home/Tang/. bash_profile
# $ Shell_dir/runsql. sh/home/Tang/Tek/SH/Tek/test. SQL> test.txt
Log_check = 1
Checkcount = 0
While [[$ log_check-Ne 0]; do
Newlog_check = 'sqlplus-S/nolog username/password @ Sid <-EOF
Set heading off feedback Off pages 0
Select count (*)
From Tek. admin_user Sn
Where SN. Name is null
Exit
EOF'
Log_check = $ newlog_check
Echo "Log check value is:" $ log_check
Let checkcount = $ checkcount + 1
If [$ checkcount-GT 2]; then
Sqlplus-S/nolog username/password @ Sid <-EOF
Update Tek. user_info BM set BM. Name = 0 where BM. Name = 'tangpengtao ';
Commit;
Exit
EOF
Let checkcount = 0
Fi
Echo $ checkcount
# Sleep for 3 seconds. Further training
Sleep 3
Done
. $ Shell_dir/TPT. Sh
Install a client in Linux. The procedure is as follows:
1. Create a user
# Groupadd DBA
# Useradd-D/usr/local/Oracle-g dba Oracle
# Passwd Oracle
2. decompress the software
# Gunzip ship_9204_linux_disk1.cpio.gz
# Gunzip ship_9204_linux_disk2.cpio.gz
# Gunzip ship_9204_linux_disk3.cpio.gz
# Cpio-idvm <ship_9204_linux_disk1.cpio
# Cpio-idvm <ship_9204_linux_disk2.cpio
# Cpio-idvm <ship_9204_linux_disk3.cpio
# Cp-RF disk1/usr/local/Oracle
# Cp-RF disk2/usr/local/Oracle
# Cp-RF disk3/usr/local/Oracle
3. Patch
# Unzip p3006854_9204_linux.zip
# Cp-RF 3006854/usr/local/Oracle
# Sh/usr/local/Oracle/3006854/rhel3_pre_install.sh
4. Configure Oracle user environment variables
$ VI. bash_profile:
#. Bash_profile
# Get the aliases and functions
If [-f ~ /. Bashrc]; then
.~ /. Bashrc
Fi
# User specific environment and startup programs
Path = $ path: $ home/bin
Export path
# Oracle
Export ld_assume_kernel = 2.4.1
Export oracle_base =/home/ora/ora9
Export ORACLE_HOME =/home/ora/ora9/Oracle
Export ora_nls33 = $ ORACLE_HOME/ocommon/NLS/admin/Data
# Nouse
Export oracle_sid = unixdb
Export oracle_term = xterm
Export tns_admin = $ ORACLE_HOME/Network/admin
Export nls_lang = american_america.us7ascii
# Lib, Class
LD_LIBRARY_PATH = $ ORACLE_HOME/lib:/usr/lib
LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/usr/local/lib
Export LD_LIBRARY_PATH
Export Path = $ path: $ ORACLE_HOME/bin
Classpath = $ classpath: $ ORACLE_HOME/JRE: $ ORACLE_HOME/jlib: $ ORACLE_HOME/rdbms/jlib
Classpath = $ classpath: $ ORACLE_HOME/Network/jlib
Export classpath
Unset Username
5. Install
# Xhost +
# Su-Oracle
$ Unset Lang
$ Disk1/runinstaller
6. Prompt operation on the GUI
# Sh orainstroot. Sh
# Sh/usr/local/Oracle/orahome1/root. Sh
7. Edit Configuration
# Vi/usr/local/Oracle/orahome1/Network/admin/sqlnet. ora
Sqlnet. authentication_services = (CNT)
Names. directory_path = (tnsnames, onames, hostname)
# Vi/usr/local/Oracle/orahome1/Network/admin/tnsnames. ora
Oracle_192.168.0.6 =
(Description =
(Address_list =
(Address = (Protocol = TCP) (host = 192.168.0.6) (Port = 1521 ))
)
(CONNECT_DATA =
(SID = Oracle)
(Server = dedicated)
)
)
8. Test the connection
$ Sqlplus/nolog
SQL> connect sys/change_on_install@oracle_192.168.0.6 as sysdba
SQL> connected. // indicates that the connection is successful.
Note:
1. to reinstall Oracle, delete the following parts:
/Usr/local/Oracle/all content except disk1, 2, 3
/Tmp/all the content of the orainstall file name below
/Etc/orainst. Loc
/Etc/oratab
2. If you cannot connect to the server, you can try multiple user names. In addition, you can try to disable the firewall on the server or set exceptions.