Friday, August 23, 2019

SQLplus user profile; showing connection name in the sqlplus prompt

SQLplus user profile is maintained in the file glogin.sql which is executed at the time of login in to a database connection. The default location of this file is

 $ORACLE_HOME/sqlplus/admin/

Usually when a query is executed through sqlplus terminal, at first it tries to fetch profile form the current directory, if no there in that case from the default location.

Suppose, by defualt if we connect to a database using  sqlplus, it dones not show the connected database information in the screen.  It only prompts with: 

sqlplus>

Now if we want to  show the connected database information in the sqlplus command line as:

username@db_connect_name>

In that case, we cas easily do that by modification in the glogin file as below:

set sqlprompt "_user '@' _connect_identifier >"



There are some other keywords for using in glogin file as:

SET LINESIZE
Followed by a number, sets the number of characters as page width of the query results.
SET NUMFORMAT
Followed by a number format (such as $99,999), sets the default format for displaying numbers in query results.
SET PAGESIZE
Followed by a number, sets the number of lines per page.
SET PAUSE
Followed by ON, causes SQL*Plus to pause at the beginning of each page of output (SQL*Plus continues scrolling after you enter Return). Followed by text, sets the text to be displayed each time SQL*Plus pauses (you must also set PAUSE to ON).
SET SQLPROMPT
Followed by the connect information variable in the form:
SET SQLPROMPT '&_CONNECT_IDENTIFIER > '
changes the SQL*Plus command-line prompt to display the SID of the database you are connected to.
SET TIME
Followed by ON, displays the current time before each command prompt.


Thursday, August 22, 2019

Removing particular Host name form SSH known_host list

To remove a specific host from the SSH known_hosts list. we can use the below command:

ssh-keygen -R hostname
Instead of hostname, we can directly use the IP also.

 If we want to remove non-standard ssh port,  then we can use this format

ssh-keygen -R [ssh.xxx.com]:[port no]



Wednesday, August 21, 2019

Stop NetworkManager to overwrite /etc/resolv.conf

Network manager overwrite the /etc/resolv.conf file. To stop overwriting this file. We can follwo the below steps

# systemctl disable NetworkManager.service
# systemctl stop NetworkManager.service
Or If we don't want to stop or disable the network manager service, in that case. We will have to tell NetwoekManager not to modify the DNS settings:

 /etc/NetworkManager/NetworkManager.conf
 [main]
 dns=none

SSH Server related basic command

Install

To install the openssh-server, you need to install the openssh-server package:
sudo dnf install -y openssh-server;

Start

To start the sshd daemon (openssh-server) in the current session:
sudo systemctl start sshd.service;

Stop

To stop the active (if any) sshd daemon in the current session:
sudo systemctl stop sshd.service;

Enable

To configure the sshd daemon to start automatically at boot time:
sudo systemctl enable sshd.service;
You will get an output similar to this:
ln -s '/usr/lib/systemd/system/sshd.service' '/etc/systemd/system/multi-user.target.wants/sshd.service'

Disable

To configure the sshd daemon to stop automatic initialization at boot time:


sudo systemctl disable sshd.service;