Change table owner w/ CockroachDB - cockroachdb

Does CockroachDB let me change the table owner? I can’t find something that’s equivalent to Postgres’ REASSIGN OWNED command. I ultimately want to control which user has access to modify the table.

CockroachDB doesn't have the same notion of “table owners” that Postgres does. All tables are “owned” by root by default, but you can control access that other users have through GRANT.
First you’ll need to create a new user:
cockroach user set johndoe;
Now, log in to the Cockroach SQL shell and grant johndoe the permissions you want (you can find a list of permissions in the documentation:
cockroach sql
GRANT ALL ON db TO johndoe;
After that you can quit the SQL shell (ctrl + C) and then access the shell again as the new user:
cockroach sql --user=johndoe

change the owner of a table with
ALTER TABLE <name> OWNER TO <newowner>
see https://www.cockroachlabs.com/docs/v20.2/owner-to.html

Related

Oracle how to give permission to an user on a different schema

I have an Oracle user user1 and a schema schema1. I want to give permissions insert, update and delete to this user on this schema.
I only find in the documentation that I can give permissions on this schema tables.
Is there a way to give permission on whole schema?
You can add roles and privileges to the user or use the grant command.
https://docs.oracle.com/javadb/10.8.3.0/ref/rrefsqljgrant.html
You can also use the GRANT ALL PRIVILEGES TO {USERNAME} command.

how to grant the privilege to database using The SQL standards based authorization in hive

As per documentation changing ownership to the database by creating a role.
A role can also be the owner of a database. The "alter database" command can be used to set the owner of a database to a role.
I don`t know further steps how to proceed after changing the owner of data to a role.
I followed the below syntax to set the owner ship
ALTER (DATABASE|SCHEMA) database_name SET OWNER [USER|ROLE] user_or_role;
create role ;
Alter database first set owner xyz;

Upgrade a user's permissions in CockroachDB

If I create a read-only user, but want to give them write access, how do I do that in CockroachDB?
At any time you can simply grant a user new permissions via the GRANT family of SQL commands, as explained in the documentation for GRANT.
For example, to grant the user jordan INSERT permissions on all tables in the test database, run the following command in a SQL shell:
GRANT INSERT ON TABLE test.* TO jordan

Create user in oracle database

I have below requirement in oracle database
Create User and grant to all objects in schema "abc"
If i add any tables to schema "abc", then the user should have access by default without executing individual Grant
Current we are executing Grant statements for every objects created in schema, is there any onetime configuration available? Please help
Note: Here user is not a schema owner, for ex. some one who having access to read-only access.
In current versions of Oracle, you could create a DDL Trigger and have this automatically execute a grant on the newly created object to your other user.
See the excellent PSOUG site for an overview: http://psoug.org/reference/ddl_trigger.html

Hide tables in Oracle XE database

I'm using Oracle XE but I would like to log in as a user than can create tables, contraints etc., but who cannot view all of the other system tables and stuff that you see when you log in with the system account.
How can I achieve this?
You need to create a new user with:
CREATE USER xxx IDENTIFIED BY yyyy;
From there, issue GRANT for the privileges you want to give the user:
GRANT CREATE SESSION TO xxx;
GRANT CREATE TABLE TO xxx;
GRANT CREATE VIEW TO xxx;
etc.
See the SQL Reference documentation for all the privileges you can grant. User xxx will only be able to see their own objects and objects they have been granted privileges on.

Resources