Atikh's DBA blog
  • Home
  • Oracle
  • MySQL
  • MongoDB
  • PostgreSQL
  • Snowflake
  • About Me
  • Contact Us
Showing posts with label MongoDB. Show all posts
Showing posts with label MongoDB. Show all posts

lsb_release: command not found... : Linux/ Database Admin

 Atikh Shaikh     MongoDB, mysql, oracle, PostgreSQL     No comments   

As Database Admin, Linux Admin, or system admin, you must have come across this error or situation, 

Here I was trying to see release details of the Linux operating system using the lsb_release command but it failed with the below error. 

On seeing this error, I thought lsb_release was not installed on the server, so I tried to install using the yum command but it failed with the error "Error: Unable to find a match: lsb_release" 

[root@localhost bin]# lsb_release 

bash: lsb_release: command not found...

 

[root@localhost bin]# yum install lsb_release

Last metadata expiration check: 0:07:24 ago on Sat 30 Dec 2023 11:04:11 AM UTC.

No match for argument: lsb_release

Error: Unable to find a match: lsb_release

[root@localhost bin]# 

 

So here is the trick, you need to identify which package provides this command using the below method

[root@localhost bin]# yum whatprovides lsb_release

Last metadata expiration check: 0:05:10 ago on Sat 30 Dec 2023 11:04:11 AM UTC.

redhat-lsb-core-4.1-47.0.1.el8.i686 : LSB Core module support

Repo        : ol8_appstream

Matched from:

Filename    : /usr/bin/lsb_release

redhat-lsb-core-4.1-47.0.1.el8.x86_64 : LSB Core module support

Repo        : ol8_appstream

Matched from:

Filename    : /usr/bin/lsb_release

[root@localhost bin]# 

 

Here we see package redhat-lsb-core provides the lsb_release command, so to access lsb_release we need to install the redhat-lsb-core package, let's try to install it

 

[root@localhost bin]# yum install redhat-lsb-core

Last metadata expiration check: 0:12:20 ago on Sat 30 Dec 2023 11:04:11 AM UTC.

Dependencies resolved.

==============================================================================================================================================================

 Package                                        Architecture               Version                                Repository                             Size

==============================================================================================================================================================

Installing:

 redhat-lsb-core                                x86_64                     4.1-47.0.1.el8                         ol8_appstream                          46 k

Installing dependencies:

 m4                                             x86_64                     1.4.18-7.el8                           ol8_baseos_latest                     222 k

 mailx                                          x86_64                     12.5-29.el8                            ol8_baseos_latest                     257 k

 ncurses-compat-libs                            x86_64                     6.1-9.20180224.el8                     ol8_baseos_latest                     328 k

 patch                                          x86_64                     2.7.6-11.el8                           ol8_baseos_latest                     139 k

 postfix                                        x86_64                     2:3.5.8-7.el8                          ol8_baseos_latest                     1.5 M

 redhat-lsb-submod-security                     x86_64                     4.1-47.0.1.el8                         ol8_appstream                          22 k

 spax                                           x86_64                     1.5.3-13.el8                           ol8_baseos_latest                     217 k

 

Transaction Summary

==============================================================================================================================================================

Install  8 Packages

 

Total download size: 2.7 M

Installed size: 7.0 M

Is this ok [y/N]: y

Downloading Packages:

(1/8): mailx-12.5-29.el8.x86_64.rpm                                                                                           980 kB/s | 257 kB     00:00    

(2/8): m4-1.4.18-7.el8.x86_64.rpm                                                                                             820 kB/s | 222 kB     00:00    

(3/8): ncurses-compat-libs-6.1-9.20180224.el8.x86_64.rpm                                                                      1.1 MB/s | 328 kB     00:00    

(4/8): patch-2.7.6-11.el8.x86_64.rpm                                                                                          1.3 MB/s | 139 kB     00:00    

(5/8): spax-1.5.3-13.el8.x86_64.rpm                                                                                           2.1 MB/s | 217 kB     00:00    

(6/8): redhat-lsb-core-4.1-47.0.1.el8.x86_64.rpm                                                                              691 kB/s |  46 kB     00:00    

(7/8): redhat-lsb-submod-security-4.1-47.0.1.el8.x86_64.rpm                                                                   468 kB/s |  22 kB     00:00    

(8/8): postfix-3.5.8-7.el8.x86_64.rpm                                                                                         5.6 MB/s | 1.5 MB     00:00    

--------------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                         4.9 MB/s | 2.7 MB     00:00     

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                                                      1/1 

  Installing       : redhat-lsb-submod-security-4.1-47.0.1.el8.x86_64                                                                                     1/8 

  Installing       : spax-1.5.3-13.el8.x86_64                                                                                                             2/8 

  Running scriptlet: spax-1.5.3-13.el8.x86_64                                                                                                             2/8 

  Running scriptlet: postfix-2:3.5.8-7.el8.x86_64                                                                                                         3/8 

  Installing       : postfix-2:3.5.8-7.el8.x86_64                                                                                                         3/8 

  Running scriptlet: postfix-2:3.5.8-7.el8.x86_64                                                                                                         3/8 

  Installing       : patch-2.7.6-11.el8.x86_64                                                                                                            4/8 

  Installing       : ncurses-compat-libs-6.1-9.20180224.el8.x86_64                                                                                        5/8 

  Installing       : mailx-12.5-29.el8.x86_64                                                                                                             6/8 

  Installing       : m4-1.4.18-7.el8.x86_64                                                                                                               7/8 

  Running scriptlet: m4-1.4.18-7.el8.x86_64                                                                                                               7/8 

  Installing       : redhat-lsb-core-4.1-47.0.1.el8.x86_64                                                                                                8/8 

  Running scriptlet: redhat-lsb-core-4.1-47.0.1.el8.x86_64                                                                                                8/8 

  Verifying        : m4-1.4.18-7.el8.x86_64                                                                                                               1/8 

  Verifying        : mailx-12.5-29.el8.x86_64                                                                                                             2/8 

  Verifying        : ncurses-compat-libs-6.1-9.20180224.el8.x86_64                                                                                        3/8 

  Verifying        : patch-2.7.6-11.el8.x86_64                                                                                                            4/8 

  Verifying        : postfix-2:3.5.8-7.el8.x86_64                                                                                                         5/8 

  Verifying        : spax-1.5.3-13.el8.x86_64                                                                                                             6/8 

  Verifying        : redhat-lsb-core-4.1-47.0.1.el8.x86_64                                                                                                7/8 

  Verifying        : redhat-lsb-submod-security-4.1-47.0.1.el8.x86_64                                                                                     8/8 

 

Installed:

  m4-1.4.18-7.el8.x86_64          mailx-12.5-29.el8.x86_64                 ncurses-compat-libs-6.1-9.20180224.el8.x86_64       patch-2.7.6-11.el8.x86_64   

  postfix-2:3.5.8-7.el8.x86_64    redhat-lsb-core-4.1-47.0.1.el8.x86_64    redhat-lsb-submod-security-4.1-47.0.1.el8.x86_64    spax-1.5.3-13.el8.x86_64    

 

Complete!

[root@localhost bin]# 

 

After installation, I was able to access it 

 

[root@localhost bin]# lsb_release 

LSB Version:   :core-4.1-amd64:core-4.1-noarch

[root@localhost bin]# 

 


Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Instagram
  •  Pin
  •  linkedin
  •  reddit

To Know details about Linux OS :Oracle, PostgreSQL, MySQL and MongoDB

 Atikh Shaikh     MongoDB, mysql, oracle, PostgreSQL     No comments   

In this small article, we are going to see different commands to check the OS version in Linux and other details about the operating system

Here are a few files and commands that can be used

1. Command uname:

Usage uname -a

[oracle@localhost ~]$  uname -a

Linux localhost.localdomain 5.15.0-8.91.4.1.el8uek.x86_64 #2 SMP Tue Mar 7 18:28:34 PST 2023 x86_64 x86_64 x86_64 GNU/Linux

[oracle@localhost ~]$

This command displays the type of os, OS release, OS version version, hardware name, and processor type

2. Command lsb_release:

Usage:lsb_release -a

[root@localhost ~]# lsb_release -a

LSB Version:   :core-4.1-amd64:core-4.1-noarch

Distributor ID:     OracleServer

Description:   Oracle Linux Server release 8.7

Release:  8.7

Codename: n/a

[root@localhost ~]#

lsb_release






This command would display information including the Distributor ID, Description, OS Release, and Codename.

3. File /etc/os-release

Usage: cat /etc/os-release   or more /etc/os-release

os_release


This file contains almost all the details about the operating system

4. File /etc/issue:

Usage:  cat /etc/issue  or more /etc/issue

[root@localhost ~]# cat /etc/issue

\S

Kernel \r on an \m

[root@localhost ~]#

cat /etc/issue, kernel details





This command will give an idea about the kernel details of the operating system

Based on the requirement, you can use a command or file. 

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Instagram
  •  Pin
  •  linkedin
  •  reddit

MongoDB : How to get config file and log file location

 Atikh Shaikh     MongoDB     No comments   

In MongoDB configuration files and log files are important files as far as the daily routine for DBA. We may need to check parameters in the configuration and file and errors in log files. So here we will discuss where and how to check the location of these files

Configuration files (mongod.conf) 

The below command will help to list different files and their location, once you run it, the output will look like the below, but make sure you run it through the admin database, you can see highlighted part shows the location and name of the MongoDB configuration file

[Also read - Database and Collections]

db.runCommand({getCmdLineOpts:1})

> use admin

switched to db admin

> db.runCommand({getCmdLineOpts:1});

{

        "argv" : [

                "C:\\Program Files\\MongoDB\\Server\\5.0\\bin\\mongod.exe",

                "--config",

                "C:\\Program Files\\MongoDB\\Server\\5.0\\bin\\mongod.cfg",

                "--service"

        ],

        "parsed" : {

                "config" : "C:\\Program Files\\MongoDB\\Server\\5.0\\bin\\mongod.cfg",

                "net" : {

                        "bindIp" : "127.0.0.1",

                        "port" : 27017

                },

                "service" : true,

                "storage" : {

                        "dbPath" : "C:\\Program Files\\MongoDB\\Server\\5.0\\data",

                        "journal" : {

                                "enabled" : true

                        }

                },

                "systemLog" : {

                        "destination" : "file",

                        "logAppend" : true,

                        "path" : "C:\\Program Files\\MongoDB\\Server\\5.0\\log\\mongod.log"

                }

        },

        "ok" : 1

}

> 

Log file

In this same command above, you can see the parameter "systemLog" and location is also given there only, marked in red color. 

There is one other to check log file location using mongod.conf file, in the configuration file, you can below the parameter 

# where to write logging data.

systemLog:

  destination: file

  logAppend: true

  path:  C:\Program Files\MongoDB\Server\5.0\log\mongod.log

 

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Instagram
  •  Pin
  •  linkedin
  •  reddit

Transferring file from one server to another server [FTP, SFTP, SCP etc]

 Atikh Shaikh     MongoDB, mysql, oracle, Oracle 12c, PostgreSQL     No comments   

There are number of ways to transfer file from one server to another server, below are the few methods to to achieve the same

  1. ftp
  2. sftp
  3. scp
  4. windows software (Filehippo, WinScp , FileZilla etc)
We will discuss these in details

1. FTP transfer

File Transfer Protocols basically is set of rules on computer network to communicate with one another. This FTP tool or utility can be used to transfer files from one server to another server.
Below are the commands to use ftp
$ftp
User : 
Password :
ftp> bin  -- to transfer in binary format
ftp> cd
ftp> put/get -- put for sending from one server to another and get is vice versa
ftp>bye


2. SFTP transfer

As name suggest SFTP is secure file transfer protocol, it uses full security and authentication functionality of SSH. SFTP is new utility compared to FTP and recommended to use instead of FTP
This utility can be used using below commands
$sftp @
password : ***
sftp>cd
sftp> put/get -- put for sending from one server to another and get is vice versa
sftp> bye


3.SCP 

SCP is used for securely copying files from one server system to another server system. 
Below is syntax for the same

scp [OPTION] [user@]src_server:] file1 [user@]target_server:]file2
where 
[user@]src_server:] file1 -- source file
[user@]target_server:]file2 -- destination file

for example
scp text_file.txt  @:/


4. Windows software

There are number of freely available software on internet, choose your favourite one and transfer files using simple GUI
Below are few I came across

  • FileZilla
  • Filehippo
  • WinScp
  • FireFTP

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Instagram
  •  Pin
  •  linkedin
  •  reddit

MongoDB : Capped Collections

 Atikh Shaikh     MongoDB     No comments   

There are two types of collections normal collection and capped collection

  • In comparison to the normal collection, capped collections are created in advance and are fixed in size 
  • Normal collections are created dynamically and automatically grow in size to fit extra data
  • These capped collections are designed to consume less space and are rotating that means once allocated space is full, it will start writing from older documents again.
  • Below operations are not allowed on a capped collection
    • Documents can not be removed
    • Updates that make documents to grow in size are not allowed 
Capped collections can not be sharded

Creating Capped collection
As discussed above, capped collection needs to be created explicitly, we will discuss commands for the same

> db.createCollection("my_cap_col1",
... {"capped" : true, "size":100000});
{ "ok" : 1 }
> 

above command creates capped collection with below details
capped collection name : my_cap_col1
fixed size : 100000 byes

same way capped collection can be created with limit on number of documents
for example

> db.createCollection("my_cap_col2",
... {"capped":true, "size" : 100000, "max" : 100});
{ "ok" : 1 }

> show collections;
my_cap_col1
my_cap_col2

Once capped collections are created, it can not be modified, it must be dropped and recreated with desired parameters

Converting normal collection to capped collection


> db.runCommand({"convertToCapped": "techno_col",size:10000});
{ "ok" : 1 }
> 

There is no way to convert capped collection to normal collection
mongodb-technodba-capped-collection, normal to capped collection, capped to normal collection

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Instagram
  •  Pin
  •  linkedin
  •  reddit

Creating User Account in MongoDB

 Atikh Shaikh     MongoDB     No comments   

For any database whether it is RDBMS or NoSQL, the user account is a very important aspect and is a must to connect to a database
There are different types of users depending on usage like, admin user account, read-only account, read write only.
Users can be created or added to the database using db.createUser() method available with MongoDB
The db.createUser() method accepts a document object that enables you to specify the username, roles and password for user to be created

Definition of db.createUser() method
db.createUser(user, writeConcern)

Field
Type
Description
User
Document
The document with authentication and access information about user
writeConcern
Document
Optional, the level of writeConcern for creation operation

The user document has the following fields

Field
Type
Description
user
String
The name of the new user
pwd
String
The user password
customData
Document
Optional, any information about user
roles
Array
This defines roles, The roles granted to a user can be an empty array[] to create a user without any roles
AuthenticationRestrictions
Array
Optional, the authentication restrictions the server enforces on the user. Specifies a list of IP addresses and CIDR ranges from which user will be able to connect
Mechanisms
Array
Optional, specify the specific SCRAM mechanism for creating SCRAM user creation
passwordDigester
string
Optional, Indicates whether the server or the client digest the password

Roles
In the role field, you can specify the build-in roles and user-defined roles. You can specify directly role name or in the form of a document as well
i.e.
"readWrite" or {role : "" : db ""}

External Credentials
Users created on $external database should have credentials stored externally to MongoDB
Local database
user can not be created on local database
Examples
Create account with roles assigned
> db.createUser({ user : "tech_owner",
... pwd : "techo!23",
... customData : {user : "blogUser"},
... roles :[{role: "clusterAdmin",
... db : "admin" },
... "readWrite"]}
... );
Successfully added user: {
        "user" : "tech_owner",
        "customData" : {
                "user" : "blogUser"
        },
        "roles" : [
                {
                        "role" : "clusterAdmin",
                        "db" : "admin"
                },
                "readWrite"
        ]
}
> 

Create an account with roles

> db.createUser({ user : "tech_user",
... pwd : "techo!23",
... roles :["readWrite", "dbAdmin"]}
... );
Successfully added user: { "user" : "tech_user", "roles" : [ "readWrite", "dbAdmin" ] }
> 
> 

Create user without any roles

> db.createUser({ user : "tech_wo_roles",
... pwd : "techo!23",
... roles :[]
... }
... );
Successfully added user: { "user" : "tech_wo_roles", "roles" : [ ] }
> 
> 

Listing users created

> db.getUsers();
[
        {
                "_id" : "techno_db.tech_owner",
                "user" : "tech_owner",
                "db" : "techno_db",
                "customData" : {
                        "user" : "blogUser"
                },
                "roles" : [
                        {
                                "role" : "clusterAdmin",
                                "db" : "admin"
                        },
                        {
                                "role" : "readWrite",
                                "db" : "techno_db"
                        }
                ],
                "mechanisms" : [
                        "SCRAM-SHA-1"
                ]
        },
        {
                "_id" : "techno_db.tech_user",
                "user" : "tech_user",
                "db" : "techno_db",
                "roles" : [
                        {
                                "role" : "readWrite",
                                "db" : "techno_db"
                        },
                        {
                                "role" : "dbAdmin",
                                "db" : "techno_db"
                        }
                ],
                "mechanisms" : [
                        "SCRAM-SHA-1"
                ]
        },
        {
                "_id" : "techno_db.tech_wo_roles",
                "user" : "tech_wo_roles",
                "db" : "techno_db",
                "roles" : [ ],
                "mechanisms" : [
                        "SCRAM-SHA-1"
                ]
        }
]
> 
> 

Removing/Dropping User in MongoDB
First list the users using db.getUsers() method and decide which one to drop
then use db.dropUser() method to drop user, this dropUser() method takes username as argument
We will drop tech_wo_roles user 

> db.dropUser("tech_wo_roles");
true
> 

If you want to drop all the users if you can user db.dropAllUsers() method.

More will come on MongoDB. follow this space for more and explore more.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Instagram
  •  Pin
  •  linkedin
  •  reddit
Older Posts Home

Author

Atikh Shaikh
View my complete profile

Categories

  • MongoDB (18)
  • Oracle 12c (30)
  • Oracle12cR2 New Feature (3)
  • PostgreSQL (20)
  • RMAN (10)
  • Snowflake (8)
  • mysql (23)
  • oracle (74)

Blog Archive

  • ►  2018 (38)
    • ►  November (25)
    • ►  December (13)
  • ►  2019 (33)
    • ►  January (15)
    • ►  February (6)
    • ►  March (2)
    • ►  April (5)
    • ►  May (5)
  • ►  2020 (5)
    • ►  April (1)
    • ►  May (2)
    • ►  July (2)
  • ►  2021 (8)
    • ►  June (3)
    • ►  July (3)
    • ►  August (1)
    • ►  December (1)
  • ►  2022 (33)
    • ►  May (3)
    • ►  June (10)
    • ►  July (3)
    • ►  August (4)
    • ►  September (8)
    • ►  October (3)
    • ►  November (2)
  • ►  2023 (14)
    • ►  February (1)
    • ►  April (5)
    • ►  May (2)
    • ►  June (1)
    • ►  September (1)
    • ►  October (1)
    • ►  December (3)
  • ►  2024 (5)
    • ►  January (2)
    • ►  March (3)
  • ▼  2025 (6)
    • ►  March (1)
    • ►  April (3)
    • ▼  May (2)
      • Oracle 23ai : The all new Hybrid Read-Only for plu...
      • Oracle Active Data Guard Features and Benefits

Popular Posts

  • ORA-29283: invalid file operation: unexpected "LFI" error (1509)[29437]
    I was trying to export the schema in my windows PC, it got stuck with below error    C:\Users\shaik\Videos\technodba exp>expdp userid...
  • PostgreSQL : How to get data directory location for PostgreSQL instance
    Sometimes, you start working on a PostgreSQL instance but forget about the data directory, here we will discuss different methods to know th...
  • Oracle 23ai : Use of NOVALIDATE Constraints in IMPDP
    While performing impdp operations in the Oracle database, Oracle performs validation checks for every constraint on the imported table, that...
  • ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
    In previous articles, we have learned about user creation and grants  in MySQL in detail, but there are a few privileges called global priv...
  • Oracle Dataguard Broker Configuration (DGMGRL)
    Data Guard Broker is a command-line interface that makes managing primary and standby databases easy. DBA can use a single command to switch...

Labels

oracle Oracle 12c mysql PostgreSQL MongoDB oracle 19c Oracle23c oracle19c Orale PDB-CDB oracle12c python AWS Oracle ASM Virtualbox pluggable database storage engine

Pages

  • Disclaimer
  • Privacy Policy

Follow TechnoDBA

Copyright © Atikh's DBA blog | Powered by Blogger