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.