Saturday, January 23, 2021

Mount point Error - mount: /dev/sdb1 is write-protected, mounting read-only

 


Error -  mount: /dev/sdb1 is write-protected, mounting read-only



[root@localhost ~]# fdisk -l


Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x000d604e


   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     2099199     1048576   83  Linux

/dev/sda2         2099200    62914559    30407680   8e  Linux LVM


Disk /dev/sdb: 12.9 GB, 12884901888 bytes, 25165824 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/mapper/ol-root: 29.0 GB, 28982640640 bytes, 56606720 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/mapper/ol-swap: 2147 MB, 2147483648 bytes, 4194304 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes


[root@localhost ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).


Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.


Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0xa412a5eb.


Command (m for help): p


Disk /dev/sdb: 12.9 GB, 12884901888 bytes, 25165824 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0xa412a5eb


   Device Boot      Start         End      Blocks   Id  System


Command (m for help): n

Partition type:

   p   primary (0 primary, 0 extended, 4 free)

   e   extended

Select (default p): p

Partition number (1-4, default 1):

First sector (2048-25165823, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-25165823, default 25165823):

Using default value 25165823

Partition 1 of type Linux and of size 12 GiB is set


Command (m for help): p


Disk /dev/sdb: 12.9 GB, 12884901888 bytes, 25165824 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0xa412a5eb


   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048    25165823    12581888   83  Linux


Command (m for help): w

The partition table has been altered!


Calling ioctl() to re-read partition table.

Syncing disks.

[root@localhost ~]#

[root@localhost ~]#




[root@localhost ~]#

[root@localhost ~]# mount /dev/sdb1 /backup/

mount: /dev/sdb1 is write-protected, mounting read-only

mount: unknown filesystem type '(null)'

[root@localhost ~]#



[root@localhost ~]# mount  /dev/sdb1 /backup/

mount: /dev/sdb1 is write-protected, mounting read-only

mount: unknown filesystem type '(null)'

[root@localhost ~]#




[root@localhost ~]#

[root@localhost ~]# mkfs.ext4 /dev/sdb1

mke2fs 1.42.9 (28-Dec-2013)

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

786432 inodes, 3145472 blocks

157273 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2151677952

96 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208


Allocating group tables: done

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done


[root@localhost ~]#

[root@localhost ~]#

[root@localhost ~]#

[root@localhost ~]# mount /dev/sdb1 /backup/

[root@localhost ~]#

[root@localhost ~]#

[root@localhost ~]# df -h

Filesystem           Size  Used Avail Use% Mounted on

devtmpfs             823M     0  823M   0% /dev

tmpfs                847M     0  847M   0% /dev/shm

tmpfs                847M  9.3M  838M   2% /run

tmpfs                847M     0  847M   0% /sys/fs/cgroup

/dev/mapper/ol-root   27G   27G  200M 100% /

/dev/sda1           1014M  217M  798M  22% /boot

tmpfs                170M  8.0K  170M   1% /run/user/42

tmpfs                170M     0  170M   0% /run/user/0

/dev/sdb1             12G   41M   12G   1% /backup

[root@localhost ~]#

[root@localhost ~]#



Entry in fstab



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


#

# /etc/fstab

# Created by anaconda on Wed Jul 29 17:46:25 2020

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

/dev/mapper/ol-root     /                       xfs     defaults        0 0

UUID=df8f6e5c-bd9c-4782-8a03-7d4ecc10fdd4 /boot                   xfs     defaults        0 0

/dev/mapper/ol-swap     swap                    swap    defaults        0 0


UUID=0d604fb0-3675-4e59-8bcc-2f9d8ca8d86d /backup                   ext4     defaults        0 0

[root@localhost ~]#

[root@localhost ~]#


Monday, December 28, 2020

How to solve "find: paths must precede expression:" Error


How to solve Error " find: paths must precede expression" ?



[oracle@xxxx]$ find /dbbackupdrive/XXXXX/export_bkp/ -name *.dmp -mtime -1 -exec ls -lrt {} \;


find: paths must precede expression: expdp_full_db_bkp_Wed23Dec2020.dmp

Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

[oracle@xxxx]$

[oracle@xxxx]$

[oracle@xxxx]$

[oracle@xxxx]$ find /dbbackupdrive/XXXXX/export_bkp/ -name '*.dmp' -mtime -1 -exec ls -lrt {} \;


-rw-r-----. 1 oracle oinstall 6074507264 Dec 28 10:50 /dbbackupdrive/XXXXX/export_bkp/dumpfile_full_XXXXX_20201228.dmp

-rw-r-----. 1 oracle oinstall 6074507264 Dec 28 12:41 /dbbackupdrive/XXXXX/export_bkp/bkp/dumpfile_full_XXXXX_20201228.dmp

[oracle@xxxx]$

[oracle@xxxx]$

Thursday, December 17, 2020

How to Set or Change the Time Zone in Linux OS

How to change Time zone

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


What is Time zone ?

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


Time zone show the geographic region that has the same standard time. Typically the time zone is set during the installation of the operational system, but it can be easily changed after that as well.

Check the Current Time Zone

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

#timedatectl



List of available Time zone

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

Command : timedatectl list-timezones


# timedatectl list-timezones


Output 


......

......

......

Africa/Abidjan

Africa/Accra

Africa/Addis_Ababa

Africa/Algiers

Africa/Asmara

Africa/Bamako

Africa/Bangui

Africa/Banjul

Africa/Bissau

Africa/Blantyre

Africa/Brazzaville

Africa/Bujumbura

Africa/Cairo

Africa/Casablanca

Africa/Ceuta

Africa/Conakry

Africa/Dakar

Africa/Dar_es_Salaam

Africa/Djibouti

Africa/Douala

Africa/El_Aaiun

Africa/Freetown

Africa/Gaborone

Africa/Harare

Africa/Johannesburg

......

......

Asia/Singapore

.......

......

......



Set Time zone 

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

command: timedatectl set-timezone <your_time_zone>


#timedatectl set-timezone Asia/Singapore



Verify time zone 

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


#timedatectl

      Local time: Thu 2020-12-17 23:52:16 +08

  Universal time: Thu 2020-12-17 15:52:16 UTC

        RTC time: Thu 2020-12-17 15:52:15

       Time zone: Asia/Singapore (+08, +0800)

     NTP enabled: yes

NTP synchronized: yes

 RTC in local TZ: no

      DST active: n/a


#date 

Thu Dec 17 23:51:50 +08 2020



Note : After Time zone change need to restart crontab service or if possible take system reboot as best practice.


 

Thursday, December 10, 2020

How to Switch CDB (container) to PDB (pluggable) database in Multitenant

Switch CDB (container) to PDB (pluggable)  database in  multitenant 



[oracle@node2 ~]$ srvctl status database -d orcl

Instance orcl1 is running on node node1

Instance orcl2 is running on node node2

[oracle@node2 ~]$

[oracle@node2 ~]$

[oracle@node2 ~]$

[oracle@node2 ~]$ sqlplus "/as sysdba"


SQL*Plus: Release 12.1.0.2.0 Production on Thu Dec 10 19:56:50 2020


Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Advanced Analytics and Real Application Testing options

SQL>

SQL>

SQL> show pdbs


    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

         2 PDB$SEED                       READ ONLY  NO

         3 PDBORCL                        MOUNTED

SQL>

SQL>

SQL> alter pluggable database PDBORCL open read write;


Pluggable database altered.


SQL> show pdbs


    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

         2 PDB$SEED                       READ ONLY  NO

         3 PDBORCL                        READ WRITE NO

SQL>


SQL> select INSTANCE_NUMBER,INSTANCE_NAME,HOST_NAME,VERSION,STARTUP_TIME,STATUS,EDITION from gv$instance;


INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME                                                        VERSION           STARTUP_T STATUS       EDITION

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

              2 orcl2            node2.localdomain                                                12.1.0.2.0        10-DEC-20 OPEN         EE

              1 orcl1            node1.localdomain                                                12.1.0.2.0        10-DEC-20 OPEN         EE


SQL> show pdbs


    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

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

         2 PDB$SEED                       READ ONLY  NO

         3 PDBORCL                        READ WRITE NO

SQL>

SQL> show con_name


CON_NAME

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

CDB$ROOT

SQL>

SQL>

SQL> show con_id


CON_ID

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

1

SQL>

SQL> alter session set container=PDBORCL;


Session altered.


SQL> show con_name


CON_NAME

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

PDBORCL

SQL> show con_id


CON_ID

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

3

SQL>

SQL>




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


[oracle@node1 trace]$ crsctl stat res -t
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA1.dg
               ONLINE  ONLINE       node1                    STABLE
               ONLINE  ONLINE       node2                    STABLE
ora.LISTENER.lsnr
               ONLINE  ONLINE       node1                    STABLE
               ONLINE  ONLINE       node2                    STABLE
ora.asm
               ONLINE  ONLINE       node1                    Started,STABLE
               ONLINE  ONLINE       node2                    Started,STABLE
ora.net1.network
               ONLINE  ONLINE       node1                    STABLE
               ONLINE  ONLINE       node2                    STABLE
ora.ons
               ONLINE  ONLINE       node1                    STABLE
               ONLINE  ONLINE       node2                    STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       node2                    STABLE
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       node1                    STABLE
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       node1                    STABLE
ora.MGMTLSNR
      1        ONLINE  ONLINE       node1                    169.254.18.158,STABL
                                                             E
ora.cvu
      1        ONLINE  ONLINE       node1                    STABLE
ora.mgmtdb
      1        ONLINE  ONLINE       node1                    Open,STABLE
ora.node1.vip
      1        ONLINE  ONLINE       node1                    STABLE
ora.node2.vip
      1        ONLINE  ONLINE       node2                    STABLE
ora.oc4j
      1        ONLINE  UNKNOWN      node1                    CHECK TIMED OUT,STAB
                                                             LE
ora.orcl.db
      1        ONLINE  ONLINE       node1                    Open,STABLE
      2        ONLINE  ONLINE       node2                    Open,STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       node2                    STABLE
ora.scan2.vip
      1        ONLINE  ONLINE       node1                    STABLE
ora.scan3.vip
      1        ONLINE  ONLINE       node1                    STABLE
--------------------------------------------------------------------------------
[oracle@node1 trace]$