SQLPLUS Connect and running script
Posted: 22 Nov 2016 14:01
Hi all,
I want to make a batch script in order to verify some database instances that
do not have invalid objects.
I have created the following sql file :
check.sql
And the executable file is the following :
As you can see the Username, password, hostname are the same. Only the sid is modified in each script
The problem I have is that the connection is done successfully but the script is not executed automatically.
Moreover, is there any way to do it with loop (as only the sid is modified) and print it as header the customer?
Thank you in advance
I want to make a batch script in order to verify some database instances that
do not have invalid objects.
I have created the following sql file :
check.sql
Code: Select all
SELECT owner, object_name, object_type, status
FROM dba_objects
WHERE status = 'INVALID'
/
And the executable file is the following :
Code: Select all
sqlplus SYS/"1!password!1"@server1.domain.gr:1521/customer1 as SYSDBA
@check.sql
sqlplus SYS/"1!password!1"@server1.domain.gr:1521/customer2 as SYSDBA
@check.sql
........
sqlplus SYS/"1!password!1"@server1.domain.gr:1521/customer20 as SYSDBA
@check.sql
As you can see the Username, password, hostname are the same. Only the sid is modified in each script
The problem I have is that the connection is done successfully but the script is not executed automatically.
Moreover, is there any way to do it with loop (as only the sid is modified) and print it as header the customer?
Thank you in advance