Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 07 Jul 2006 @ 17:46:13 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: Access Rights needed for Collect Statistics
 
From:   Diehl, Robert

Yes, you can. You have to grant index on the tables or join indexes. An alternative is to grant drop table on the database. I have a perl script running the queries to build it for every table in a database where the permission is not already granted. This is run on a periodic basis. This way our load/maintenance ids don't have to have drop database on the objects.

Here is sql that build the statements for you for a given database and role.

     Replace $rolename and $databasename.

     select 'grant index on ' ||  trim(dbt.databasename) || '.' ||
     dbt.tablename || ' to $rolename ;; '
            from dbc.tables dbt
            where dbt.databasename = '$databasename'
              and dbt.tablekind in ('T','I')
              and (dbt.databasename, dbt.tablename) not in
                   (select ar.databasename, ar.tablename
                    from dbc.allrolerights ar
                    where ar.rolename = '$rolename ;'
                      and ar.accessright = 'ix'
                      and ar.databasename = '$databasename')
     ;

Thanks,

Bob Diehl



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023