-
code error : sql EOF
Hi ,
iam using this script to connect to all db . first grep from oratab and use those sid as $dbname as alias ..
where is the error : pls help
egrep -i ":Y|:N" $ORATAB | egrep -v "9.2" | cut -d":" -f1 | grep -v "\#" | grep -v "\*" | while read dbname
do
echo $dbname
export ORACLE_SID="$dbname"
. /dba/scripts/.dba.profile
$ORACLE_HOME/bin/sqlplus -S oracle/mysecretpassword!!!@"$dbname" <
show user;
EOF1
done
-------------------but getting error ----------------------
SP2-0306: Invalid option.
Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM}] [edition=value]]
where ::= [/][@]
::= [][/][@]
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
DV2ACT
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
ERROR:
ORA-01017: invalid username/password; logon denied
please help me on this..........
Last edited by gandolf989; 12-31-2013 at 08:58 AM.
-
Of course you started with making sure that your grep was not bringing in extra garbage
and duplicate records. This really looks like a classic case of garbage in garbage out.
I saw a few things that looked suspicious. Possibly the issue was the special character in the
"Password" that you posted on the internet.
Code:
egrep -v "^#|^$|9.2" $ORATAB | cut -d":" -f1 | while read dbname
do
echo ${dbname}
export ORACLE_SID="${dbname}"
. /dba/scripts/.dba.profile
$ORACLE_HOME/bin/sqlplus -S '/as sysdba' << EOF
select * from v\$instance;
show user;
EOF
done
-
Just adding a bit to gandolf's post: "^+" to omit asm instances and "^*" to omit default.
Code:
ORATAB=/ect/oratab
egrep -v "^#|9.2|^\+|^\*" $ORATAB |cut -d":" -f1 |\
while read dbname
do
echo "++++ $dbname"
export ORACLE_SID="$dbname"
. /dba/scripts/.dba.profile
$ORACLE_HOME/bin/sqlplus -S /nolog <<EOF1
conn oracle/mysecretpassword!!!@$dbname
show user;
EOF1
done
"The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb
-
Originally Posted by LKBrwn_DBA
Just adding a bit to gandolf's post: "^+" to omit asm instances and "^*" to omit default.
An +ASM instance is still an instance with an sga and some fixed views.
So you can query an +ASM instance, just in a more limited way.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|