: echo exit|sqlplus username/password@database_name
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Nov 17 15:37:52 2023
Version 19.21.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
Last Successful login time: Fri Nov 17 2023 15:28:43 -06:00
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.21.0.0.0
SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.21.0.0.0
When I run this command I have issues. It looks like my $1 is not expanding correctly.
: for i in `cat database_list`; do echo $i; echo exit|sqlplus username/password@$1; done
database_name
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Nov 17 15:47:47 2023
Version 19.21.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Enter user-name: Enter password:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name: database_name