1

If I have a server with one or more CDBs, what command can I run on the server in order to obtain a list where each item uniquely identifies one of the CDBs?

(a "CDB" is an Oracle Container Database)

Note 1: I realize that it is rare to have more than one CDB on a server. But in that case I would still want to obtain the unique CDB name of that one CDB.

Note 2: I know that the command cat /etc/oratab will list a bunch of DB installations on the server. But this includes installations that no longer exist. I want a list of only the currently existing CDB installations.

mareoraft
  • 111
  • 3

1 Answers1

2

This is how I list running database instances. Container-databases or non-container databases:

  cat >> ~/.bash_profile <<EOF
  oinst() {
      /bin/ps -ef | grep ora_lgw[r] | awk '{print $8}' | sed -e 's/ora_lg[w]r_//'
  }
  EOF

  $oinst
  CDB1
  CDB2
  CDB3

If database instances are not running you are left with information from /etc/oratab, init<SID>.ora, orapw<SID> or database-files on ASM, filesystem or RMAN.

Bjarte Brandt
  • 702
  • 4
  • 11