Wednesday, March 20, 2024
RDS Oracle Switchover Activity
Thursday, March 14, 2024
ERROR: Unable to verify the graphical display setup. This application requires X display. Make sure that xdpyinfo exist under PATH variable.
RPM required to enable X11 display on Linux
---------------------------------------------
Enabling SSH login as root user on Red Hat Enterprise Linux 9 - AWS EC2
Enabling SSH login as root user on Red Hat Enterprise Linux 9 (AWS EC2)
login as root user
cd /etc/ssh/sshd_config.d
[root@ip-110.1.1.1.1 sshd_config.d]# ls -lrt
total 8
-rw-------. 1 root root 719 Jan 8 12:31 50-redhat.conf
-rw-------. 1 root root 27 Mar 14 16:19 50-cloud-init.conf
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]# vi 50-cloud-init.conf
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]# systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: enabled)
Active: active (running) since Thu 2024-03-14 16:17:41 UTC; 1min 49s ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 1301 (sshd)
Tasks: 1 (limit: 50306)
Memory: 1.4M
CPU: 39ms
CGroup: /system.slice/sshd.service
└─1301 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal systemd[1]: Starting OpenSSH server daemon...
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal sshd[1301]: Server listening on 0.0.0.0 port 22.
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal sshd[1301]: Server listening on :: port 22.
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal systemd[1]: Started OpenSSH server daemon.
Mar 14 16:17:51 ip-110.1.1.1.1.ec2.internal sshd[1302]: error: Received disconnect from 150.242.66.235 port 9857:14: No supp>
Mar 14 16:17:51 ip-110.1.1.1.1.ec2.internal sshd[1302]: Disconnected from authenticating user oracle 150.242.66.235 port 985>
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]# systemctl stop sshd
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]# systemctl status sshd
○ sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: enabled)
Active: inactive (dead) since Thu 2024-03-14 16:19:45 UTC; 2s ago
Duration: 2min 3.674s
Docs: man:sshd(8)
man:sshd_config(5)
Process: 1301 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 1301 (code=exited, status=0/SUCCESS)
CPU: 41ms
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal systemd[1]: Starting OpenSSH server daemon...
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal sshd[1301]: Server listening on 0.0.0.0 port 22.
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal sshd[1301]: Server listening on :: port 22.
Mar 14 16:17:41 ip-110.1.1.1.1.ec2.internal systemd[1]: Started OpenSSH server daemon.
Mar 14 16:17:51 ip-110.1.1.1.1.ec2.internal sshd[1302]: error: Received disconnect from 150.242.66.235 port 9857:14: No supp>
Mar 14 16:17:51 ip-110.1.1.1.1.ec2.internal sshd[1302]: Disconnected from authenticating user oracle 150.242.66.235 port 985>
Mar 14 16:19:45 ip-110.1.1.1.1.ec2.internal sshd[1301]: Received signal 15; terminating.
Mar 14 16:19:45 ip-110.1.1.1.1.ec2.internal systemd[1]: Stopping OpenSSH server daemon...
Mar 14 16:19:45 ip-110.1.1.1.1.ec2.internal systemd[1]: sshd.service: Deactivated successfully.
Mar 14 16:19:45 ip-110.1.1.1.1.ec2.internal systemd[1]: Stopped OpenSSH server daemon.
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]# systemctl start sshd
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]# systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: enabled)
Active: active (running) since Thu 2024-03-14 16:19:58 UTC; 3s ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 1327 (sshd)
Tasks: 1 (limit: 50306)
Memory: 1.3M
CPU: 11ms
CGroup: /system.slice/sshd.service
└─1327 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
Mar 14 16:19:58 ip-110.1.1.1.1.ec2.internal systemd[1]: Starting OpenSSH server daemon...
Mar 14 16:19:58 ip-110.1.1.1.1.ec2.internal sshd[1327]: Server listening on 0.0.0.0 port 22.
Mar 14 16:19:58 ip-110.1.1.1.1.ec2.internal sshd[1327]: Server listening on :: port 22.
Mar 14 16:19:58 ip-110.1.1.1.1.ec2.internal systemd[1]: Started OpenSSH server daemon.
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
[root@ip-110.1.1.1.1 sshd_config.d]#
Oracle SHMMAX and SHMALL parameters
SHMMAX and SHMALL parameters
QUESTION 1
===========
What is the maximum value of SHMMAX for a 32-bit (x86) Linux system?
Oracle Global Customer Support officially recommends a " maximum" for SHMMAX of just less than 4Gb, or 4294967295.
The maximum size of a shared memory segment is limited by the size of the available user address space. On 32-bit systems, this is a theoretical 4GB. The maximum possible value for SHMMAX is just less than 4Gb, or 4294967295. Setting SHMMAX to 4GB exactly will give you 0 bytes as max, as this value is interpreted as a 32-bit number and it wraps around.
QUESTION 2
===========
What is the maximum value of SHMMAX for a 64-bit (x86-64) Linux system?
Oracle Global Customer Support officially recommends a " maximum" for SHMMAX of "1/2 of physical RAM".
System Parameters
SHMMAX - kernel parameter controlling maximum size of one shared memory segment
SHMMNI - kernel parameter controlling maximum number of shared memory segments in the system
SHMSEG - kernel parameter controlling maximum number of shared memory segments a process can attach
SEMMNS - kernel parameter controlling maximum number of semaphores in the system
SEMMNI - kernel parameter controlling maximum number of semaphore sets. Semaphores in Unix are allocated in sets of 1 to SEMMSL.
SEMMSL - kernel parameter controlling maximum number of semaphores in a semaphore set.
SHMLBA - kernel parameter controlling alignment of shared memory segments; all segments must be attached at multiples of this value.
Typically, non-tunable.
SHMMAX is the maximum size of a single shared memory segment set in "bytes"
[root@ip-10.1.1.1.1 ~]# cat /proc/sys/kernel/shmmax
18446744073692774399
[root@ip-10.1.1.1.1 ~]#
SHMALL is the total size of Shared Memory Segments System wide set in "pages".
[root@ip-10.1.1.1.1 ~]# cat /proc/sys/kernel/shmall
18446744073692774399
[root@ip-10.1.1.1.1 ~]#
The key thing to note here is the value of SHMMAX is set in “bytes” but the value of SHMMALL is set in “pages”.
As SHMALL is the total size of Shard Memory Segments System wide, it should always be less than the Physical Memory on the System and should be greater than sum of SGA’s of all the oracle databases on the server. Once this value (sum of SGA’s) hit the limit, i.e. the value of shmall, then any attempt to start a new database (or even an existing database with a resized SGA) will result in an “out of memory” error (below). This is because there won’t be any more shared memory segments that Linux can allocate for SGA.
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device.
Setting the value for SHMALL to optimal is straight forward. All you want to know is how much “Physical Memory” (excluding Cache/Swap) you have on the system and how much of it should be set aside for Linux Kernel and to be dedicated to Oracle Databases
example
[root@ip-10.1.1.1.1 ~]# free -g
total used free shared buff/cache available
Mem: 7 0 5 0 1 7
Swap: 0 0 0
[root@ip-10.1.1.1.1 ~]#
Let say the Physical Memory of a system is 7GB, out of which you want to set aside 2GB for Linux Kernel for OS Operations and dedicate the rest of 5GB to Oracle Databases. Then here’s how you will get the value for SHMALL.
[root@ip-10.1.1.1.1 ~]# getconf PAGE_SIZE
4096
[root@ip-10.1.1.1.1 ~]#
or
[root@ip-10.1.1.1.1 ~]# cat /proc/sys/kernel/shmmni
4096
[root@ip-10.1.1.1.1 ~]#
Convert 5GB into bytes and divide by page size
5gb = 5*1024*1024*1024 = 5,368,709,120 bytes /4096
= 1310720
[root@ip-10.1.1.1.1 ~]# ipcs -lm
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 18014398509465599
max total shared memory (kbytes) = 18446744073709551612
min seg size (bytes) = 1
What’s the optimal value for SHMMAX?
Oracle makes use of one of the 3 memory management models to create the SGA during database startup and it does this in following sequence. First Oracle attempts to use the one-segment model and if this fails, it proceeds with the next one which’s the contiguous multi-segment model and if that fails too, it goes with the last option which is the non-contiguous multi-segment model.
So let’s say if you know the max size of SGA of any database on the server stays below 2GB, you can set shmmax to 2 GB. But say if you have SGA sizes for different databases spread between 512MB to 5GB, then set shmmax to 5Gigs and so on.
Half the size of physical memory in bytes
SHMMNI: parameter recommended as 4096.
SHMALL: parameter recommended as %40 size of physical memory in pages.
Display Kernel Parameter Values for Red-hat Linux (RHEL 9)
Command to see Kernel Parameter Values
Parameter | Command |
---|---|
semmsl, semmns, semopm, and semmni | # /sbin/sysctl -a | grep sem This command displays the value of the semaphore parameters in the order listed. |
shmall, shmmax, and shmmni | # /sbin/sysctl -a | grep shm This command displays the details of the shared memory segment sizes. |
file-max | # /sbin/sysctl -a | grep file-max This command displays the maximum number of file handles. |
ip_local_port_range | # /sbin/sysctl -a | grep ip_local_port_range This command displays a range of port numbers. |
rmem_default | # /sbin/sysctl -a | grep rmem_default |
rmem_max | # /sbin/sysctl -a | grep rmem_max |
wmem_default | # /sbin/sysctl -a | grep wmem_default |
wmem_max | # /sbin/sysctl -a | grep wmem_max |
aio-max-nr | # /sbin/sysctl -a | grep aio-max-nr |
Minimum Kernel Parameter Settings for Oracle Database 19c Installation - Redhat Linux
For Oracle Database kernel parameter and shell limit values
Parameter | Value | File |
---|---|---|
semmsl semmns semopm semmni | 250 32000 100 128 | /proc/sys/kernel/sem |
shmall | Greater than or equal to the value of shmmax, in pages. | /proc/sys/kernel/shmall |
shmmax | Half the size of physical memory in bytes See My Oracle Support Note 567506.1 for additional information about configuring shmmax. | /proc/sys/kernel/shmmax |
shmmni | 4096 | /proc/sys/kernel/shmmni |
panic_on_oops | 1 | /proc/sys/kernel/panic_on_oops |
file-max | 6815744 | /proc/sys/fs/file-max |
aio-max-nr | 1048576 Note: This value limits concurrent outstanding requests and should be set to avoid I/O subsystem failures. | /proc/sys/fs/aio-max-nr |
ip_local_port_range | Minimum: 9000 Maximum: 65500 | /proc/sys/net/ipv4/ip_local_port_range |
rmem_default | 262144 | /proc/sys/net/core/rmem_default |
rmem_max | 4194304 | /proc/sys/net/core/rmem_max |
wmem_default | 262144 | /proc/sys/net/core/wmem_default |
wmem_max | 1048576 | /proc/sys/net/core/wmem_max |
Thursday, March 7, 2024
How to Initiate the AWS Oracle RDS Data Guard switchover using the AWS CLI
Switch primary to read replica (standby ) and vice-versa
aws rds switchover-read-replica --db-instance-identifier ora-orcl-demo2 --region us-west-2
aws rds switchover-read-replica --db-instance-identifier ora-orcl-demo1 --region us-east-1
aws rds describe-db-instances --db-instance-identifier ora-orcl-demo1
AWS Link
AWS DMS Mapping Table (MSSQL) : Loading Table data using boundaries
MSSQL query boundaries conditions
SELECT Max(Id) nt
FROM (SELECT Id,(Ntile(160) over( ORDER BY Id)) nt FROM demo)
test
GROUP BY nt
ORDER BY nt
option (maxDOP 1024)