How to Drop User or Role in PostgreSQL Instance on Google Cloud Platform | GCP Tutorials 2022

  Рет қаралды 690

TechBrothersIT

TechBrothersIT

Күн бұрын

How to Drop User or Role in PostgreSQL Instance on Google Cloud Platform | GCP SQL Tutorial 2022, in this video we are going to learn How to Drop User or Role in PostgreSQL Instance on Google Cloud Platform | GCP SQL Tutorial 2022, Google Cloud Platform Step by Step - GCP Tutorial 2022 - GCP Tutorial 2022 Step by Step - Google Cloud Platform Tutorial 2022.
Script:
ERROR: role "aamir" cannot be dropped because some objects depend on it
DETAIL: owner of database test
1 object in database test
SQL state: 2BP01
Error
Invalid request: failed to delete user aamir: . role "aamir" cannot be dropped because some objects depend on it Details: owner of database test 1 object in database test.
0) Prepare the scenario
Create user aamir and then create some objects
create database Test
create table public.mytable(id int, name varchar(100));
insert into public.mytable values(1,'aamir');
Select * from public.mytable;
1) -- Let's think about a user who has left the company and you need to drop the user. If you don't know the
--password for the user, login by using postgres user and change the password of user.
--How to change the password for role
Alter role aamir LOGIN password 'Test123$';
2) -- Tried to drop the role by using postgres user session
drop role aamir -- you will get errot that objects are owened by user aamir
GRANT postgres to aamir;
--2 -- login by aamir user and run below command to assign all objects to postgres user
REASSIGN OWNED BY aamir TO postgres;
--3 login back to postgres and run below
drop role aamir
--4 Check if Objects are not dropped by dropping user.
#googlecloudplatform Tutorial for beginners
#googlecloudplatform Tutorial 2022
Step by step Google Cloud Platform Tutorial
Real-time Google Cloud Platform Tutorial
Scenario-based training on Google Cloud Platform
Best GCP Tutorial on youtube
#googlecloud #googlecloudplatform

Пікірлер: 1
@faizahmed8015
@faizahmed8015 Жыл бұрын
When I'm altering password it says role amir dose not exist? Although do think what you did.
Part 13- PostgreSQL user and role Management
22:53
E-MultiSkills Database services
Рет қаралды 54 М.
啊?就这么水灵灵的穿上了?
00:18
一航1
Рет қаралды 53 МЛН
She's very CREATIVE💡💦 #camping #survival #bushcraft #outdoors #lifehack
00:26
Watermelon magic box! #shorts by Leisi Crazy
00:20
Leisi Crazy
Рет қаралды 115 МЛН
DP-600: Mastering the Analytics Development Lifecycle in Microsoft Fabric
37:26
Azure and Fabric Mastery Academy
Рет қаралды 339
PyQt6 - Database-Driven Desktop Apps! | QtSql module
43:34
BugBytes
Рет қаралды 1,8 М.
Debugging a Complex T-SQL Issue
1:00:54
Brent Ozar Unlimited
Рет қаралды 4,7 М.
How to create and connect to PostgreSQL instance using GCP | Google Cloud  PostgreSQL Tutorial
15:41
Praveen Borra - Cloud Learning Path
Рет қаралды 26 М.
Solving one of PostgreSQL's biggest weaknesses.
17:12
Dreams of Code
Рет қаралды 202 М.
Impossible Kylian Mbappé Moments
8:10
MNcompsJR2
Рет қаралды 4,1 МЛН
Microservices with Databases can be challenging...
20:52
Software Developer Diaries
Рет қаралды 64 М.