Tuesday, April 30, 2019

Azure icon sets


Need get PNG, SVG icons for Microsoft Azure services, components, etc. Who struggled with presentations, will understand..


Excellent article from Microsoft MVP Chris Pietschmann - Microsoft Azure Icon Set Download – Visio stencil, PowerPoint, PNG, SVG

Icon set can be found at: https://www.microsoft.com/en-us/download/details.aspx?id=41937

ORA-01102: cannot mount database in EXCLUSIVE mode


ORA-01102: cannot mount database in EXCLUSIVE mode during database instance startup

sqlplus / as sysdba
QL*Plus: Release Production on Tue Apr 30 21:26:57 2019

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

Connected to an idle instance.

SQL> startup;
ORACLE instance started.

Total System Global Area 6174015488 bytes
Fixed Size                  8634320 bytes
Variable Size            1241514032 bytes
Database Buffers         4915724288 bytes
Redo Buffers                8142848 bytes
ORA-01102: cannot mount database in EXCLUSIVE mode


Same as https://sk.solutionmentors.com/2019/04/ora-01012-not-logged-on-startup-failed.html, seems this problem appeared because database was not stopped properly.

Follow great article http://www.dba-oracle.com/t_ora_01102_cannot_mount_database_in_exclusive_mode.htm


Verify that the database was shutdown cleanly by doing the following:

1. Verify that there is not a "sgadef<sid>.dbf" file in the directory

% ls $ORACLE_HOME/dbs/sgadef<sid>.dbf

If this file does exist, remove it.

% rm $ORACLE_HOME/dbs/sgadef<sid>.dbf

2. Verify that there are no background processes owned by "oracle"

% ps -ef | grep ora_ | grep $ORACLE_SID

If background processes exist, remove them by using the Unix
command "kill". For example:

% kill -9 <Process_ID_Number>

3. Verify that no shared memory segments and semaphores that are owned
by "oracle" still exist

% ipcs -b

If there are shared memory segments and semaphores owned by "oracle",
remove the shared memory segments

% ipcrm -m <Shared_Memory_ID_Number>

and remove the semaphores

% ipcrm -s <Semaphore_ID_Number>

NOTE: The example shown above assumes that you only have one
database on this machine. If you have more than one
database, you will need to shutdown all other databases
before proceeding with Step 4.

4. Verify that the "$ORACLE_HOME/dbs/lk<sid>" file does not exist. This is what caused issue in our case. Simple removal of this file did the trick.

5. Startup the instance

Related issues


ORA-01012: not logged on startup failed


Getting ORA-01012: no logged on startup failed during database startup


This behavior in our case caused by "disgraceful" database shutdown.. Seems like zombie Oracle processes existed that prevented database instance from starting up.

sysresv utility allows to diagnose orphaned shared memory segments.

> sysresv

IPC Resources for ORACLE_SID "<your SID>" :
Maximum shared memory segment size (shmmax): 8589934592 bytes
Total system shared memory (shmall): 6871949312 bytes
Total system shared memory count (shmmni): 4096
*********************** Dumping ipcs output ********************
------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 0          oracle     600        8634368    891
0x00000000 32769      oracle     600        6157238272 446
0x00000000 65538      oracle     600        8142848    446
0x9ab568e0 98307      oracle     600        28672      446

------ Semaphore Arrays --------
key        semid      owner      perms      nsems
0x1d625978 98304      oracle     600        227
0x1d625979 131073     oracle     600        227
0x1d62597a 163842     oracle     600        227

*********************** End of ipcs commanddump **************

***************** Dumping Resource Limits(s/h) *****************
core file size                         0 KB/UNLIMITED
data seg size                     UNLIMITED/UNLIMITED
scheduling priority                    0 KB/0 KB
file size                         UNLIMITED/UNLIMITED
pending signals                       63 KB/63 KB
max locked memory                     14 GB/14 GB
max memory size                   UNLIMITED/UNLIMITED
open files                            64 KB/64 KB
POSIX message queues                 800 KB/800 KB
real-time priority                     0 KB/0 KB
stack size                            32 MB/32 MB
cpu time                          UNLIMITED/UNLIMITED
max user processes                    16 KB/16 KB
virtual memory                    UNLIMITED/UNLIMITED
file locks                        UNLIMITED/UNLIMITED

***************** End of Resource Limits Dup ******************

Maximum map count configured per process:  65530
Total /dev/shm size: 8403361792 bytes, used: 0 bytes
Shared Memory:
ID              KEY
32769           0x00000000
65538           0x00000000
0               0x00000000
98307           0x9ab568e0
ID              KEY
98304           0x1d625978
131073          0x1d625979

Kill memory segments

ipcrm -m <Shared Memory ID>

 Kill semaphores

ipcrm -s <Semaphore>

Try to startup database instance again.

ORA-27125: unable to create shared memory segment during startup


After reboot, unable to startup Oracle 12c database instance (Red Hat Enterprise Server 7.6)

ORA-27125: unable to create shared memory segment
Linux-x86_64 Error: 28: No space left on device
Additional information: 3822
Additional information: 6157238272


Verify OS kernel.shmall memory setting.

1. Get current value 
cat /proc/sys/kernel/shmall

This seems to be too high..

2. Determine page size
getconf PAGE_SIZE

3. Calculate recommended value for shmall

shmall = <total size of SGA>/<page size>

In our case, we have 16GB RAM, so, shmall = 16 * 1024 * 1024 * 1024 / 4096 = 4194304

4. Update /etc/sysctl.conf
vi /etc/sysctl.conf
sudo sysctl -p

5. Verify  kernel.shmall again
cat /proc/sys/kernel/shmall

6. Start Oracle instance
sudo su - oracle
sqlplus / as sysdba

This of course leads to another error..


Formula to set proper values for max processes, sessions and transactions in Oracle


Need to adjust max number of sessions in Oracle DB.


Standard formula looks like:

PROCESSES = Operating System Dependant

alter system set sessions=1000 scope=spfile;
alter system set processes=905 scope=spfile;
alter system set transactions=1100 scope=spfile;

shutdown immediate;

Wednesday, April 24, 2019

How to get external IP for Linux VMs on Azure


How to get external IP for Linux VMs on Azure


dig +short myip.opendns.com @resolver1.opendns.com 

Change mount point for /mnt folder in Ubuntu Linux on Azure


When provisioning Linux VMs on Azure, /mnt folder is automatically created and pointed to Resource Disk. In some case, we need to have more fine-grained control over /mnt folder (for instance for backward compatibility) and map Resource Disk to its sub-folder, e.g. /mnt/tmp


Azure provides fantastic support for Linux VMs called Microsoft Azure Linux Agent.

sudo service waagent restart
vi /etc/waagent.conf 
# Mount point for the resource disk

 Restart waagent service

 sudo service waagent restart

Install telnet client from command line on Windows Server


Need to install telnet client on Windows Server 2012, 2016


pkgmgr /iu:”TelnetClient”