finding instance_name and service_name under Oracle database

Once we connected to the database, for SID you can try:
SQL>select instance_name from v$instance;

using shell script
>ps -ef grep smon

It is also in the ORACLE_SID environment variable for the session that starts the database.

Service name is a TNS thing, and can change. It can be an alias. A database with SID ORA1 can be aliased to FOO service name.

You can find what the database instance registers itself as by looking at:
SQL>select value from v$parameter where name = 'service_names';

Find what the listener has exposed the service as, since it could be a static alias that is not known to the instance, necessarily.
using shell script
> lsnrctl services will give complete details.

No comments :

Post a Comment