Thursday, February 20, 2020

How to list the privileges inside the Role in oracle database?

Here is the 2 views used to list the privileges inside the roles:

ROLE_TAB_PRIVS==> used to list table level privilege
ROLE_SYS_PRIVS ==> used to list system level privilge


SQL> select PRIVILEGE from role_sys_privs where ROLE='RESOURCE';

PRIVILEGE
----------------------------------------
CREATE CLUSTER
CREATE SEQUENCE
CREATE TRIGGER
CREATE TABLE
CREATE PROCEDURE
CREATE TYPE
CREATE OPERATOR
CREATE INDEXTYPE


8 rows selected.

select TABLE_NAME,PRIVILEGE from role_tab_privs where ROLE='TEST';

Monday, February 17, 2020

step by step AWS Redshift database cluster encryption

step by step AWS Redshift database cluster encryption :


This process has 2 steps and it needs down  time from the application and during that time Redshift cluster will not be available for ETL  & its in Read ONLY mode.Encryption process will be time consuming based on the size  of data on it.AWS will try to recreate the cluster during encryption process and move to other cluster.

1)create encryption key using AWS KMS (Key Management System)
2)Apply KMS Key to Redshift cluster











How to change the master user password on Redshift cluster?

Here is the step to change the master user password on Redshift cluster:



How to recreate access_key_ID and secret_key for AWS user?

Here is the step to recreate  access_key_ID and secret_key for AWS user if you forget those:





Wednesday, February 12, 2020

How to Restore AWS redshift table alone using snapshot?

Step  to Restore AWS redshift  table alone using snapshot and you can do it using the AWS console.

if you have  cluster snapshot you can restore the  table from the snapshot.


pre-request:

Source DB:
source schema:
source table name:


Target DB:
Target schema:
Target table name:

If Target DB does not have table , restore will automatically create it.









How to Restore AWS redshift cluster using snapshot?

Step  to Restore AWS redshift cluster using snapshot and you can do it using the AWS console.
if you have  cluster snapshot you can restore the entire cluster:














How to Reboot a AWS Redshift Cluster?

Here is the steps to    Reboot a AWS Redshift Cluster:

cauition:Please do not reboot redshift cluster without business approval,all the running SQL's would  be cancelled






How to copy data from AWS Redshift table to S3 bucket?

Here is the steps to copy data from AWS Redshift table to S3 bucket

pre-request:
1)we  need user created with privilege to access AWS redshift +S3 bucket
2)we need access_key_ID & secret_access_key for the user

we have utility called UNLOAD used to  extract  data from redshift tables to S3 bucket




How To Load data from AWS S3 bucket to Redshift database?

Here is the steps to  Load data from AWS S3 bucket to Redshift database:

pre-request:
1)we  need user created with privilege to access AWS redshift +S3 bucket
2)we need access_key_ID & secret_access_key for the user


COPY utility used to load data from S3 bukcet to AWS redshift database tables ,if the file is CSV  or any delimeter format

How to delete snapshot from AWS Redshift?

Delete snapshot from AWS Redshift