Wednesday, December 27, 2023

12 essential Linux commands for beginners

 

I recommend these commands to anyone who is getting started with Linux.

1. Print working directory (pwd)

The pwd command prints your working directory. In other words, it outputs the path of the directory you are currently working in. There are two options: --logical to display your location with any symlinks and --physical to display your location after resolving any symlinks.

2. Make directory (mkdir)

Making directories is easy with the mkdir command. The following command creates a directory called test unless test already exists:

$ mkdir test

You can make directories within directories:

$ mkdir -p test/one/two

If directories test and one already exist, only directory two is created. If none of them exist, then three nested directories are created.

3. List (ls)

Coming from MS-DOS, I was used to listing files with the dir command. I don't recall working on Linux at the time, although today, dir is in the GNU Core Utilities package. Most people use the ls command to display the files, along with all their properties, are in a directory. The ls command has many options, including -l to view a long listing of files, displaying the file owner and permissions.

4. Change directory (cd)

It is often necessary to change directories. That's the cd command's function. For instance, this test takes you from your home directory into the Downloads directory:

$ cd Downloads

You can quickly change to your home directory with cd ~ or just cd on most systems. You can use cd .. to move up a level.

5. Remove a file (rm)

Removing files is inherently dangerous. Traditionally, the Linux terminal has no Trash or Bin like the desktop does, so many terminal users have the bad habit of permanently removing data they believe they no longer need. There's no "un-remove" command, though, so this habit can be problematic should you accidentally delete a directory containing important data.

A Linux system provides rm and shred for data removal. To delete file read.txt, type the following:

$ rm read.txt

However, it's much safer to install a trash command, such as trashy or trash-cli. Then you can send files to a staging area before deleting them forever:

$ trash read.txt

6. Copy a file (cp)

Copy files with the cp command. The syntax is copy from-here to-there. Here's an test:

$ cp test1.txt newtest1.txt

You can copy entire directories, too:

$ cp -r dir1 newdirectory

7. Move and rename a file (mv)

Renaming and moving a file is functionally the same process. When you move a file, you take a file from one directory and put it into a new one. When renaming a file, you take a file from one directory and put it back into the same directory or a different directory, but with a new name. Either way, you use the mv command:

$ mv test1.txt file_test1.txt

8. Create an empty file (touch)

Easily create an empty file with the touch command:

$ touch one.txt

 

$ touch two.txt

 

$ touch three.md

9. Change permissions (chmod)

Change the permissions of a file with the chmod command. One of the most common uses of chmod is making a file executable:

$ chmod +x myfile

This test is how you give a file permission to be executed as a command. This is particularly handy for scripts. Try this simple exercise:

$ echo 'echo Hello $USER' > hello.sh

 

$ chmod +x hello.sh

 

$ ./hello.sh

Hello, TOM

10. Escalate privileges (sudo)

While administering your system, it may be necessary to act as the super user (also called root). This is where the sudo (or super user do) command comes in. Assuming you're trying to do something that your computer alerts you that only an administrator (or root) user can do, just preface it with the command sudo:

$ touch /etc/os-release && echo "Success"

touch: cannot touch '/etc/os-release': Permission denied

 

$ sudo touch /etc/os-release && echo "Success"

Success

11. Shut down (poweroff)

The poweroff command does exactly what it sounds like: it powers your computer down. It requires sudo to succeed.

There are actually many ways to shut down your computer and some variations on the process. For instance, the shutdown command allows you to power down your computer after an arbitrary amount of time, such as 60 seconds:

$ sudo shutdown -h 60

Or immediately:

$ sudo shutdown -h now

You can also restart your computer with sudo shutdown -r now or just reboot.

12. Read the manual (man)

The man command could be the most important command of all. It gets you to the documentation for each of the commands on your Linux system. For instance, to read more about mkdir:

$ man mkdir

 

Friday, December 22, 2023

Restore points and Flashback database || Normal vs Guaranteed restore points | Oracle DBA Tutorial

 Oracle Database Restore points and Flashback database || Normal vs Guaranteed restore point.





Your comments encourage us to produce quality content, please take a second and say ‘Hi’ in the comments and let me and my team know what you thought of the video … p.s. It would mean the world to me if you hit the subscribe button ;) ...
   / @entopdba501  
To know more about us, visit our website - https://afgdba.blogspot.com/ ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ Connect with us in Social Media 🢂 YouTube Channel:    / @entopdba501   Facebook page :   / afgblog   Linkedin Profile :  / ahmad-ali-mohammadi-a32942111  

How to Create, Alter, Resize, Drop Tablespace | Tablespace Management part# 1

 Hello everyone welcome to one of another ENTOPDBA tutorial.

in this tutorial we are going to learn bellow concepts: a. Alter tablespace datafile using file_id and file_name and resize datafile. b. How to check Tablespace Size. c. How to check datafile Size in MB. d. How to drop Tablespace including contents and all Datafiles of these tablespace.





Please do follow me and support me on, Subscribe for more videos just like this: https://www.youtube.com/@entopdba501?... YouTube: https://www.youtube.com/@entopdba501?... Website: https://afgdba.blogspot.com/ Regards, ENTOPDBA

How to change oracle database instance name using NID utility

 Hello everyone, in this article we are going to learn how to rename a database instance name using the NID utility step by step. So in this demo, we are going to rename the OEM database name to OEMNEW.

for your Info Before the NID utility, we can rename the database instance name using creating a new control file that was the manual method, but after the NID utility, our task is now easy to change the database instance name.


Please do follow me and support me on, Subscribe for more videos just like this:
https://www.youtube.com/@entopdba501?... YouTube: https://www.youtube.com/@entopdba501?... Website: https://afgdba.blogspot.com/ Regards, ENTOPDBA


Sunday, October 22, 2023

How to Use DATA PUMP to migrate to OCI autonomous database | oracle DBA Tutorial

 In this Oracle Tutorial you will learn how to Use DATA PUMP to migrate to OCI autonomous database using Parameter File (PARFILE) in Data Pump expdp export utility.



Please do follow me and support me on,

Subscribe for more videos just like this: https://www.youtube.com/@entopdba501?sub_confirmation=1

YouTube: https://www.youtube.com/@entopdba501?sub_confirmation=1

Facebook: https://www.facebook.com/afgblog


Website:  https://afgdba.blogspot.com/




Regards,

ENTOPDBA

email: entopdba@gmail.com


Monday, August 7, 2023

Useful Oracle 19c RAC Commands

Oracle oracle 19c rac commands, oracle 19c rac crsctl commands, oracle 19c rac srvctl commands, oracle 19c rac start sequence, oracle 19c rac stop sequence, oracle 19c rac stop/start one node

WHAT IS THE DIFFERENCE BETWEEN SRVCTL AND CRSCTL?

SERVER CONTROL UTILITY (SRVCTL)

Server Control Utility (SRVCTL): It is used to administer Oracle Real Application Clusters (Oracle RAC) databases and instances.

Use SRVCTL to manage Oracle supplied resources such as:

  • Database
  • Listener
  • Instances
  • Disk groups
  • Networks

If resource name begins with ora then use SRVCTL. Oracle suggest DBAs to use srvctl command to stop/start the databases.

We can use the SRVCTL to manage configuration information.  Use SRVCTL commands to add, remove, start, stop, modify, enable, and disable a number of entities, such as Databases, instances, listeners, SCAN listeners, services, grid naming Service (GNS), and Oracle ASM.

CLUSTERWARE CONTROL UTILITY (CRSCTL)

Clusterware Control Utility (CRSCTL): It is used to managed oracle clusterware resources and components.

Use CRSCTL for managing Oracle Clusterware and its resources. CRSCTL command is used to manage the elements of the clusterware like crs, css, evm.

CRSCTL manages Oracle Clusterware related operations like:

  • Starting and stopping Oracle Clusterware
  • Enabling and disabling Oracle Clusterware daemons
  • Checking the health of the cluster
  • Registering cluster resources

SERVER CONTROL UTILITY (SRVCTL) – DATABASE RELATED COMMANDS

srvctl -help >>> List All Commands With Syntax

srvctl status listener -n node1 >>> Check Listener Status Of Specific Node
srvctl status listener >>> Check Listener Status Of All Nodes

srvctl start listener -n node1 >>> Start Listener On Specific Node
srvctl start listener >>> Start Listener On All Nodes

srvctl stop listener -n node1 >>> Stop Listener On Specific Node
srvctl stop listener >>> Stop Listener On All Nodes

srvctl status instance -d TEST -i TEST1 >>> Check Status Of Specific Instance
srvctl status database -d TEST >>> Check Status Of All Instances

srvctl start instance -d TEST -i TEST1 >>> Starts Specific Instance
srvctl start database -d TEST >>> Starts All Instances (+Open Database)

srvctl start database -d TEST -o nomount >>> Starts Service As Nomount
srvctl start database -d TEST -o mount >>> Starts Service As Mount
srvctl start database -d TEST -o open >>> Starts Service As Open

srvctl stop instance -d TEST -i TEST1 >>> Stops Specific Instance
srvctl stop database -d TEST >>> Stops All Instances (+Shutdown Database)

srvctl stop database -d TEST -o normal >>> Stops Service As Normal
srvctl stop database -d TEST -o immediate >>> Stops Service As Immediate
srvctl stop database -d TEST -o transactional >>> Stops Service As Transactional
srvctl stop database -d TEST -o abort >>> Stops Service As Abort

srvctl config database >>> Check Registered Databases In The Repository
srvctl config database -d TEST >>> Check Specific Database Configuration

CLUSTERWARE CONTROL UTILITY (CRSCTL) – CLUSTER RELATED COMMANDS

crsctl config has >>> Check Oracle HAS (High Availabilty Services) Config
crsctl disable has >>> Disable Automatic Startup Of The Oracle High Availability Services
crsctl enable has >>> Enable Automatic Startup Of The Oracle High Availability Services

crsctl check crs >>> Check Oracle High Availability Services On The Local Server.
crsctl stop crs >>> Stop Oracle High Availability Services On The Local Server.
crsctl start crs >>> Start Oracle High Availability Services On The Local Server.

crsctl query crs softwareversion >>> Check Oracle Clusterware Software Version
crsctl query crs activeversion >>> Check Oracle Clusterware Acitve Version
crsctl query crs releaseversion >>> Check Oracle Clusterware Release Version

OTHER USEFUL COMMANDS

show parameter CLUSTER_DATABASE; >>> Check Database Running As Cluster Or Not.

 

select instance_name, host_name, archiver, thread#, status from gv$instance; >>> Check RAC Status.

SHUTDOWN SEQUENCE OF ONLY ONE NODE IN A CLUSTER

Check Database And ASM Instance
[root@node1 ~]# ps -ef | grep pmon | grep -v grep
grid 9901 1 0 Sept10 ? 00:00:04 asm_pmon_+ASM1
oracle 16761 1 0 03:00 ? 00:00:00 ora_pmon_TEST1
[root@node1 ~]#

Check And Stop Instance
[root@node1 ~]# srvctl status instance -d TEST -i TEST1
[root@node1 ~]# srvctl stop instance -d TEST -i TEST1
[root@node1 ~]# srvctl status instance -d TEST -i TEST1

Check And Stop Oracle High Availability Services On The Local Server
[root@node1 ~]# crsctl check crs
[root@node1 ~]# crsctl stop crs
[root@node1 ~]# crsctl check crs

Check Database And ASM Instance
[root@node1 ~]# ps -ef | grep pmon | grep -v grep
[root@node1 ~]#

STARTUP SEQUENCE OF ONLY ONE NODE IN A CLUSTER

Check And Scan ASM Discs
[root@node1 ~]# ll /dev/oracleasm/disks/
[root@node1 ~]# oracleasm scandisks
[root@node1 ~]# ll /dev/oracleasm/disks/

Check And Start Oracle High Availability Services On The Local Server
[root@node1 ~]# crsctl check crs
[root@node1 ~]# crsctl start crs
[root@node1 ~]# crsctl check crs

Check And Start Instance
[root@node1 ~]# srvctl status instance -d TEST -i TEST1
[root@node1 ~]# srvctl start instance -d TEST -i TEST1
[root@node1 ~]# srvctl status instance -d TEST -i TEST1

Check Database And ASM Instance
[root@node1 ~]# ps -ef | grep pmon | grep -v grep
grid 9522 1 0 Aug 10 ? 00:00:03 asm_pmon_+ASM1
oracle 12756 1 0 08:00 ? 00:00:00 ora_pmon_TEST1

[root@node1 ~]# 

Logical Standby in Oracle Data Guard Overview

  In Oracle Data Guard , a Logical Standby Database is a standby database that: Receives redo data from the Primary database Convert...