Hi David! Thank you very much for your reply! I already have a similar SQL statement currently running in TSMOR. The only difference is that I'm not using node_name like. I use the node_name hardcoded (node_name = 'nodename') to prevent TSM from having to go through the complete backup table. This table has node_name as an index, so when I issue your command on my server, it runs for half a day... The solution I am looking for is an SQL statement which does not only list the amount of obsolete backup objects, but also the amount, sorted on the first 5 characters of the filename (substr(ll_name,1,5)), which is the Oracle database SID. So the most ideal SQL should report the amount of obsolete object per node per database SID. I haven't been able to figure it out yet... Kind regards, Eric van Loon KLM Royal Dutch Airlines
-----Original Message----- From: ADSM: Dist Stor Manager [mailto:[email protected]] On Behalf Of David Bronder Sent: dinsdag 11 augustus 2009 9:36 To: [email protected] Subject: Re: Nested SQL? Loon, EJ van - SPLXM wrote: > > Hi TSM-ers! > We use the following SQL statement to report to our Oracle department if > their delete obsolete jobs are running ok for all nodes: > > select node_name, filespace_name, ll_name, state, object_id, > date(backup_date) from backups where ((days(current_date) - > days(backup_date) >= 30)) and state= 'ACTIVE_VERSION' and > node_name='<nodename>' > > Since backups are kept for 14 days, no objects should be returned. > We use TSMOR to report this on a weekly basis for all their nodes. If > there are objects older than 30 days, TSM lists them as an exception, > along with the amount of obsolete objects. > The Oracle departments now asks me if the report could be enhanced with > amount of obsolete objects per node per database. I know the database > SID is used in the first 5 characters of the backup object name > (ll_name), but if I want to put that in one SQL query, I think I have to > create a nested SQL statement. > Does anybody know if nested SQL is supported by TSM? Eric, If I'm understanding your DBAs' request correctly, you shouldn't need to do a nested query anyway, but just include "count(*) as one of the fields you're selecting. You'll need to add "group by" clauses for the static fields you're including. Here's the select statement I'm using for a similar report that I run for our DBAs (monthly due to our longer retention): select distinct node_name, filespace_name, count(*) as "OBJECTS", - cast(min(backup_date) as date) as "OLDEST_BACKUP" - from backups - where node_name like 'ORA-%' and - backup_date < (current_timestamp - 195 days) - group by node_name, filespace_name (Here, all Oracle TDP nodes are named "ORA-FQDN", and each database instance/SID gets its own filespace name. Makes for easier bulk cleanup of backups of obsolete/test/etc. databases.) -- Hello World. David Bronder - Systems Admin Segmentation Fault ITS-SPA, Univ. of Iowa Core dumped, disk trashed, quota filled, soda warm. [email protected] ********************************************************************** For information, services and offers, please visit our web site: http://www.klm.com. This e-mail and any attachment may contain confidential and privileged material intended for the addressee only. If you are not the addressee, you are notified that no part of the e-mail or any attachment may be disclosed, copied or distributed, and that any other action related to this e-mail or attachment is strictly prohibited, and may be unlawful. If you have received this e-mail by error, please notify the sender immediately by return e-mail, and delete this message. Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/or its employees shall not be liable for the incorrect or incomplete transmission of this e-mail or any attachments, nor responsible for any delay in receipt. Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal Dutch Airlines) is registered in Amstelveen, The Netherlands, with registered number 33014286 **********************************************************************
