All Forums Database
Langaliya.Nirav 15 posts Joined 04/11
27 Nov 2012
Determine which database is up and running or active?

Do you know how to determine which DB is up on Teradata? 
there is one common  system test server and there are two different database on same server.
Database names are QA0 and QA1.
I think we can determine it by simple select query both database but
In that case I need to give common table name along with database name to run select query to determine active database all time and I am not sure what if generic table is not available or dropped over period of time and database is still available
in that case though database is available , query would fail and code will determine that database is not available.
I need to know active database for disaster recovery , if primary database in not up and running then secondary database should be selected 

--Nirav Langaliya
Langaliya.Nirav 15 posts Joined 04/11
27 Nov 2012

I think I got answer from my friend's help, what i tried is setting to DATABASE qa0; and it ran successful and then I tried to set database with this query DATABASE qa9 ; and which failed because there is no such database qa9 so by .ERROCODE we can determine that is database is up and running.
here you can provide your suggestion as well as I am not sure that our finding to set database would work completely 

--Nirav Langaliya

Harpreet Singh 101 posts Joined 10/11
27 Nov 2012

You can utilise view from dbc for databases also

select * from dbc.databases where databasename like '%qa%'

Qaisar Kiani 337 posts Joined 11/05
28 Nov 2012

If I understand your question correctly then as far as the Teradata nodes are up and running all the databases will be active and up and runnings and users can access the database objects as long as they have the access to the specific database.
However to find out whether the database exists on the server or not you can Harpeet's query in SQL Assistant (and if you want to further restrict the search criteria then you can change the LIKE statement to IN ('QA0', 'QA1')...

You must sign in to leave a comment.