Sunday, July 19, 2020

Ques What is difference among Privilege , Roles, and Profiles?

Privileges, Roles and Profiles


Privileges
A user privilege is a right to execute a particular type of SQL statement, or a right to access another user's object, execute a PL/SQL package, and so on. The types of privileges are defined by Oracle.
Roles
Roles are created by users (usually administrators) to group together privileges or other roles. They are a means of facilitating the granting of multiple privileges or roles to users.
Profiles
Profiles define resource limits imposed upon a user account. The "default" profile sets all resource limits to unlimited.

Monday, April 27, 2020

How to copy a project inside itellij idea.

Like Eclipse you can't copy project in intellij idea . Here Step By Step approach to make new copy of existing project.

Step 1 : Create copy of project - use terminal or explorer and copy the project and rename it.

Step 2 : Switch back to idea and open new Project

             File -> Open -(navigate the location where project exist)->open

Step 3 : Rename .iml File suppose your old project name was test and new  name is test-java. but when you expand project test-java in IDE then you find test.iml file rename it to project name i.e. test-java.iml

Step 4 : Open pom.xml and rename artifactId to project name, to avoid any conflict.

Step 5 : Navigate main method and right click and run  - this will open a window



Step 6 : Check Two input


  • Use classpath of module : if it <no-module> change it to project name
  • JRE : check it correctly set
Now project Copy


Thursday, April 23, 2020

CentOS 8 or RedHat 8 : docker run give error - docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.

After successful installation when i Try to test docker installation with sample container it give following error
[yogesh@devBase ~]$ systemctl start docker
[yogesh@devBase ~]$ docker run test
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.

Solution
Step 1 : Check docker group
[yogesh@devBase ~]$ cat /etc/group

docker:x:970:


if docker group does not exist create it

Step 2 : Add user to docker group
[yogesh@devBase ~]$ sudo usermod -aG docker ${USER}

Step 3 : Above two step not solved the problem now check /lib/systemd/system/docker.socket file.

[yogesh@devBase ~]$ ls -l /lib/systemd/system/docker.socket 
-rw-r--r--. 1 root root 197 Mar 11 06:56 /lib/systemd/system/docker.socket
if user and group of this file is root then change group to docker.
[yogesh@devBase ~]$ sudo chgrp docker /lib/systemd/system/docker.socket 
[sudo] password for yogesh: 
[yogesh@devBase ~]$ 
Step 4 : Give permission to group
[yogesh@devBase ~]$ sudo chmod g+w /lib/systemd/system/docker.socket
Step 5 : open new terminal and restart docker. now run docker run hello-world its working perfectly.
[yogesh@devBase ~]$ ls -l /lib/systemd/system/docker.socket 
-rw-rw-r--. 1 root docker 197 Mar 11 06:56 /lib/systemd/system/docker.socket

Wednesday, April 22, 2020

RedHat 8 or CentOS 8 : Docker Installation fails with Error : package docker-ce-3:19.03.8-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed

I have decided to use docker for ease of development of my application. when i installed according to docker documentation it fails and give following error.

[yogesh@devBase ~]$ sudo dnf install docker-ce docker-ce-cli containerd.io
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:00:26 ago on Wed 22 Apr 2020 09:21:50 PM IST.
Error: 
 Problem: package docker-ce-3:19.03.8-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed
  - cannot install the best candidate for the job
  - package containerd.io-1.2.10-3.2.el7.x86_64 is excluded
  - package containerd.io-1.2.13-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.2-3.3.el7.x86_64 is excluded
  - package containerd.io-1.2.2-3.el7.x86_64 is excluded
  - package containerd.io-1.2.4-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.5-3.1.el7.x86_64 is excluded
  - package containerd.io-1.2.6-3.3.el7.x86_64 is excluded
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Solution
To resolve above error first install containerd.io.

[yogesh@devBase ~]$ sudo dnf install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.13-3.1.el7.x86_64.rpm
[sudo] password for yogesh: 
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:07:11 ago on Wed 22 Apr 2020 09:21:50 PM IST.
containerd.io-1.2.13-3.1.el7.x86_64.rpm                                                                                22 kB/s |  23 MB     17:46    
Dependencies resolved.
======================================================================================================================================================
 Package                              Architecture                  Version                                 Repository                           Size
======================================================================================================================================================
Installing:
 containerd.io                        x86_64                        1.2.13-3.1.el7                          @commandline                         23 M
     replacing  runc.x86_64 1.0.0-64.rc9.module_el8.1.0+298+41f9343a

Transaction Summary
======================================================================================================================================================
Install  1 Package

Total size: 23 M
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                              1/1 
  Installing       : containerd.io-1.2.13-3.1.el7.x86_64                                                                                          1/2 
  Running scriptlet: containerd.io-1.2.13-3.1.el7.x86_64                                                                                          1/2 
  Obsoleting       : runc-1.0.0-64.rc9.module_el8.1.0+298+41f9343a.x86_64                                                                         2/2 
  Running scriptlet: runc-1.0.0-64.rc9.module_el8.1.0+298+41f9343a.x86_64                                                                         2/2 
  Verifying        : containerd.io-1.2.13-3.1.el7.x86_64                                                                                          1/2 
  Verifying        : runc-1.0.0-64.rc9.module_el8.1.0+298+41f9343a.x86_64                                                                         2/2 
Installed products updated.

Installed:
  containerd.io-1.2.13-3.1.el7.x86_64                                                                                                                 

Complete!

Once containerd.io install now install docker-ce and docker-ce-cli.
[yogesh@devBase ~]$ sudo dnf install docker-ce docker-ce-cli
[sudo] password for yogesh: 
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
CentOS-8 - AppStream                                                                                                  4.7 kB/s | 4.3 kB     00:00    
CentOS-8 - Base                                                                                                       1.1 kB/s | 3.8 kB     00:03    
CentOS-8 - cr                                                                                                         2.4 kB/s | 3.0 kB     00:01    
CentOS-8 - Extras                                                                                                     1.7 kB/s | 1.5 kB     00:00    
CentOS-8 - PowerTools                                                                                                 2.2 kB/s | 4.3 kB     00:01    
CentOS-8 - Plus                                                                                                       2.7 kB/s | 3.0 kB     00:01    
CentOS-8 - fasttrack                                                                                                  2.7 kB/s | 3.0 kB     00:01    
Amazon Corretto                                                                                                       1.5 kB/s | 2.9 kB     00:01    
Docker CE Stable - x86_64                                                                                             3.1 kB/s | 3.5 kB     00:01    
ELRepo.org Community Enterprise Linux Repository - el8                                                                1.0 kB/s | 2.9 kB     00:02    
ELRepo.org Community Enterprise Linux Repository - el8                                                                 23 kB/s | 147 kB     00:06    
ELRepo.org Community Enterprise Linux Kernel Repository - el8                                                         2.0 kB/s | 2.9 kB     00:01    
ELRepo.org Community Enterprise Linux Kernel Repository - el8                                                          30 kB/s | 939 kB     00:31    
ELRepo.org Community Enterprise Linux Extras Repository - el8                                                         1.8 kB/s | 2.9 kB     00:01    
ELRepo.org Community Enterprise Linux Extras Repository - el8                                                          12 kB/s |  31 kB     00:02    
Extra Packages for Enterprise Linux Modular 8 - x86_64                                                                3.1 kB/s | 9.8 kB     00:03    
Extra Packages for Enterprise Linux 8 - x86_64                                                                        5.8 kB/s | 3.1 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                                                                        9.9 kB/s | 6.4 MB     11:01    
google-chrome                                                                                                         3.5 kB/s | 1.3 kB     00:00    
google-chrome                                                                                                         4.9 kB/s | 3.5 kB     00:00    
RPM Fusion for EL 8 - Free - Updates                                                                                  1.9 kB/s | 3.7 kB     00:01    
RPM Fusion for EL 8 - Nonfree - Updates                                                                               3.8 kB/s | 3.7 kB     00:00    
Dependencies resolved.
======================================================================================================================================================
 Package                             Architecture                 Version                                Repository                              Size
======================================================================================================================================================
Installing:
 docker-ce                           x86_64                       3:19.03.8-3.el7                        docker-ce-stable                        25 M
 docker-ce-cli                       x86_64                       1:19.03.8-3.el7                        docker-ce-stable                        40 M
Installing dependencies:
 libcgroup                           x86_64                       0.41-19.el8                            BaseOS                                  70 k

Transaction Summary
======================================================================================================================================================
Install  3 Packages

Total size: 64 M
Total download size: 64 M
Installed size: 273 M
Is this ok [y/N]: y
Downloading Packages:
[SKIPPED] libcgroup-0.41-19.el8.x86_64.rpm: Already downloaded                                                                                       
[MIRROR] docker-ce-19.03.8-3.el7.x86_64.rpm: Curl error (28): Timeout was reached for https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-19.03.8-3.el7.x86_64.rpm [Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds]
(2/3): docker-ce-cli-19.03.8-3.el7.x86_64.rpm                                                                          37 kB/s |  40 MB     18:14    
(3/3): docker-ce-19.03.8-3.el7.x86_64.rpm                                                                              16 kB/s |  25 MB     25:21    
------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                  43 kB/s |  64 MB     25:21     
warning: /var/cache/dnf/docker-ce-stable-091d8a9c23201250/packages/docker-ce-19.03.8-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Docker CE Stable - x86_64                                                                                             3.5 kB/s | 1.6 kB     00:00    
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <docker@docker.com>"
 Fingerprint: 060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
 From       : https://download.docker.com/linux/centos/gpg
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                              1/1 
  Installing       : docker-ce-cli-1:19.03.8-3.el7.x86_64                                                                                         1/3 
  Running scriptlet: docker-ce-cli-1:19.03.8-3.el7.x86_64                                                                                         1/3 
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                                                 2/3 
  Installing       : libcgroup-0.41-19.el8.x86_64                                                                                                 2/3 
  Running scriptlet: libcgroup-0.41-19.el8.x86_64                                                                                                 2/3 
  Installing       : docker-ce-3:19.03.8-3.el7.x86_64                                                                                             3/3 
  Running scriptlet: docker-ce-3:19.03.8-3.el7.x86_64                                                                                             3/3 
  Verifying        : libcgroup-0.41-19.el8.x86_64                                                                                                 1/3 
  Verifying        : docker-ce-3:19.03.8-3.el7.x86_64                                                                                             2/3 
  Verifying        : docker-ce-cli-1:19.03.8-3.el7.x86_64                                                                                         3/3 
Installed products updated.

Installed:
  docker-ce-3:19.03.8-3.el7.x86_64                 docker-ce-cli-1:19.03.8-3.el7.x86_64                 libcgroup-0.41-19.el8.x86_64                

Complete!
[yogesh@devBase ~]$ docker --help

Usage: docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Options:
      --config string      Location of client config files (default "/home/yogesh/.docker")
  -c, --context string     Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with
                           "docker context use")
  -D, --debug              Enable debug mode
  -H, --host list          Daemon socket(s) to connect to
  -l, --log-level string   Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
      --tls                Use TLS; implied by --tlsverify
      --tlscacert string   Trust certs signed only by this CA (default "/home/yogesh/.docker/ca.pem")
      --tlscert string     Path to TLS certificate file (default "/home/yogesh/.docker/cert.pem")
      --tlskey string      Path to TLS key file (default "/home/yogesh/.docker/key.pem")
      --tlsverify          Use TLS and verify the remote
  -v, --version            Print version information and quit

Management Commands:
  builder     Manage builds
  config      Manage Docker configs
  container   Manage containers
  context     Manage contexts
  engine      Manage the docker engine
  image       Manage images
  network     Manage networks
  node        Manage Swarm nodes
  plugin      Manage plugins
  secret      Manage Docker secrets
  service     Manage services
  stack       Manage Docker stacks
  swarm       Manage Swarm
  system      Manage Docker
  trust       Manage trust on Docker images
  volume      Manage volumes

Commands:
  attach      Attach local standard input, output, and error streams to a running container
  build       Build an image from a Dockerfile
  commit      Create a new image from a container's changes
  cp          Copy files/folders between a container and the local filesystem
  create      Create a new container
  deploy      Deploy a new stack or update an existing stack
  diff        Inspect changes to files or directories on a container's filesystem
  events      Get real time events from the server
  exec        Run a command in a running container
  export      Export a container's filesystem as a tar archive
  history     Show the history of an image
  images      List images
  import      Import the contents from a tarball to create a filesystem image
  info        Display system-wide information
  inspect     Return low-level information on Docker objects
  kill        Kill one or more running containers
  load        Load an image from a tar archive or STDIN
  login       Log in to a Docker registry
  logout      Log out from a Docker registry
  logs        Fetch the logs of a container
  pause       Pause all processes within one or more containers
  port        List port mappings or a specific mapping for the container
  ps          List containers
  pull        Pull an image or a repository from a registry
  push        Push an image or a repository to a registry
  rename      Rename a container
  restart     Restart one or more containers
  rm          Remove one or more containers
  rmi         Remove one or more images
  run         Run a command in a new container
  save        Save one or more images to a tar archive (streamed to STDOUT by default)
  search      Search the Docker Hub for images
  start       Start one or more stopped containers
  stats       Display a live stream of container(s) resource usage statistics
  stop        Stop one or more running containers
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  top         Display the running processes of a container
  unpause     Unpause all processes within one or more containers
  update      Update configuration of one or more containers
  version     Show the Docker version information
  wait        Block until one or more containers stop, then print their exit codes

Run 'docker COMMAND --help' for more information on a command.
[yogesh@devBase ~]$ docker --version
Docker version 19.03.8, build afacb8b
[yogesh@devBase ~]$ 

Docker install successfully.

Tuesday, February 11, 2020

 Administrating USER Account in Oracle


1. Types of USER

As per Oracle documentation, Oracle categories user according to usages.

  • Database Administrator
  • Network Administrator
  • System Administrator
  • Application Developer
  • Database USER


2. Built-in Account

Some Important Built-in account in oracle are- Sys, System, Sysman 

Sys User account -

  • DBA Role - pre-built role, 
  • Own Data Dictionary, 
  • Superuser in Oracle, 
  • Similar to SA in Microsoft SQL Server, or Administrator in Window or root in *inx. 

Relationship between SYS user account SYSDBA privilege- 

Sys is a superuser account in Oracle while sysdba is a privilege that is added to a user account who have a member of the dba group of OS. When a user login by using Sysdba privilege that the user becomes a superuser like SYS user. 


SQLPLUS / as sysdba or connect / as sysdba or connect <someuser> as sysdba


System User Account - 

  • Less Power User than SYS.  
  • Along with the DBA Role System user also has MGMT_USER and AQ_Administrator role. 
  • The system is a safer account for day to day DBA task. 
  • Can't do DATABASE Upgrade, BACKUP and Recovery.

Sysman User Account - 

  • Lower level Default System account having the least power but have more power than a normal user account. 
  • Have MGMT_USER, RESOURCE, and SELECT_CATALOG_ROLE role.


3. How to create a new USER

Component of USER Account

Mandatory Field

Username - Unique Username <= 30 char , Alphanumeric , allowed special characters are $ and _

authentication - Password, or Bimetric, or Certificate, or OS, or external.

Optional Field

tablespace - specify default tablespace and temporary tablespace for the user.

Profile - Password policy, account Security

Schema - Collection of Object owned by USER. username = schema

Saturday, February 8, 2020

Question : How do I open my application with the Launcher app file .desktop

I've a problem with the application Oracle SQL Developer, I can only run it going to the terminal and only with the sudo command. My file is there : /usr/local/bin/sqldeveloper and to open it I have to do sudo sqldeveloper.

Now here is the code of my launcher app :

$ cat /usr/share/applications/Oracle-sqldeveloper.desktop 
[Desktop Entry]
Type=Application
Name=Oracle SQL Developer
Exec=sqldeveloper
Icon=/opt/sqldeveloper/icon.png
Terminal=false >> ~/.local/share/applications/sqldeveloper.desktop

I've already tried to put the full path in the Exec row but nothing, the app doesn't launch, there's the icon in the toolbar few second and it disappears.

Solutions

I also faced same issue, googled lot but nothing got helpful.. BTW I solved this problem by adding absolute path in /usr/share/applications/Oracle-sqldeveloper.desktop. If you want to run sqldeveloper from applications>programming menu then you need to edit your Oracle-sqldeveloper.desktop file. add absolute path which is Exec=/opt/sqldeveloper/sqldeveloper/bin/sqldeveloper in my case also change Terminal=true which show you other problem like java home etc, if java related issue then set according to terminal instruction after that change Terminal=false

 $ sudo vim /usr/share/applications/Oracle-sqldeveloper.desktop

    [Desktop Entry]
    Encoding=UTF-8
    Name=SQL Developer
    Comment=Oracle SQL Developer
    Icon=/opt/sqldeveloper/icon.png
    Exec=/opt/sqldeveloper/sqldeveloper/bin/sqldeveloper
    Terminal=true
    Type=Application
    X-Desktop-File-Install-Version=0.23
    Categories=X-Red-Hat-Extra;Application;Development;
 

Deinstallation of Oracle Database

deinstall stop the oracle software and remove it, including data files and recovery files.

deinstall utility exist in ORACLE_HOME/deinstall directory.

$ [oracle@devBase deinstall]$ pwd
/u01/app/oracle/product/19.3.0/dbhome_1/deinstall

Steps involved in deintallation of Oracle Software and data files.

Step 1 Backup all the data files.

Step 2 Switch into deinstall directory.

Step 3 Enter following command

$ [oracle@devBase deinstall]$ ./deinstall 

It start deinstallation process

Note : On CentOS 8 / RedHat 8 deinstalltion utility stop by throwing an error.

[oracle@devBase deinstall]$ ./deinstall
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /tmp/deinstall2020-02-09_07-19-33AM/logs/

############ ORACLE DECONFIG TOOL START ############


######################### DECONFIG CHECK OPERATION START #########################
## [START] Install check configuration ##


Checking for existence of the Oracle home location /u01/app/oracle/product/19.3.0/dbhome_1
Oracle Home type selected for deinstall is: Oracle Single Instance Database
Oracle Base selected for deinstall is: /u01/app/oracle
Checking for existence of central inventory location /u01/app/oraInventory
ERROR: null

To solve this change CentOS / RedHat version temporarily by entering following command.

[oracle@devBase deinstall]$ export CV_ASSUME_DISTID=RHEL7.6

After that you can successfully execute deinstall utility.

You can also use various flags with deinstall such as -checkonly, -help etc. For complete information on options click here

Oracle Listener Problem : The listener supports no services - lsnrctl status

Question

Hi,



I have installed the Oracle Database 12.1.0 on one my linux box.



When I do a lsnrctl status, I get the following output:



LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 19-MAR-2019 09:42:20





Copyright (c) 1991, 2016, Oracle.  All rights reserved.





Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=X.X.X.X)(PORT=1521)))

STATUS of the LISTENER

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

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production

Start Date                19-MAR-2019 08:02:58

Uptime                    0 days 1 hr. 39 min. 21 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /home/oracle/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora

Listener Log File         /home/oracle/app/oracle/diag/tnslsnr/X.X.X.X/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=X.X.X.X)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

The listener supports no services

The command completed successfully



When I try to connect to this database, I get error saying 'The Network Adapter Could Not establish the connection'

Answer

set local_listener parameter
$ su - oracle 
SQL> show parameter local_listener
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string      

SQL> alter system set local_listener='(ADDRESS =(PROTOCOL=TCP)(HOST=devbase.lambda.asia)(PORT=1539))' scope=both;
SQL> --change the value in red
SQL> -- your problem will be solved

CentOS 8 / RedHat 8 : Download Tor Browser and Install it

We can directly use tor browser , simply by extracting downloaded file. But if we want to configure it as Application menu item (like the below picture) then we follow some steps


Step 1. Download tor Browser and extract it, i extract it under /opt directory.
$ sudo tar -xvjf ~/Downloads/tor-browser-linux64-9.0.4_en-US.tar.xz -C /opt/

Step 2 . Change permission to read and write.
$ sudo chmod -R 775 /opt/tor-browser_en-US 

Step 3. Enter the following command

$ cd /opt/tor-browser_en-US 
$ ./start-tor-browser.desktop --register-app
After this step tor icon appear in the Application > Internet menu

How to install python on CentOS 8 / RedHat 8

Python is most popular programming language nowadays in the world.

By default RHEL/CentOS 8 doesn’t have an unversioned system-wide python command to avoid locking the users to a specific version of Python. Instead, it gives the user a choice to install, configure, and run a specific Python version. The system tools such as yum use an internal Python binary and libraries.

This guide will walk you through installing Python 3 and Python 2 on CentOS 8.

Installing Python 3 on CentOS 8 / RedHat 8

Enter following command to install Python3

$ sudo dnf install python3 
verify python version
$ python3 --version
Python 3.6.8

Installing Python 2 on CentOS 8 / RedHat 8

Enter the following command to install Python2

$ sudo dnf install python2
verify python version
$ python2 --version
Python 2.7.16

Set Default Python version

Use alternatives command to set default python version

For Python version 3

$ sudo alternatives --set python /usr/bin/python3 

For Python Version 2

$ sudo alternatives --set python /usr/bin/python2 

CentOS 8 / RedHat 8 : Installation of youtube-dl

If you configure epel repository then you can easily install youtube-dl package using dnf install youtube-dl .


$ yum info youtube-dl
CentOS-8 - AppStream                                                                                                  242 kB/s | 6.4 MB     00:27    
CentOS-8 - Base                                                                                                       310 kB/s | 5.0 MB     00:16    
CentOS-8 - cr                                                                                                         582  B/s | 257  B     00:00    
CentOS-8 - Extras                                                                                                     2.1 kB/s | 2.1 kB     00:00    
CentOS-8 - PowerTools                                                                                                 224 kB/s | 2.0 MB     00:09    
CentOS-8 - Plus                                                                                                       212 kB/s | 570 kB     00:02    
CentOS-8 - fasttrack                                                                                                  235  B/s | 257  B     00:01    
Amazon Corretto                                                                                                       4.7 kB/s |  13 kB     00:02    
ELRepo.org Community Enterprise Linux Repository - el8                                                                 22 kB/s |  97 kB     00:04    
ELRepo.org Community Enterprise Linux Kernel Repository - el8                                                         182 kB/s | 920 kB     00:05    
ELRepo.org Community Enterprise Linux Extras Repository - el8                                                         9.3 kB/s |  16 kB     00:01    
Extra Packages for Enterprise Linux 8 - Playground - x86_64                                                           121 kB/s | 4.6 MB     00:38    
google-chrome                                                                                                         8.6 kB/s | 3.4 kB     00:00    
RPM Fusion for EL 8 - Free - Updates                                                                                   16 kB/s | 229 kB     00:14    
RPM Fusion for EL 8 - Nonfree - Updates                                                                               9.6 kB/s |  61 kB     00:06    
Available Packages
Name         : youtube-dl
Version      : 2020.01.24
Release      : 1.epel8.playground
Architecture : noarch
Size         : 2.8 M
Source       : youtube-dl-2020.01.24-1.epel8.playground.src.rpm
Repository   : epel-playground
Summary      : A small command-line program to download online videos
URL          : https://yt-dl.org
License      : Unlicense
Description  : Small command-line program to download videos from YouTube and other sites.

The above output show that youtube-dl package available in epel repository. I also installed this package by same method, but it does not work properly.

So I have decided to installed latest version directly from github - https://ytdl-org.github.io/youtube-dl/index.html

Enter following command from terminal

$ sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl 

After fetching file set executable permission on the script
$ sudo chmod a+rx /usr/local/bin/youtube-dl 

After that update the youtube-dl

$ youtube-dl -U 

Prerequisite for youtube-dl

you should have latest version of python.


CentOS 8 / RedHat 8 : Install SDKMAN for all users

After installation of CentOS 8 at my system, I decided to install java using sdkman. So i simply follow the instruction from https://sdkman.io/install

I successfully configured sdkman and also install latest version of jdk. javac and java both are working well in current user. but when i switch to another user both java and javac are not available.

The problem is that everything installed in home directory of current user. for other user sdkman is not available.

After sometimes i found the solution which solved my problem. I have decided to install sdkman globally, which is available for all users.

1. Uninstall sdkman - if you already install it.

Uninstall done into three steps 1. take backup of installed sdkman and then remove it. 

$ tar zcvf ~/sdkman-backup_$(date +%F-%kh%M).tar.gz -C ~/ .sdkman
$ rm -rf ~/.sdkman

After that edit .bashrc, .bash_profile or .profile file and remove sdkman environment settings.

2. Install sdkman to custom location

Decide the location where you want to install sdkman. In my case i install all the software in /opt directory. So I installed it under /opt/local/sdkman.

enter the following command.

$ export SDKMAN_DIR="/opt/local/sdkman" && curl -s "https://get.sdkman.io" | bash

3. Create sdkman.sh inside /etc/profile.d/ directory

create sdkman.sh under profile.d directory and add following lines.

#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/opt/local/sdkman"
[[ -s "/opt/local/sdkman/bin/sdkman-init.sh" ]] && source "/opt/local/sdkman/bin/sdkman-init.sh"

# vim /etc/profile.d/sdkman.sh

#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/opt/local/sdkman"
[[ -s "/opt/local/sdkman/bin/sdkman-init.sh" ]] && source "/opt/local/sdkman/bin/sdkman-init.sh"
# source /etc/profile

SDKMAN available for all the user enjoy :)

Installation of ORACLE 19c at CentOS 8

After installing CentOS 8 , I have decided to install oracle db. With CentOS 7 i used oracle 12c for my work. But when I try to install Oracle 12c at CentOS 8 it show warning INS-13001


By Ignoring this warning message i can install Oracle12c, but i have decided to install Oracle 19c
So I download it from Oracle website. For Linux, Oracle19c have two variant one is rpm and other .zip file. I have decided to download zip file.

Prerequisite of ORACLE 19c For CentOS/ RedHat 8

Server Configuration
Oracle Server Configuration
Machine NameIP AddressProcessorOSMemory
devbase.lambda.asia192.168.0.11 x AMD Athlon™ 64 X2 Dual Core Processor 3800+CentOS 8 (64-bit)8GB


Disk Partition for Oracle Software As per oracle Recommendation
Mount Point UsagesSize
/u01Oracle Database Softwareat least 8 GB
/u02Data fileat least 6 GB but it should be according to your db size
/u03Recovery AreaSame as data file

Server Hardware and Memory Check List
ComponentRecomendationHow To Check
Physical RAMat least 1 GB
#grep MemTotal /proc/meminfo
Swapif 1GB < RAM < 2GB then 1.5 times of RAM
if 2GB < RAM < 16GB then equal to SIZE of RAM
if RAM >16GB then SWAP SIZE is 16 GB
#grep SwapTotal /proc/meminfo
tmp dirat least 1 GB
#df -h /tmp

Oracle Configuration

This section provides instruction how to create the operating system user and groups that will used to manage and install oracle database release 19c.


Create Oracle Software Owner
Description OS Group NameOS User Assigned to  this GroupOracle PrivilegeOracle Group NameHome Directory
Oracle Inventory and Software Owneroinstalloracle/home/oracle
Database Administratordbaoracle,yogeshSYSDBAOSDBA
Database Operatoroperoracle,yogeshSYSOPEROSOPER

# groupadd oinstall
#groupadd dba
#groupadd oper
#useradd -g oinstall -G dba,oper -c "oracle software owner" oracle

Now create password for user oracle
#passwd oracle
Changing password for user oracle.

New password: xxxxxxxxxxx 

Retype new password: xxxxxxxxxxx 

passwd: all authentication tokens updated successfully.
Create Environment variable for user Oracle
# su - oracle
Login to machine using user Oracle and set enviornment variable.
$vim ~/.bash_profile 

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
 . ~/.bashrc
fi

# User specific environment and startup programs
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=devbase.lambda.asia
export ORACLE_UNQNAME=devdb
##########ORACLE BASE #############

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1
export ORA_INVENTORY=/u01/app/oraInventory
export ORACLE_SID=devdb
export PDB_NAME=devdbpdb
export DATA_DIR=/u02/app/oracle/oradata
export GLOBAL_NAME=devdb.lambda.asia
# ---------------------------------------------------
# TNS NAME SETTING
# ---------------------------------------------------
export TNS_ADMIN=$ORACLE_HOME/network/admin
# ---------------------------------------------------
# PATH
# ---------------------------------------------------
# Used by the shell to locate executable programs;
# must include the $ORACLE_HOME/bin directory.
# ---------------------------------------------------
PATH=.:${PATH}:$ORACLE_HOME/bin:/u01/app/oracle/dba_scripts/bin
export PATH

# ---------------------------------------------------
# LD_LIBRARY_PATH
# ---------------------------------------------------
# Specifies the list of directories that the shared
# library loader searches to locate shared object
# libraries at runtime.
# ---------------------------------------------------

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH
# ---------------------------------------------------
# CLASSPATH
# ---------------------------------------------------
# The class path is the path that the Java runtime
# environment searches for classes and other resource
# files. The class search path (more commonly known
# by the shorter name, "class path") can be set using
# either the -classpath option when calling a JDK
# tool (the preferred method) or by setting the
# CLASSPATH environment variable. The -classpath
# option is preferred because you can set it
# individually for each application without affecting
# other applications and without other applications
# modifying its value.
# --------------------------------------------------

CLASSPATH=.:$ORACLE_HOME/jdbc/lib/ojdbc6.jar
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH


Oracle Software Component
Software ComponentVersion
Oracle DatabaseOracle Database Release 19c Zip file

Oracle Database Name
Software ComponentOracle SIDGlobal Database Name
oracle container database(cdb)devdbdevdb.lambda.asia
oracle pluggable databasedevpdbdevpdb.lambda.asia

Oracle Software Component
DiscriptionDirectory
Oracle Base /u01/app/oracle
Oracle Home /u01/app/oracle/product/19.3.0/dbhome_1
Oracle data /u02/app/oracle/oradata
Oracle Recovery Files /u03/app/oracle/flash_recovery_area

Create Oracle Base
# mkdir -p /u01/app/oracle
# chown -R oracle.oinstall /u01/app 
# chmod -R 775 /u01/app 
Create Oracle Home
$ mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1
Create Oracle Data Directory
# mkdir -p /u02/app/oracle/oradata
# chown -R oracle.oinstall /u02/app 
# chmod -R 775 /u02/app 
Create Recovery Directory
# mkdir -p /u03/app/oracle/flash_recovery_area 
# chown -R oracle.oinstall /u03/app 
# chmod -R 775 /u03/app 
 

Configuring  Kernel Parameters for Linux

This section focuses on preparing the CentOS/RedHat 8 machine for Oracle 19c installation. This section include verfying memory and swap space , setting shared memory and semaphores, setting the maximum number of file handles, setting IP local port range.


Following table show the minimum kernel parameter settings
If the current value for any parameter is greater than the value listed in this table, then the Fixup scripts do not change the value of that parameter.
Parameter Value File
semmsl
semmns
semopm
semmni
250
32000
100
128
/proc/sys/kernel/sem
shmall Greater than or equal to the value of shmmax, in pages. /proc/sys/kernel/shmall
shmmax Half the size of physical memory in bytes /proc/sys/kernel/shmmax
shmmni 4096 /proc/sys/kernel/shmmni
panic_on_oops 1 /proc/sys/kernel/panic_on_oops
file-max 6815744 /proc/sys/fs/file-max
aio-max-nr 1048576
Note: This value limits concurrent outstanding requests and should be set to avoclass="tblrow" I/O subsystem failures.
/proc/sys/fs/aio-max-nr
ip_local_port_range Minimum: 9000
Maximum: 65500
/proc/sys/net/ipv4/ip_local_port_range
rmem_default 262144 /proc/sys/net/core/rmem_default
rmem_max 4194304 /proc/sys/net/core/rmem_max
wmem_default 262144 /proc/sys/net/core/wmem_default
wmem_max 1048576 /proc/sys/net/core/wmem_max

1. The kernel parameter need to persist after reboot. there are serveral method to set kernel parameter. In CentOS 8 or RedHat 8  i used /etc/sysctl.d/ and create a file 97-oracle-database-sysctl.conf  file and add kernel parameter in it.
# vim /etc/sysctl.d/97-oracle-database-sysctl.conf 

fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4057989120
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
kernel.panic_on_oops = 1


2. To Change current value of kernel parameter
# /sbin/sysctl --system 

Review the output of above command, if the value is incorrect, edit 97-oracle-database-sysctl.conf file, then enter this command again.
3. Confirm that value are set correctly.
# /sbin/sysctl -a 

4. Restart the system or enter sysctl --system command to make the changes in 97-oracle-database-sysctl.conf file avilable in active memory of kernel.

 Download Oracle19c and extract it

 After above mentioned steps now we need Oracle Software 19c Zip file. Download it from Oracle Website. 
Unzip downloaded file into Oracle Home directory i.e. /u01/app/oracle/product/19.3.0./dbhome_1/

I have downloded Oracle Software under /home/oracle/oracle19c/ . Enter following command to extract zip file to ORACLE Home. Note -> Starting from Oracle 18c, zip file should be extracted into ORACLE Home location.
$ unzip ~/oracle19c/LINUX.X64_193000_db_home.zip -d /u01/app/oracle/product/19.3.0/dbhome_1/ 

Install Prerequisite packages

Nowadays all the required packages are available for Oracle database installation but i Got few errors. So I mentioned thoses and steps i used to solved.

Error-1: /u01/app/oracle/product/19.3.0/dbhome_1/perl/bin/perl: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory

For this check the following perl script
$ ldd /u01/app/oracle/product/19.3.0/dbhome_1/perl/bin/perl
        linux-vdso.so.1 (0x00007ffd0e9b1000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f31d8706000)
        libnsl.so.1 => not found
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f31d82e9000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f31d7f67000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f31d7d3e000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007f31d7b3a000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f31d7776000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f31d755e000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f31d8926000)

To solved this install following packages
dnf install -y libnsl
dnf install -y libnsl.i686
dnf install -y libnsl2
dnf install -y libnsl2.i686
dnf install -y xorg-x11-xauth

Error-2: [WARNING] [INS-08101] Unexpected error while executing the action at state: 'supportedOSCheck' CAUSE: No additional information available. ACTION: Contact Oracle Support Services or refer to the software manual. SUMMARY: - java.lang.NullPointerException
To solve this i enter the following command.
$ export CV_ASSUME_DISTID=RHEL7.6

Now I again start installer.
 $ cd $ORACLE_HOME
$ ./runInstaller
 

POST Installation work

1. Oracle Network Configuration 

After successful installtion of Oracle, we need to configure Listener. and If we want to use tnsname to connect database then we need to configure tnsnames.ora file.

   a. Configuring Listener


Steps Involved in Configuring Listner.

1. Start Listener

$ switch to Oracle user if not 
$ su - oracle
$ -- use lsnrctl command to check listener
$ lsnrctl
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 08-FEB-2020 08:48:51

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=devbase.lambda.asia)(PORT=1539)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date                05-FEB-2020 07:48:08
Uptime                    3 days 1 hr. 1 min. 9 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/19.3.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/devBase/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1539)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/devdb/xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "86b637b62fdf7a65e053f706e80a27ca.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "9dcb836d9b005d05e055000000000001.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "9df280b47456442ee055000000000001.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "devdb.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "devdbXDB.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "devpdb.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
Service "studentpdb.lambda.asia" has 1 instance(s).
  Instance "devdb", status READY, has 1 handler(s) for this service...
The command completed successfully

2. Configure Listener
  •   connect oracle database server using sqlplus / as sysdba
  •   Now check available services use  -  select name from v$services;
  •   Now check listener parameter  use - show parameter listener
  •   Now alter local_listener parameter value if it is not set. two ways 
    • Either use - alter sysetm set local_listener='(ADDRESS = (PROTOCOL=TCP)(HOST=devbase.lambda.asia)(PORT=1539))' scope=both;
    • or use listener alias, Listener alias we can get from lisenter.ora file 
      [oracle@devBase admin]$ cat listener.ora 
      # listener.ora Network Configuration File: /u01/app/oracle/product/19.3.0/dbhome_1/network/admin/listener.ora
      # Generated by Oracle configuration tools.
      
      LISTENER =
        (DESCRIPTION_LIST =
          (DESCRIPTION =
            (ADDRESS = (PROTOCOL = TCP)(HOST = devbase.lambda.asia)(PORT = 1539))
            (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          )
        )
      
      SQL>alter sysetm set local_listener='LISTENER' scope =both;

b . Configure tnsnames.ora

Luckliy Oracle provide us a very handy tools for doing this. it is net manager.  To open net manager in CentOS 8 or RedHat 8 we  enter following command


 $ netmgr & 
Now we configure tnsnames for our servers.



 Connect with PDB

From oracle 12c onwards oracle introduce concept of pluggable database. we can connect pluggable database by following steps

Method using SQLPLUS alter session

1. sqlplus / as sysdba
2. select name,open_mode from v$pdbs;
or 
2. show pdbs;
if open_mount is not in read write then enter following query
3. alter pluggable database all open;
4. now alter session - alter session set container=devpdb;
5. show con_name -> it will present you pluggable database name.

using TNSNAMES.ora configuration

1. conn system/password@devpdb
2. verify that you are connected with pdbs or not show con_name;

Installing Example database

Here I am going to explain how to install example database manually.

Download Script From Github

Starting from Oracle 12.2 , the sample schemas are avialable on github. 


Extract the Downloaded File

Extract downloaded file  directly into the $ORACLE_HOME/demo/schema
$ unzip db-sample-schemas-19.2.zip -d $ORACLE_HOME/demo/schema 

Adjust working directory

Enter the following perl command to replace "_SUB_CWD" tag in the scripts with current working directory

$ cd $ORACLE_HOME/demo/schema
$ perl -p -i.bak -e ‘s#SUB__CWD#’$(pwd)’#g’ *.sql */*.sql */*.dat
 

Install Sample Schema

1. Connect with pdb where you want to create these schema

$ sqlplus / as sysdba
SQL> conn system/password@devpdb
Connected.

2. Create dedicated tablespace

SQL> -- verify tablespace
SQL> select tablespace_name, b.file_name from dba_tablespaces a join dba_data_files b using (tablespace_name); 
TABLESPACE_NAME                FILE_NAME                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
------------------------------ ----------------------------------------------------------------
SYSTEM                         /u02/app/oracle/oradata/DEVDB/devpdb/system01.dbf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
SYSAUX                         /u02/app/oracle/oradata/DEVDB/devpdb/sysaux01.dbf                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
UNDOTBS1                       /u02/app/oracle/oradata/DEVDB/devpdb/undotbs01.dbf                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
USERS                          /u02/app/oracle/oradata/DEVDB/devpdb/users01.dbf 
 
SQL> create tablespace example datafile '/u02/app/oracle/oradata/DEVDB/devpdb/example.dbf'
size 100M AUTOEXTEND ON next 10M 
extent management local;
Tablespace EXAMPLE created.

3. Install sample schemas


SQL> -- Now we run mksample.sql sql script
@mksample systempw syspw hrpw oepw pmpw ixpw shpw bipw example temp /your/path/to/log/ connect_stri
where mksample is located inside $ORACLE_HOME/demo/schema/ 
systempw - System User password
syspw - Sys user password
hrpw - Hr User Password
oepw - OE(Order Entry) user password
pmpw - pm(Print media) user password
ixpw - ix(Information exchange) user password
shpw - sh( Sale history) user password
bipw - bi (business information) user password
example - tablespace
temp - tablespace
/log - log location
connect_string - system/password@devpdb

$ cd $ORACLE_HOME/demo/schema
$ sqlplus / as sysdba
SQL> @?/demo/schema/mksample password password hr oe pm ix sh bi example temp $ORACLE_HOME/demo/schema/log devbase.lambda.asia:1539/devpdb.lambda.asia