Posts

Steps to enable archive log mode in Postgres database

  Step-1: Validate the archive mode status  postgres=# show archive_mode;  archive_mode --------------  off (1 row) postgres=# show archive_command;  archive_command -----------------  (disabled) (1 row) Step-2: Create the archive location  mkdir -p /var/lib/pgsql/14/archive Step3: Enable archive mode  postgres=# ALTER SYSTEM SET archive_mode to 'ON'; ALTER SYSTEM postgres=# ALTER SYSTEM SET archive_command TO 'cp %p /var/lib/pgsql/14/archive/archive%f'; ALTER SYSTEM postgres=# show archive_mode;  archive_mode --------------  off (1 row) postgres=# show archive_command;  archive_command -----------------  (disabled) (1 row) Step4: Set the standard parameter for better performance postgres=# alter system set wal_keep_size='500MB'; ALTER SYSTEM postgres=# alter system set archive_timeout='900s'; ALTER SYSTEM postgres=# alter system set max_wal_senders=10; archive_timeout: Forces a WAL switch after a predetermined period of time a...

PostgreSQL Tablespace managment

  Tablesapce Basics What is a tablespace? It defines where the contents of the tables should be saved. Rules: We can't use a database unless we have tablespace. pg_default is the default tablespace for all the databases. We can define the non-default tablespace while creating a database or can alter the existing database/s by assigning a non-default tablespace. Users can define on which tablespace the objects should be stored when creating them. What are the different types of tablespaces present in the Postgres database? There are two different types of tablespace: Default: by default, two tablespaces will be created at the server level. pg_default and pg_global Non-default: User created manually.  postgres=# select * from pg_tablespace;   oid  |  spcname   | spcowner | spcacl | spcoptions -------+------------+----------+--------+------------   1663 | pg_default |       10 |        |   1664 | pg_glob...

Auditing in Oracle database

Unified Auditing: Oracle Database 12c Release 1 introduces a new auditing feature called Unified Auditing (12.1). Oracle Unified Auditing modifies the database's fundamental auditing capabilities. In earlier versions of Oracle, each component has its own audit trail. With unified auditing, all auditing is compiled into a single repository and view. Due to the fact that all audit data is now in a single location and a single format, there is a double simplification as a result. This data is made available in a consistent format in the UNIFIED AUDIT TRAIL data dictionary view, which is made possible by the unified audit trail, which is stored in a read-only table in the AUDSYS schema in the SYSAUX tablespace.  DBAs can build audit rules and then assign them to various users using Oracle 12c Unified Auditing, which has the same advantages as giving users varying system capabilities based on their responsibilities. The unified_audit_trail database will contain all of the audit records....

Tuples unpacking in Python

  Tuples: my_tup = [(1,2),(2,3),(4,5),(6,7),(8,9)] for tup in my_tup:     print(tup) Output: (1, 2) (2, 3) (4, 5) (6, 7) (8, 9) Tuple unpacking methods: Method-1: using (a,b) my_tup = [(1,2),(2,3),(4,5),(6,7),(8,9)] for a,b in my_tup: print(a) print(b) Output: 1 2 2 3 4 5 6 7 8 9 Dictionaries: my_dict = {'Apple':2, 'Grapes':1, 'Orange':1 } for dict in my_dict: print(dict) Output: Apple Grapes Orange Note: By default, it prints only the Keys but not the values. To print both the keys and pairs we have to use items() like my_dict.items() my_dict.values() my_dict = {'Apple':2, 'Grapes':1, 'Orange':1 } for dict in my_dict.items(): print(dict) Output: ('Apple', 2) ('Grapes', 1) ('Orange', 1) Again Here you could use tuple unpacking technique. my_dict = {'Apple':2, 'Grapes':1, 'Orange':1 } for key,value in my_dict.items(): print(key) print(value) Output: Apple 2 Grapes...

How to know which node is the master node in oracle RAC

 You can verify by using these blow options: 1. grep the ocssd logfile contents by searching a key word "master node" Go to the location of cssd logfile and run the below command: grep -i "master node" ocssd.log | tail -1 Output:  [CSSD]CLSS-3001: local node number 1, master node number 1 2. grep crsd logfile contents by searching a key word "MASTER" Go to the location of crsd logfile and run the below command: grep MASTER crsd.log | tail -1 3. By querying the database view  "V$GES_RESOURCE"  4. by locating the OCR backup, because the node that store OCR backups is the master node. ocrconfig -showbackup

Oracle RAC Interview Questions

Questions related to: Basic RAC Questions RAC installation Questions RAC Upgrade/Patching Questions RAC Data Guard Configuration Questions RAC troubleshooting Questions RAC Basics: 1. What are the Clusterware processes in RAC?  Ans: ocssd: Cluster synchronization services crsd: Cluster ready services evmd: Event manager daemon oprocd: Process monitor daemon 2. What are background process in RAC? LMS LMD LMON LCK DIAG 3. What are clusterware components? Voting disk OCR 4. How to backup OCR? RAC Troubleshooting: 1. How to troubleshoot node reboot/eviction?

Scheduling a full database backup using MSSQL Server “Maintenance Plan”