Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all articles
Browse latest Browse all 1640

Script to connect multiple databases for changes

$
0
0
Please follow the steps below.

Suppose if you are monitoring all databases from a common server. Then use the below script to do some changes in all databases at one time.

USAGE:
----------

This script is to lock the account & profile changes for all the databases from monitor server for an user or as per the need. Instead of logging into all databases 1 by 1.

Like wise we can change the content as per our need which is marked in yellow. Pass the database name in /u01/MONITOR/changes/db_mbp.parms.

[oracle@monitor changes]$ cat xyz.sh

ORACLE_HOME=/oracle/app/product/11.2.0.3/client_1; export ORACLE_HOME
PATH=$ORACLE_HOME/bin:$PATH; export PATH
cat /u01/MONITOR/changes/db_mbp.parms | while read line
do
database=`echo $line | awk '{print $1}'`
echo $database
sqlplus -s borra/pwd@$database << EOF >> /home/oracle/borra/list.txt
set verify off
set feedback off
set lines 150
set pages 0
set heading off
set space 0
break on name
alter user borra account lock;
alter profile default limit PASSWORD_LIFE_TIME UNLIMITED;
exit
EOF
done


Viewing all articles
Browse latest Browse all 1640

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>