Tuesday 11 February 2014

Changing the Owner of Tables




In Vertica one table is having only one Owner. Owner can truncate/Drop the table. If we need to give truncate and Drop permissions to other user, we need to change the Owner of the table to required User.

Connect to the dbadmin user and alter the table owner.
Syntax: ALTER TABLE <SCHEMA NAME>.<TABLE NAME> OWNER TO  <REQUIRED USER>

If you want to change all tables owner:
     Capture the below query result and execute through dbadmin

SELECT 'ALTER TABLE FIN_PROD.'||TABLE_NAME||' OWNER TO <NEW USER>;'
from v_catalog.tables
where table_schema='<SCHEMA NAME>'
and owner_name = '<EXISTING USER>'

No comments:

Post a Comment