devxlogo

Report the Name of the Current Database Instance

Report the Name of the Current Database Instance

Sometimes, you need to know the Oracle database instance name on which your SQL is being executed. For instance, say you have to print a DBA report for which you have prepared a set of scripts, and which you want to execute on each database. You also want the name of the database instance at the top of report, followed by statistics for that. Of course, you don’t want to change the script for each instance?you want a generic script.

To get the name of the Oracle instance, query the GLOBAL_NAMES view in Oracle, like this:

  SELECT * FROMGLOBAL_NAMES;
See also  The Benefits of Patient Engagement Solutions for Healthcare Providers
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist