<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5829191550601027073</id><updated>2026-10-09T08:19:33.046-04:00</updated><category term="Oracle"/><category term="genesys"/><category term="crystal report"/><category term="PowerShell"/><category term="BusinessObject"/><category term="MS SQL Server"/><category term="linux"/><category term="windows"/><category term="SAP"/><category term="UNIX"/><category term="hack"/><category term="RMAN"/><category term="tomcat"/><category term="SAP Data Services"/><category term="Linux memory tuning"/><category term="Oracle Application Server 10g Release 2"/><category term="backup"/><category term="business view"/><category term="cca"/><category term="centos"/><category term="ocm"/><category term="oracle database"/><category term="tuning"/><category term="BODS"/><category term="FTA"/><category term="GAD"/><category term="Siebel"/><category term="SonicView"/><category term="cognos"/><category term="cognos SSL"/><category term="database"/><category term="import"/><category term="mssqlserver"/><category term="ocs"/><category term="outbound contact server"/><category term="satellite"/><category term="sqlplus"/><category term="2701hg-g"/><category term="2wire"/><category term="3cx"/><category term="Advance Compression"/><category term="BMW Engine Valve Cover Gasket DIY"/><category term="C"/><category term="CDC"/><category term="CIKtel SIP"/><category term="CPD server"/><category term="C_TADM70_40"/><category term="Clarify"/><category term="Cognos BI Oracle_Home"/><category term="DBA"/><category term="Data Services job server"/><category term="FTA repair"/><category term="FTP Server"/><category term="FreshTomato"/><category term="HDMI"/><category term="HDTV"/><category term="HMP100"/><category term="How to Maintain Old Cars?"/><category term="Hyperion"/><category term="Informix"/><category term="Internet Explorer"/><category term="J2EE"/><category term="JTAG"/><category term="Linux utility"/><category term="MS SQL Server to_date"/><category term="Mac OS X"/><category term="Oracle DST"/><category term="Oracle Database Appliance"/><category term="Oracle Exadata"/><category term="Oracle Portal"/><category term="Oracle RAC"/><category term="Oracle backup"/><category term="OracleGrid Control"/><category term="PL/SQL"/><category term="PeopleSoft"/><category term="Pro*C"/><category term="Query Builder"/><category term="RMAN backup"/><category term="SAP exam"/><category term="SEC-8027"/><category term="SOAP web service"/><category term="Select-Object"/><category term="Select-String"/><category term="SonicView 360 Elite"/><category term="SonicView 360E"/><category term="Sort-Object"/><category term="StatServer"/><category term="Sun Fire X4800 M2"/><category term="WebLogic"/><category term="Xvfb"/><category term="acanac"/><category term="acl"/><category term="addm"/><category term="adsl"/><category term="alter index rebuild online"/><category term="android"/><category term="antivirus"/><category term="apple"/><category term="aspect"/><category term="aspect hacking"/><category term="aspect report"/><category term="aspect software"/><category term="audio"/><category term="avaya"/><category term="backup best practice"/><category term="backup policy"/><category term="bartender"/><category term="bash shell"/><category term="blacklist ip"/><category term="bmw"/><category term="bmw hydrolock"/><category term="ciktel"/><category term="cisco 7970"/><category term="compile"/><category term="complex sql"/><category term="cti"/><category term="d-link dwa-1320"/><category term="data load"/><category term="data mining"/><category term="database disk cache"/><category term="database recovery"/><category term="datasourcer"/><category term="default password"/><category term="delete list of values"/><category term="device driver"/><category term="disk cache"/><category term="dix"/><category term="dma"/><category term="dwa-1320"/><category term="e-mail"/><category term="ecc 6 installation"/><category term="ecc 6 media download"/><category term="erp"/><category term="exp"/><category term="export"/><category term="fedora"/><category term="file modification date"/><category term="genesys memory tuning"/><category term="genesys ocm"/><category term="hacking"/><category term="heterogeneous system copy"/><category term="honda"/><category term="hugepages"/><category term="iOS iPhone"/><category term="imap"/><category term="input folder"/><category term="ip phone"/><category term="ipad"/><category term="itouch"/><category term="java"/><category term="jdbc"/><category term="jdbc ms sql server jar windows authentication"/><category term="jdbc thin oracle"/><category term="jdbc tuninh"/><category term="kiwkset lock"/><category term="label printer"/><category term="lan"/><category term="linksys"/><category term="migration"/><category term="ms sql server truncate transaction log"/><category term="network"/><category term="network sniffer"/><category term="off-site tape storage"/><category term="oledb"/><category term="openvpn"/><category term="oracle appliance"/><category term="oracle memory configuration"/><category term="oracle memory tuning"/><category term="oracle warehouse builder"/><category term="outbound contact manager"/><category term="parameter"/><category term="password"/><category term="pbx"/><category term="pcap"/><category term="pcmcia"/><category term="phone charger"/><category term="plsql"/><category term="port 8005"/><category term="power supply repair"/><category term="prelude"/><category term="printer"/><category term="printing"/><category term="privilege error"/><category term="prompt group"/><category term="purge"/><category term="ram cache"/><category term="rdc"/><category term="redhat"/><category term="sap installation"/><category term="sap ips v4.3 upgrade path"/><category term="sap unpack software"/><category term="sap unrar"/><category term="sapinst"/><category term="search engine"/><category term="security"/><category term="shell script"/><category term="shutdown"/><category term="sql tuning"/><category term="ssh"/><category term="ssl"/><category term="ssl certificate"/><category term="supercache"/><category term="superspeed"/><category term="swap tuning"/><category term="tablespace"/><category term="tempdb"/><category term="thermostat"/><category term="tigervnc"/><category term="tls capture"/><category term="troubleshoot webcam"/><category term="unrar"/><category term="update view"/><category term="utilities"/><category term="vi"/><category term="virtual memory"/><category term="vncserver"/><category term="web services"/><category term="webcam"/><category term="wifi"/><category term="windows 7"/><category term="windows memory"/><category term="windows performance tuning"/><category term="wireshark"/><category term="xauth timeout locking authority file"/><category term="yahoo"/><category term="youtube"/><category term="zebra"/><title type='text'>Guidewire, SAP, Oracle, UNIX, Genesys Technology Blog</title><subtitle type='html'>Guidewire, SAP, Genesys, hacking, Oracle Application Server, Oracle database, UNIX</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>254</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-216940783447969820</id><published>2026-09-25T11:48:50.275-04:00</published><updated>2026-09-25T14:49:56.100-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="ssl certificate"/><title type='text'>PowerShell - Getting Remote MS SQL Server 2017 SSL Certificate Using Low Level Network Communication</title><content type='html'>&lt;p&gt;Product: Microsoft MS SQL Server&lt;br /&gt;Version: 2017&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Overview&lt;/h1&gt;&lt;p&gt;There are few scenarios where you would like to download the SSL certificate and save as file while working with MS SQL Server client or server programs.&amp;nbsp; I come into situation where the old version of IBM Cognos Analytics required to add remote MS SQL Server&#39;s self-signed SSL cert into its own Java keystore.&amp;nbsp; The challenge is that the MS SQL Server does not has any self-signed SSL cert, and it dynamically creates a SSL cert (MS called it as fallback SSL cert) in memory during MS SQL Server startup.&amp;nbsp; So it is not possible to save the certificate file.&lt;/p&gt;&lt;p&gt;Following are few more scenarios where you might want to save the remote MS SQL Server&#39;s SSL cert:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;MS SQL Server DBA does not has Windows admin privilege to run Windows Certificate Manager (certmgr.msc) to save the SSL cert&lt;/li&gt;&lt;li&gt;Windows admin is not familiar with Windows Certificate Manager (certmgr.msc) and not able to provide the SSL cert&lt;/li&gt;&lt;li&gt;MS SQL Server DBA does not know anything about SSL fallback cert, when MS SQL Server does not has any SSL cert&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;The MS SQL Server API&amp;nbsp;Microsoft.Data.SqlClient in any programming, e.g. Visual C#, Visual C++, Java, Python, Perl, is not possible to obtain the SSL cert.&lt;/p&gt;&lt;p&gt;openssl.exe utility has drop MS SQL Server TDS (Tabular Data Stream) support, so it is not possible to use this utility to get the SSL cert.&lt;/p&gt;&lt;p&gt;As the result, I develop a PowerShell program that uses low level TCP network communication that can download SSL certificate from local or remote MS SQL Server through TCP/IP protocol.&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Technical Design&lt;/h1&gt;&lt;p&gt;Low level TCP programming uses PowerShell&amp;nbsp;System.Net.Sockets.TcpClient.&amp;nbsp; MS SQL Server login is always SSL encrypted.&amp;nbsp; It contains 2 phase, which is called PRELOGIN and LOGIN7.&amp;nbsp; During PRELOGIN phase, MS SQL Server will provide SSL certificate to the DB client program, which then can proceeds with LOGIN7 phase that will login to MS SQL Server with username and password (assumes DB authentication, not Windows user).&lt;/p&gt;&lt;p&gt;The most challenging part is research MS SQL Server PRELOGIN protocol, as this is poorly documented by Microsoft.&amp;nbsp; You can find the official document from learn.microsoft.com below:&lt;/p&gt;&lt;p&gt;Title:&amp;nbsp;Open Specifications &amp;gt; Protocols &amp;gt; SQL Server Protocols &amp;gt; Technical Documents &amp;gt;&amp;nbsp;[MS-SSTDS]: Tabular Data Stream Protocol Version 4.2 &amp;gt;&amp;nbsp;Messages &amp;gt;&amp;nbsp;Message Syntax &amp;gt;&amp;nbsp;Packet Header Message Type Stream Definition &amp;gt;&amp;nbsp;PRELOGIN&lt;br /&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Ref:&amp;nbsp;https://learn.microsoft.com/en-us/openspecs/sql_server_protocols/ms-sstds/75e62f67-f057-4d46-82b3-6920fe0ebada&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;The PowerShell program will make use of hex and binary to convert the PRELOGIN data structure back and forte with remote MS SQL Server server.&lt;/p&gt;&lt;p&gt;While reading MS&#39; document, we need to ignore any document that tell encryption is optional, as well as TLS v1.2 is optional.&amp;nbsp; In fact, many versions of MS SQL Server have long enforced TLS v1.2, and encryption during login.&amp;nbsp; So there are many obsolete content which confuses reader like us.&amp;nbsp; The login sequence is called as Tabular Data Stream with short name of TDS.&amp;nbsp; My program is written for MS SQL Server 2017, which is using TDS v7.4, but newer MS SQL Server uses TDS v8.0.&amp;nbsp; So this program might not work with newer MS SQL Server due to a change in PRELOGIN phase.&lt;/p&gt;&lt;p&gt;My program set the encryption as 0x01, which in MS&#39; doc called &quot;Encryption is available and on.&quot;&amp;nbsp; Again, all MS SQL Server support SSL cert, so you can safely accept encryption is available.&lt;/p&gt;&lt;p&gt;Some variables in my program call &quot;stream&quot; which represent TCP network communication.&amp;nbsp; At the beginning of the low level TCP network connection, a variable of&amp;nbsp;NetworkStream is created against&amp;nbsp;TcpClient connection.&amp;nbsp; This is to facilitate back and fort communication with remote MS SQL Server.&lt;/p&gt;&lt;p&gt;Soon after open TCP connection, my program will send a static PRELOGIN to remote MS SQL Server to tell it that my program needs to login.&amp;nbsp; This part of the communication is not encrypted, and in clear text. Don&#39;t simply change this static PRELOGIN array value, as 2 of the bytes (2 array elements) contains number of bytes inside this array.&amp;nbsp; You can refer to MS doc for exact array element, if you want to change this array.&lt;/p&gt;&lt;p&gt;After that, MS SQL Server will reply back to tell my program its MS SQL Server version, whether it supports encryption (it will be always supported), number of bytes it will send back.&amp;nbsp; My program will retrieve this reply (MS doc called message or message stream) using 2 separate steps (command NetworkStream.Read()).&amp;nbsp; The reason is because the 1st part is a constant 8 bytes, which I called &quot;payload header&quot; while MS doc implies it is payload as well, with short name of PL.&amp;nbsp; My program then find out number of bytes remote MS SQL Server going to send to me, and in the 2nd part, my program will read the remaining reply (message stream).&amp;nbsp; I called the 2nd part of it as &quot;prelogin payload option token&quot; and &quot;prelogin payload data.&quot;&amp;nbsp; MS doc is not clear about how they called them.&amp;nbsp; For my program, I mainly determine the remote MS SQL Server will tell my program that it accept my PRELOGIN request, and it does support SSL encryption.&amp;nbsp; This is very important as SSL cert will only be send to my program if it replied that it supports SSL encryption.&amp;nbsp; This will double confirm new MS SQL Server standard that LOGIN7 is always SSL encrypted.&lt;/p&gt;&lt;p&gt;The next part is the most challenging part as I need to continue to talk to MS SQL Server using TDS header structure, while enforcing SSL TLS v1.2.&amp;nbsp; For this part, I can&#39;t hard code the static array like earlier as I need to call System.Net.Security.SslStream.AuthenticateAsClient which will indirectly calls System.IO.Stream over TCP.&amp;nbsp; So there is an extra class called&amp;nbsp;TdsTlsStream that helps me to perform read() and write() over the TCP network communication.&amp;nbsp; Inside this class, in read() function, it will read first 8 bytes to determine network packet length, and in write() function, it will create extra 8-bytes packets to insert before sending over the data to remote MS SQL Server.&lt;/p&gt;&lt;p&gt;System.Net.Security.SslStream.AuthenticateAsClient is the main call that will obtain SSL certificate from remote MS SQL Server.&amp;nbsp; Anything that is wrong in the program will leads to timeout, then remote MS SQL Server will close the network connection.&amp;nbsp; If it success, then the program will be able to extract the SSL certificate using&amp;nbsp;System.Security.Cryptography.X509Certificates.X509Certificate2.&lt;/p&gt;&lt;p&gt;You can further modify the program to add following line to save the SSL certificate as a file locally:&lt;/p&gt;&lt;p&gt;E.g. Export-Certificate -Cert $&amp;lt;yr variable name&amp;gt; -FilePath db_certificate_DER_binary.cer -Type CERT&lt;/p&gt;&lt;p&gt;Above command will create a new SSL certificate file called db_certificate_DER_binary.cer in current directory&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;PowerShell Program&lt;/h2&gt;&lt;p&gt;Following is the PowerShell program&lt;/p&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;[CmdletBinding()]&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;param()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;# Define your SQL Server instance details, default port 1433&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;$SqlServer = &quot;your-ms-sql-server-hostname-or-IP&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;$SqlPort&amp;nbsp; &amp;nbsp;= 20277&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;# Enforce TLS 1.2 for the handshake protocol selection&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;$TlsVersion = [System.Security.Authentication.SslProtocols]::Tls12&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;# --- SQL Server Pre-Login Handshake Protocol Payload ---&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;# This standard 8-byte TDS header tells SQL Server a client login attempt is starting.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;[byte[]]$TdsPreLoginPacket = 0x12, 0x01, 0x00, 0x2F, 0x00, 0x00, 0x01,0x00, 0x00, 0x00, 0x1A, 0x00, 0x06, 0x01,0x00, 0x20,0x00, 0x01, 0x02, 0x00, 0x21, 0x00, 0x01,0x03, 0x00, 0x22, 0x00, 0x04, 0x04, 0x00,0x26, 0x00,0x01, 0xFF, 0x09, 0x00, 0x00, 0x00, 0x00,0x00, 0x01, 0x00, 0xB8, 0x0D, 0x00, 0x00,0x01&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;# Create a TCP Client to connect to the SQL port&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;$TcpClient = New-Object System.Net.Sockets.TcpClient&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;try {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; $TcpClient.Connect($SqlServer, $SqlPort)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;$TcpClient.SendTimeout&amp;nbsp; &amp;nbsp; = 10000;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;$TcpClient.ReceiveTimeout = 10000;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; $NetworkStream = $TcpClient.GetStream()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; $NetworkStream.Write($TdsPreLoginPacket, 0, $TdsPreLoginPacket.Length)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;# 3. Read the server&#39;s TDS Pre-Login Response Header&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;$responseHeader = New-Object byte[] 8&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;$bytesRead = $NetworkStream.Read($responseHeader, 0, $responseHeader.length)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;if ($bytesRead -lt $responseHeader.length) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;Write-Error &quot;PRELOGIN - $bytesRead bytes read, but expects 8 bytes&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;throw &quot;Failed to read a valid PRELOGIN TDS header response&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;$respPayloadLength = ($responseHeader[2] -shl 8) + $responseHeader[3] - $responseHeader.length&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;Write-Host &quot;--- TDS HEADER RECEIVED ---&quot; -ForegroundColor Cyan&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;Write-Host &quot;Raw Bytes Header: &quot; ($responseHeader -join &#39; &#39;)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;Write-Host &quot;Remaining Payload Length: $respPayloadLength bytes&quot; -ForegroundColor Cyan&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; # Continue to read the token data and data&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;if ($respPayloadLength -gt 0) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$responsePayload = New-Object byte[] $respPayloadLength&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$bytesRead = $NetworkStream.Read($responsePayload, 0, $respPayloadLength)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$intEndofTokenHeader = [array]::IndexOf($responsePayload, [byte]0xff)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$intEndofTokenData = $intEndofTokenHeader + 1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;Write-Host &quot;Finished reading payload: $respPayloadLength bytes&quot; -ForegroundColor Cyan&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;Write-Host &quot;Offset of FF terminator: &quot; $intEndofTokenHeader -ForegroundColor Cyan&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;Write-Host &quot;Raw Bytes: &quot; ($responsePayload -join &#39; &#39;) -ForegroundColor Gray&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;Write-Host &quot;Raw Bytes Token Header: &quot; ($responsePayload[0..$intEndofTokenHeader] -join &#39; &#39;) -ForegroundColor Gray&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;Write-Host &quot;Raw Bytes Token Data: &quot; ($responsePayload[$intEndofTokenData..($respPayloadLength - 1)] -join &#39; &#39;) -ForegroundColor Gray&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;$isServerEncrypted = 0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;$posPayload = 0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;while ($posPayload -lt $intEndofTokenHeader) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$plOptionType = $responsePayload[$posPayload]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;Write-Host &quot;PRELOGIN respond header - Position $posPayload=$plOptionType&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal; white-space: pre;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;		&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;# Exit loop if reach header terminator character 0xFF&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;if ($plOptionType -eq 0xFF) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;Write-Host &quot;PRELOGIN respond header - Reached end of header&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;break&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;elseif ($plOptionType -ne 1) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;$posPayload += 5&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;Write-Host &quot;PRELOGIN respond header - Skipping 5 bytes to offset $posPayload&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;continue&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Calculate the address of encryption byte&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$valueOffset = [System.BitConverter]::ToUInt16([byte[]]@($responsePayload[$offset + 2], $responsePayload[$offset + 1]), 0)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal; white-space: pre;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;		&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;Write-Host &quot;PRELOGIN respond header - Found encryption byte in offset address $posPayload with value $valueOffset&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$isServerEncryptedRaw = $responsePayload[$valueOffset]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$isServerEncrypted = $isServerEncryptedRaw -band 0x0F&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;Write-Host (&quot;PRELOGIN respond header - offset $valueOffset&#39;s encryption byte value = {0} (0x{0:X2}) -&amp;gt; {0} (0x{1:X2})&quot; -f $isServerEncrypted,$isServerEncrypted ) -ForegroundColor Cyan&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;break&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;Write-Verbose &quot;Entryption is supported, so it is possible to get SSL cert. $isServerEncrypted is not 0 means DB server will perform encryption&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;Write-Verbose &quot;Setup TLS stream&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;$tlsStreamToWrap = [TdsTlsStream]::new($NetworkStream)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; # Wrap the network stream in an SslStream object for the TLS handshake&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;# We pass a callback to automatically trust self-signed SQL dev certificates&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;Write-Verbose &quot;Setup SSL stream inside TLS stream&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; $SslStream = New-Object System.Net.Security.SslStream($tlsStreamToWrap, $false, {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; param($sender, $certificate, $chain, $sslPolicyErrors)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Always return true to capture the certificate even if untrusted/self-signed fallback&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return $true&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; })&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; Write-Host &quot;SslProtocol negotiated #1: $($sslStream.SslProtocol)&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; # Authenticate as client to trigger the handshake&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;Write-Verbose &quot;Specified SSL to use $TlsVersion, and obtain remote DB server&#39;s SSL cert&quot;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; $SslStream.AuthenticateAsClient($SqlServer, $null, $TlsVersion, $false)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; Write-Host &quot;SslProtocol negotiated #2: $($sslStream.SslProtocol)&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; # Extract the server certificate&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;$ServerCertificate = [System.Security.Cryptography.X509Certificates.X509Certificate2]($SslStream.RemoteCertificate)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; if ($ServerCertificate) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Host &quot;`n=== SQL Server TLS 1.2 Certificate Details ===&quot; -ForegroundColor Green&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $ServerCertificate | Format-List Subject, Issuer, SerialNumber, Thumbprint, NotBefore, NotAfter&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal; white-space: pre;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;		&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Verify if it is the fallback certificate&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ($ServerCertificate.Subject -like &quot;*SSL_Self_Signed_Fallback*&quot;) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;$Host.PrivateData.VerboseForegroundColor = &#39;Cyan&#39;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Verbose &quot;This is the internal SQL Server Self-Signed Fallback Certificate, so it is in RAM, and will change after DB server start/restart/reboot&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; } else {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Warning &quot;Successfully connected with TLSv1.2, but no remote certificate was returned by the server.&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;} catch {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;$lineText&amp;nbsp; &amp;nbsp;= $_.InvocationInfo.Line&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; $lineNumber = $_.InvocationInfo.ScriptLineNumber&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; $position&amp;nbsp; &amp;nbsp;= $_.InvocationInfo.PositionMessage&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; Write-Host &quot;❌ Error occurred on line $lineNumber&quot; -ForegroundColor Red&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; Write-Host &quot;Code block: $lineText&quot; -ForegroundColor Yellow&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; Write-Host &quot;Position details:`n$position&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;} finally {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; # Properly close and dispose of connections&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; if ($SslStream) { $SslStream.Dispose() }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; if ($TcpClient) { $TcpClient.Close(); $TcpClient.Dispose() }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;class TdsTlsStream : System.IO.Stream {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[System.IO.Stream]$InnerStream&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[int]$PayloadLength = 0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;TdsTlsStream([System.IO.Stream]$InnerStream) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$this.InnerStream = $InnerStream&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[bool] get_CanRead() { return $this.InnerStream.CanRead }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[bool] get_CanWrite() { return $this.InnerStream.CanWrite }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[bool] get_CanSeek() { return $this.InnerStream.CanSeek }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[Int64] get_Length() { return $this.InnerStream.Length }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[Int64] get_Position() { return $this.InnerStream.Position }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[void] set_Position([Int64]$Value) { $this.InnerStream.Position = $Value }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[int] get_ReadTimeout() { return $this.InnerStream.ReadTimeout }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[int] get_WriteTimeout() { return $this.InnerStream.WriteTimeout }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[void] Flush() { $this.InnerStream.Flush() }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[Int64] Seek([Int64]$Offset, [System.IO.SeekOrigin]$Origin) { return $this.InnerStream.Seek($Offset, $Origin) }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[void] SetLength([Int64]$Value) { $this.InnerStream.SetLength($Value) }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[int] Read([byte[]]$Buffer, [int]$Offset, [int]$Count) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;# Removes TDS header before setting the network Buffer&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;if ($this.PayloadLength -eq 0) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;$tlsHeader = [byte[]]::new(8)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;$read = 0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;while ($read -lt 8) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;$read += $this.InnerStream.Read($tlsHeader, 0, 8)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;$lengthBeforeHeader = [System.BitConverter]::ToUInt16([byte[]]@($tlsHeader[3], $tlsHeader[2]), 0)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;$lengthBeforeHeader -= 8&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;$this.PayloadLength = $lengthBeforeHeader&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;if ($Count -gt $this.PayloadLength) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;$Count = $this.PayloadLength&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$read = $this.InnerStream.Read($Buffer, $Offset, $Count)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$this.PayloadLength -= $read&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;return $read&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[void] Write([byte[]]$Buffer, [int]$Offset, [int]$Count) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$newPayload = $this.GenerateTdsHeader($Buffer, $Offset, $Count)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$this.InnerStream.Write($newPayload, 0, $newPayload.Length)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;[byte[]] GenerateTdsHeader([byte[]]$Payload, [int]$Offset, [int]$Count) {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;# The length is big endian encoded so it is inserted in reverse order&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$lengthBytes = [System.BitConverter]::GetBytes([uint16]($Count + 8))&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$newPayload = [byte[]]::new(8 + $Count)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$newPayload[0] = 0x12&amp;nbsp; # Type - Pre-Login&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$newPayload[1] = 0x01&amp;nbsp; # Status - End of message (EOM)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$newPayload[2] = $lengthBytes[1]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$newPayload[3] = $lengthBytes[0]&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$newPayload[4] = 0&amp;nbsp; # SPID&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$newPayload[5] = 0&amp;nbsp; # SPID&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$newPayload[6] = 0&amp;nbsp; # PacketID&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$newPayload[7] = 0&amp;nbsp; # Window&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;[System.Array]::Copy($Payload, $Offset, $newPayload, 8, $Count)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;return $newPayload&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;white-space: normal;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;span style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/216940783447969820/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/216940783447969820' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/216940783447969820'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/216940783447969820'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2026/09/powershell-getting-remote-ms-sql-server.html' title='PowerShell - Getting Remote MS SQL Server 2017 SSL Certificate Using Low Level Network Communication'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-6690175101708887878</id><published>2026-04-01T14:29:00.004-04:00</published><updated>2026-04-02T17:15:39.687-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="BODS"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SOAP web service"/><title type='text'>SAP Data Services Web Service (SOAP) Calling - Example</title><content type='html'>&lt;p&gt;Product: SAP Data Services&lt;br /&gt;Version: 4.2.x - 4.3.x&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Overview&lt;/h2&gt;&lt;p&gt;SAP BODS (Data Services) has DSMC browser GUI which offers web service functionality.&amp;nbsp; This allows external scheduler to easily integrate with it.&lt;/p&gt;&lt;p&gt;This blog post is going to show using PowerShell&amp;nbsp;Invoke-WebRequest, so that you can see its&amp;nbsp; SOAP communication in low level.&amp;nbsp; For experience person, it should be easy to figure out how to configure the external job scheduler to use BODS WSDL 2.1 web service (SOAP) call.&lt;/p&gt;&lt;p&gt;For this example, I&#39;m using following dummy value to illustrate&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;BODS URL:&amp;nbsp;http://localhost:8080/DataServices/servlet/webservices?ver=2.1&lt;/li&gt;&lt;li&gt;Server hostname: localhost&lt;/li&gt;&lt;li&gt;Authentication Method: Build in Enterprise&lt;/li&gt;&lt;li&gt;Username: administrator&lt;/li&gt;&lt;li&gt;Password: hidden_hash_value&lt;/li&gt;&lt;li&gt;Job Server local repository name: LOCAL_REPO_DEV1&lt;/li&gt;&lt;li&gt;Job ID: 2&lt;/li&gt;&lt;li&gt;Going to simulate the OOTB web service call&amp;nbsp;Get_BatchJob_Status, which will return 2 values of whether the web service call success or not (0=success), as well as job status in string of Running/Succussed/Error/Warning&lt;/li&gt;&lt;ul&gt;&lt;li&gt;BODS doc:&amp;nbsp;https://help.sap.com/docs/SAP_DATA_SERVICES/ab33122a997f40d89e340549ff0bced8/5748962b6d6d1014b3fc9283b0e91070.html&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div&gt;Login is required to obtain session ID.&amp;nbsp; The session ID going to be used in subsequent web service call&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For full SAP BODS web service reference doc, see&amp;nbsp;https://help.sap.com/docs/SAP_DATA_SERVICES/ab33122a997f40d89e340549ff0bced8/574996556d6d1014b3fc9283b0e91070.html&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Using PowerShell Invoke-WebRequest to Call BODS Web Service&lt;/h2&gt;&lt;p&gt;1. Login&lt;/p&gt;&lt;p&gt;$headers1 = @{&quot;SOAPAction&quot; = &quot;function=&lt;b&gt;Logon&lt;/b&gt;&quot;}&lt;/p&gt;&lt;p&gt;$soapBody1 = @&quot;&lt;/p&gt;&lt;p&gt;&amp;lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:ser=&quot;http://www.businessobjects.com/DataServices/ServerX.xsd&quot;&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;lt;soapenv:Header/&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;lt;soapenv:Body&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ser:LogonRequest&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;&lt;b&gt;username&lt;/b&gt;&amp;gt;administrator&amp;lt;/username&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;&lt;b&gt;password&lt;/b&gt;&amp;gt;hidden_hash_value&amp;lt;/password&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;&lt;b&gt;cms_system&lt;/b&gt;&amp;gt;localhost&amp;lt;/cms_system&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;cms_authentication&amp;gt;secEnterprise&amp;lt;/cms_authentication&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ser:LogonRequest&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;lt;/soapenv:Body&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;/soapenv:Envelope&amp;gt;&lt;/p&gt;&lt;p&gt;&quot;@&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;$response1 = Invoke-WebRequest -UseBasicParsing -Method Post -ContentType &quot;text/xml;charset=UTF-8&quot; -Headers $headers1 -Body $soapBody1 http://localhost:8080/DataServices/servlet/webservices?ver=2.1&lt;/p&gt;&lt;p&gt;[xml]$xmlResponse1 = $response.Content&lt;/p&gt;&lt;p&gt;$dsmc_SessionID = $xmlResponse1.Envelope.Body.session.SessionID&lt;/p&gt;&lt;p&gt;$dsmc_SessionID&lt;/p&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p&gt;2. Call Get_BatchJob_Status&lt;/p&gt;&lt;p&gt;$headers2 = @{&quot;SOAPAction&quot; = &quot;jobAdmin=&lt;b&gt;Get_BatchJob_Status&lt;/b&gt;&quot;}&lt;/p&gt;&lt;p&gt;$soapBody2 = @&quot;&lt;/p&gt;&lt;p&gt;&amp;lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:ser=&quot;http://www.businessobjects.com/DataServices/ServerX.xsd&quot;&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;lt;soapenv:Header&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ser:session&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;&lt;b&gt;SessionID&lt;/b&gt;&amp;gt;$dsmc_SessionID&amp;lt;/SessionID&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ser:session&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;lt;/soapenv:Header&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;lt;soapenv:Body&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ser:batchJobStatusRequest&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;&lt;b&gt;runID&lt;/b&gt;&amp;gt;2&amp;lt;/runID&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;&lt;b&gt;repoName&lt;/b&gt;&amp;gt;LOCAL_REPO_DEV1&amp;lt;/repoName&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ser:batchJobStatusRequest&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&amp;lt;/soapenv:Body&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;/soapenv:Envelope&amp;gt;&lt;/p&gt;&lt;p&gt;&quot;@&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;$response2 = Invoke-WebRequest -UseBasicParsing -Method Post -ContentType &quot;text/xml;charset=UTF-8&quot; -Headers $headers2 -Body $soapBody2 http://localhost:8080/DataServices/servlet/webservices?ver=2.1&lt;/p&gt;&lt;p&gt;[xml]$xmlResponse2 = $response2.Content&lt;/p&gt;&lt;p&gt;$xmlResponse2.Envelope.Body.batchJobStatusResponse&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;localtypes&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; returnCode status&lt;br /&gt;----------&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ---------- ------&lt;br /&gt;http://www.businessobjects.com/DataServices/ServerX.xsd 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;b&gt;error&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;h2&gt;Using PowerShell New-WebServiceProxy to Call BODS Web Service&lt;/h2&gt;&lt;div&gt;This is using SOAP web service call.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;$url_dsmc = &quot;http://localhost:8080/DataServices/servlet/webservices?ver=2.1&amp;amp;wsdlxml&quot;&lt;/div&gt;&lt;div&gt;# First call to BODS web service server to get the wsdl&lt;/div&gt;&lt;div&gt;$response1 = New-WebServiceProxy&amp;nbsp;-Uri $url_dsmc -Namespace dsmc_namespace&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;$dsmc_namespace = $dsmc.GetType().Namespace&lt;/div&gt;&lt;div&gt;$dsmc_conn_ops = New-Object -TypeName &quot;$dsmc_namespace`.Connection_Operations&quot;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;$param = New-Object &quot;dsmc_namespace.LogonRequest&quot;&lt;/div&gt;&lt;div&gt;$param.username = &quot;administrator&quot;&lt;/div&gt;&lt;div&gt;$param.password = &quot;hidden_hash_value&quot;&lt;/div&gt;&lt;div&gt;$param.cms_system = &quot;localhost&quot;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;$param.cms_authentication = &quot;secEnterprise&quot;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;# 2nd call - Triggers logon, and it will return Session ID&lt;br /&gt;# Stores the session_id for next call&lt;/div&gt;&lt;div&gt;&lt;div&gt;$session_id = $dsmc_conn_ops.Logon($param)&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;# Next is to check Job status&lt;/div&gt;&lt;div&gt;# Local repo: LOCAL_REPO_DEV1&lt;/div&gt;&lt;div&gt;# Job&#39;s run ID 2&lt;/div&gt;&lt;div&gt;&lt;div&gt;$job_request = New-Object &quot;dsmc_namespace.batchJobStatusRequest&quot;&lt;/div&gt;&lt;div&gt;$job_request.repoName = &quot;LOCAL_REPO_DEV1&quot;&lt;/div&gt;&lt;div&gt;$job_request.runID = 2&lt;/div&gt;&lt;div&gt;$dsmc_Batch_Job_Admin = New-Object -TypeName &quot;$dsmc_namespace`.Batch_Job_Admin&quot;&lt;/div&gt;&lt;div&gt;$dsmc_Batch_Job_Admin_namespace = $dsmc_conn_ops.GetType().Namespace&lt;/div&gt;&lt;div&gt;$dsmc_Batch_Job_Admin.sessionValue = $session_id&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;# 3rd time calling BODS SOAP web service&lt;/div&gt;&lt;div&gt;$dsmc_Batch_Job_Admin.Get_BatchJob_Status($job_request)&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Output&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;returnCode status&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;---------- ------&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 error&lt;/span&gt;&lt;/div&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Analysis&lt;/h1&gt;&lt;div&gt;The parameter and web service methods required to referring to BODS web service wsdl.&amp;nbsp; For example:&lt;/div&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;New-Object &quot;dsmc_namespace.LogonRequest&quot; - wsdl contains &quot;&amp;lt;xsd:element name=&quot;LogonRequest&quot;&amp;gt;&quot; with&amp;nbsp;complexType, and 4 string parameters of username , password , cms_system , cms_authentication&amp;nbsp;&lt;/li&gt;&lt;li&gt;Logon() - wsdl indicated that the pass-in parameter is call &quot;LogonRequest&quot; directly under the root. It does not belongs to any class (PowerShell), or&amp;nbsp;wsdl:binding (wsdl)&lt;/li&gt;&lt;li&gt;PowerShell needs to call New-Object -TypeName $dsmc_namespace`.&amp;lt;wsdl:binding&amp;gt; to switch between 5 different binding of&amp;nbsp;Batch_Job_Admin,&amp;nbsp;Repo_Operations,&amp;nbsp;Batch_Jobs,&amp;nbsp;Connection_Operations,&amp;nbsp;Realtime_Service_Admin (default)&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/6690175101708887878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/6690175101708887878' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/6690175101708887878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/6690175101708887878'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2026/04/sap-data-services-web-service-soap.html' title='SAP Data Services Web Service (SOAP) Calling - Example'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-389073979226393167</id><published>2025-12-21T22:12:00.003-05:00</published><updated>2025-12-22T03:14:15.289-05:00</updated><title type='text'>FreeNAS, TrueNAS, FreeBSD - Shrink ZFS File System</title><content type='html'>&lt;p&gt;Product: Debian distribution, TrueNAS, FreeNAS&lt;/p&gt;&lt;p&gt;Version: Any version which uses ZFS File System&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Overview&lt;/h1&gt;&lt;p&gt;ZFS always create mount point as volume group equivalent volume even you assigns 1 partition to a mount point.&amp;nbsp; In Debian, TrueNAS or FreeNAS, it always creates as volume group (ZDEV), regardless you assigns entire hard drive (1 device) or 1 partition to it.&lt;/p&gt;&lt;p&gt;ZFS does not has build-in functionality to shrink partition, but we can remove partition after adding another one.&amp;nbsp; So the strategy to shrink partition is below:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;In the first disk, which contains the partition that we would like to shrink, finds out how much space is used by the mount point or partition.&amp;nbsp; For example, let&#39;s assume 8GB is used in a partition which is 500GB&lt;/li&gt;&lt;li&gt;Locates another disk or partition which can hold all the data used by above partition.&amp;nbsp; We will later leverage ZFS feature to auto-copy its content over to this new partition.&amp;nbsp; For simplicity, let&#39;s call this as 2nd disk&lt;/li&gt;&lt;li&gt;In the 2nd disk, creates a partition which is bigger than 8GB.&amp;nbsp; For example, creates a new 16GB partition&lt;/li&gt;&lt;li&gt;Unmount the mount point to avoid any user copying any data into the partition which we are going to shrink&lt;/li&gt;&lt;li&gt;Adds the new 16GB partition from 2nd disk into the same partition (volume, or ZDEV) which we would like to shrink.&amp;nbsp; Don&#39;t worry that we are making the volume 500GB + 16GB larger.&amp;nbsp; ZFS will not copy anything into this volume since we unmount it&lt;/li&gt;&lt;li&gt;Detach the partition we would like to shrink from the volume (ZDEV) to force ZFS to copy all the used data from this partition into 2nd disk&#39;s new partition (16GB partition size)&lt;/li&gt;&lt;li&gt;Now, you can delete and re-create the partition with smaller size in 1st disk&lt;/li&gt;&lt;li&gt;Adds back this partition into the volume or ZDEV.&amp;nbsp; Do not mount the mount point yet&lt;/li&gt;&lt;li&gt;Detach the 2nd disk&#39;s 16GB partition from the volume, so what ZFS will copy all the content to the newly added but smaller partition&lt;/li&gt;&lt;li&gt;This complete the partition shrink&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Procedure&lt;/h1&gt;&lt;div&gt;Assumes the partition we would like to shrink is called boot-pool (FreeNAS&#39; name for boot volume). It contains partition sda3 inside disk 1 (device name called sda).&amp;nbsp; The 2nd partition name that going to temporary add is called vg00/zvol0.&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Checks how much space is used in boot-pool&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Command: zpool list -v boot-pool&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;blockquote&gt;% zpool list -v boot-pool&lt;br /&gt;NAME&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SIZE&amp;nbsp; ALLOC&amp;nbsp; &amp;nbsp;FREE&amp;nbsp; CKPOINT&amp;nbsp; EXPANDSZ&amp;nbsp; &amp;nbsp;FRAG&amp;nbsp; &amp;nbsp; CAP&amp;nbsp; DEDUP&amp;nbsp; &amp;nbsp; HEALTH&amp;nbsp; ALTROOT&lt;br /&gt;boot-pool&amp;nbsp; &amp;nbsp;928G&amp;nbsp; 3.18G&amp;nbsp; &amp;nbsp;925G&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; &amp;nbsp;0%&amp;nbsp; &amp;nbsp; &amp;nbsp;0%&amp;nbsp; 1.00x&amp;nbsp; &amp;nbsp; ONLINE&amp;nbsp; -&lt;br /&gt;&amp;nbsp; sda3&amp;nbsp; &amp;nbsp; &amp;nbsp; 931G&amp;nbsp; 3.18G&amp;nbsp; &amp;nbsp;925G&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;nbsp; &amp;nbsp; &amp;nbsp;0%&amp;nbsp; 0.34%&amp;nbsp; &amp;nbsp; &amp;nbsp; -&amp;nbsp; &amp;nbsp; ONLINE&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&amp;nbsp;Above shown 3.18GB is used.&amp;nbsp; It contains only 1 partition called sda3 in disk sda&lt;/li&gt;&lt;li&gt;Locates a device which is bigger than 3.18GB.&amp;nbsp; Let&#39;s say 8GB&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Option 1: If TrueNAS, then create a new Zvol from any of the VDEV (storage pool)&lt;/li&gt;&lt;li&gt;Option 2: Creates a new partition sdb1, sdb2, or sdb3 from 2nd disk (or 3rd, 4th, etc)&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;For this post, I will use TrueNAS to create new Zvol called vg00/zvol0 (storage pool vg00, Zvol/dataset zvol0)&lt;/li&gt;&lt;li&gt;Adds vg00/zvol0 into boot-pool&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Command: zpool add boot-pool vg00/zvol0&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Detach sda3 from boot-pool&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Command: zpool remove boot-pool sda3&lt;/li&gt;&lt;li&gt;This command will take some time as it is going to copy 3.18GB into vg00/zvol0&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Re-create partition sda3 to smaller size, e.g. 100GB&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Command: parted sda&lt;/li&gt;&lt;li&gt;Refers to parted command on how to delete partition using menu driven command&lt;/li&gt;&lt;li&gt;Refers to parted command on how to create partition&amp;nbsp;using menu driven command.&amp;nbsp; It must be larger than 3.18GB to hold all the data&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Adds sda3 back into boot-pool&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Command: zpool add boot-pool sda3&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Detach vg00/zvol0 from boot-pool&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Command: zpool remove boot-pool vg00/zvol0&lt;/li&gt;&lt;li&gt;This command will take some time as it is going to copy 3.18GB into sda3&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/389073979226393167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/389073979226393167' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/389073979226393167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/389073979226393167'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2025/12/freenas-truenas-freebsd-shrink-zfs-file.html' title='FreeNAS, TrueNAS, FreeBSD - Shrink ZFS File System'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-19675334534924709</id><published>2025-08-01T19:40:00.002-04:00</published><updated>2025-08-01T19:40:35.002-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="openvpn"/><category scheme="http://www.blogger.com/atom/ns#" term="rdc"/><title type='text'>OpenVPN: Windows RDC Remote Desktop Configuration</title><content type='html'>&lt;p&gt;Product: OpenVPN, Windows OS&lt;br /&gt;Software: MS Remote Desktop Services&lt;br /&gt;Version: all&lt;/p&gt;&lt;p&gt;Sharing my experience of configuring OpenVPN that bundled with ASUS router which released in 2015.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Login to ASUS WiFi router as admin&lt;/li&gt;&lt;li&gt;Click on VPN button&lt;/li&gt;&lt;li&gt;Click on tab &quot;VPN Server&quot;&lt;/li&gt;&lt;li&gt;Enable OpenVPN server&lt;/li&gt;&lt;ol&gt;&lt;li&gt;For my ASUS access point (I will use AP in later post), it allows me to configure 2 OpenVPN servers&lt;/li&gt;&lt;li&gt;The &quot;Server instance&quot; for them are:&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Server 1&lt;/li&gt;&lt;li&gt;Server 2&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;li&gt;Under list box &quot;VPN Details&quot;, clicks on &quot;Advance&quot; in the list box to show more VPN server configurations&lt;/li&gt;&lt;li&gt;Sets following 3 VPN server parameters&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Advertise DNS to clients = Yes&lt;/li&gt;&lt;li&gt;Respond to DNS = Yes&lt;/li&gt;&lt;li&gt;Optionally set&amp;nbsp;Direct clients to redirect Internet traffic = Yes. This will allows other application think your traffic is originating from home computer instead of you current position. E.g. Facebook, YouTube, eBay, Amazon&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Following server parameters are optional to change to increase security, and minimize hacker&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Server port&lt;/li&gt;&lt;li&gt;Firewall&lt;/li&gt;&lt;li&gt;Username/Password authentication&lt;/li&gt;&lt;li&gt;TLS control channel security&lt;/li&gt;&lt;li&gt;Auth digest&lt;/li&gt;&lt;li&gt;VPN subnet/netmask&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Clicks on &quot;Apply&quot; button to start the VPN server&lt;/li&gt;&lt;li&gt;Now the OpenVPN server is completed&lt;/li&gt;&lt;li&gt;Navigate back to the same screen, if it forward you to other page&lt;/li&gt;&lt;li&gt;&quot;VPN Details&quot; will change back to &quot;General&quot; which will then shows button &quot;Export&quot; for you to download .opvn file&lt;/li&gt;&lt;li&gt;The browser will prompt you to save the OpenVPN client config file with .opvn file extension&lt;/li&gt;&lt;li&gt;Inside the browser&#39;s file download area, it will ask to reject or keep the file. For me, it doesn&#39;t prompt me anything, and I have to click on download button (in Chrome), then I can see it is showing an additional &quot;Keep&quot; button next to the .opvn file&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Clicks on &quot;Keep&quot; button next to the .opvn file to confirm file download&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Now, distribute the OpenVPN client configuration files to machines, and mobile devices where you want to use OpenVPN client. For examples&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Windows PC - copy the file to the copy through file sharing, or USB thumbdrives&lt;/li&gt;&lt;li&gt;Apple iOS such as iPhone, iPad - uses e-mail file attachment to send to the email addresses where your iOS devices (iPhone, iPad) has e-mail configured.&amp;nbsp; If you have not setup e-mail, please set it up, and you can remove it after you have OpenVPN client setup&lt;/li&gt;&lt;li&gt;Android - I recommend to use e-mail as well, unless you have SD card&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;For each of the devices or PC you have, install OpenVPN client, which then you can use to import the .opvn file&lt;/li&gt;&lt;li&gt;By now, OpenVPN has been running inside the ASUS AP, and OpenVPN client configuration files are readily to be used (and distributed)&lt;/li&gt;&lt;li&gt;In Windows OS where you want to RDC into it, open &quot;Windows Defender Firewall&quot;&lt;/li&gt;&lt;ol&gt;&lt;li&gt;For Windows 11, navigation nis Control Panel &amp;gt; System and Security &amp;gt; Windows Defender Firewall&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;You should see following 3 network area:&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Private network - this is the firewall configuration for machines which has the identical IP address of this Windows OS. For example, if the Windows&#39;s IP is 192.168.1.1, then this is for incoming RDC request from 192.168.1.1 - 192.168.1.254&lt;/li&gt;&lt;li&gt;Domain network - this is optional. If it shows up, then typically it is for local LAN but with different IP than 192.168.1.1&lt;/li&gt;&lt;li&gt;Guest or public networks - starting Windows 11, both WiFi and LAN adapters are set to public network, and will block incoming RDC connection&lt;/li&gt;&lt;li&gt;Follows this step if want to change the LAN or WiFi adapter to &quot;Private&quot; network for Windows 11&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Click on Start &amp;gt; Your name&lt;/li&gt;&lt;li&gt;Next to your Avator icon, click on &quot;My Microsoft account&quot; to open configuration menu&lt;/li&gt;&lt;li&gt;You should land on Home menu&lt;/li&gt;&lt;li&gt;Look at the 4th menu, called &quot;Network &amp;amp; internet&quot;&lt;/li&gt;&lt;li&gt;Clicks on menu &quot;Network &amp;amp; internet&quot;&lt;/li&gt;&lt;li&gt;You can only change its profile if the network adapter is connected.&amp;nbsp; So if you want to change&lt;/li&gt;&lt;ol&gt;&lt;li&gt;WiFi adapter, then connects your WiFi&lt;/li&gt;&lt;li&gt;LAN adapter, then connects LAN cable&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Clicks on WiFi or LAN adapter&lt;/li&gt;&lt;li&gt;Clicks on WiFi SSID which is the 2nd button below WiFi on/off button&lt;/li&gt;&lt;li&gt;For example&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiMD8_nOBTfYqQlf3ADCgT7b_F6Uan1pufU7zbtaHT5llcu2yUbrxGpH-a1bBvq0LsVFOfk5RtOHtdJhCcCOZfvUSblp9iQg8USStuFMYFRnfl-mJPUTbG_p8hz-cYttjetcRQB0PjKYwrXP3gjcNtl0h_uXU97kFGGU0QcRHFF5RduV3GkTlE4cjNDiKqK&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;719&quot; data-original-width=&quot;578&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiMD8_nOBTfYqQlf3ADCgT7b_F6Uan1pufU7zbtaHT5llcu2yUbrxGpH-a1bBvq0LsVFOfk5RtOHtdJhCcCOZfvUSblp9iQg8USStuFMYFRnfl-mJPUTbG_p8hz-cYttjetcRQB0PjKYwrXP3gjcNtl0h_uXU97kFGGU0QcRHFF5RduV3GkTlE4cjNDiKqK&quot; width=&quot;193&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Clicks on &quot;Private network&quot; to change its profile to &quot;Private network&quot; which will allow incoming RDC connection&lt;/li&gt;&lt;li&gt;If your computer belongs to a domain, then clicks on &quot;Domain network&quot; instead&lt;/li&gt;&lt;li&gt;Now you are clear which network profile to pick in subsequent step of Windows Defender Firewall when choosing network profile of private, domain, public&lt;/li&gt;&lt;li&gt;Runs &quot;Windows Defender Firewall with Advanced Security&quot;&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Clicks on &quot;Inbound Rules&quot;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjmahcH2Mrvz2u6EPs5aXA-C7NEl_JSJVXEm3Fh9UvXaa6IRQy9cz6TDP8zakERsYTBC3WMuYfOAA91K2xEq6McBaN0Ma11hikv7FQVQXjYhfc5pWAI2Rs0ppc4IJDobGe0gHB-tgCaFCWd3RjX6GnlbnH1i_K9k8ekmDZ28PECmoZNRsPzO_8nYo2KO9-8&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;157&quot; data-original-width=&quot;215&quot; height=&quot;234&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjmahcH2Mrvz2u6EPs5aXA-C7NEl_JSJVXEm3Fh9UvXaa6IRQy9cz6TDP8zakERsYTBC3WMuYfOAA91K2xEq6McBaN0Ma11hikv7FQVQXjYhfc5pWAI2Rs0ppc4IJDobGe0gHB-tgCaFCWd3RjX6GnlbnH1i_K9k8ekmDZ28PECmoZNRsPzO_8nYo2KO9-8&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Scroll down to &quot;Remote Desktop - User Mode (TCP-In)&quot;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhOW4a_0KpZr_m7QRv7zxx1PlCo4Ab_M7ewFcmisCUq9RDgFTmeZ-8VEVpxnpsyD2zEdmrWm6Vf_NT7C-BkGNSPXiNJGZiKRRHwfl1hcdHytwvKUa8IJDHqg_CBre_ESfCF_YfgyokfR3qvuvHqzrs7VWbPvvBNg4loASr2ZpzVqUOt9kK4WP4hT2cHTT9J&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;129&quot; data-original-width=&quot;452&quot; height=&quot;91&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhOW4a_0KpZr_m7QRv7zxx1PlCo4Ab_M7ewFcmisCUq9RDgFTmeZ-8VEVpxnpsyD2zEdmrWm6Vf_NT7C-BkGNSPXiNJGZiKRRHwfl1hcdHytwvKUa8IJDHqg_CBre_ESfCF_YfgyokfR3qvuvHqzrs7VWbPvvBNg4loASr2ZpzVqUOt9kK4WP4hT2cHTT9J&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Confirms the Profile = All, which means it allows incoming TCP connection to default RDC port 3389 from private, public, and domain profile&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Right clicks and select &quot;Enable Rule&quot;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Now your computer will be able to accept incoming RDC connection from any IP in this network adapter/IP&lt;/li&gt;&lt;li&gt;By now, following are done&lt;/li&gt;&lt;ol&gt;&lt;li&gt;ASUS AP configured with OpenVPN server&lt;/li&gt;&lt;li&gt;OpenVPN server is running&lt;/li&gt;&lt;li&gt;OpenVPN client configuration .opvn file is distributed&lt;/li&gt;&lt;li&gt;Windows machine configured to accept incoming RDC connection&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;In each of the device you would like to run OpenVPN client, import the .opvn file&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Installs OpenVPN client software&lt;/li&gt;&lt;li&gt;Windows - download from&amp;nbsp;https://openvpn.net/client/&lt;/li&gt;&lt;li&gt;iOS - search and download from Apple Store&lt;/li&gt;&lt;li&gt;Android - search and download from Google Play&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Import the .opvn file&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Windows - double click on .opvn file&lt;/li&gt;&lt;li&gt;iOS - open the e-mail which contains the .opvn attachment. Touch the .opvn attachment to show various options of opening the file. Choose &quot;OpenVPN&quot; icon&lt;/li&gt;&lt;ol&gt;&lt;li&gt;OpenVPN app will run&lt;/li&gt;&lt;li&gt;It will automatically trigger import profile screen&lt;/li&gt;&lt;li&gt;Gives the profile your desire name, if you don&#39;t like the default cryptic name&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Android - open the e-mail which contains the .opvn attachment. Touch the .opvn attachment to show various options of opening the file. Choose &quot;OpenVPN&quot; icon&lt;/li&gt;&lt;ol&gt;&lt;li&gt;OpenVPN app will run&lt;/li&gt;&lt;li&gt;It will automatically trigger import profile screen&lt;/li&gt;&lt;li&gt;Gives the profile your desire name, if you don&#39;t like the default cryptic name&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;li&gt;If you device and the Windows (RDC target host) are connecting to the same network, then in your OpenVPN client device, disconnect from the LAN/WiFi, and uses the Internet from your cellphone&lt;/li&gt;&lt;li&gt;Turn on the OpenVPN to connect to ASUS AP against the newly imported profile&lt;/li&gt;&lt;li&gt;Now, the device should be able to RDC to the target Windows using mstsc.exe command&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/19675334534924709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/19675334534924709' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/19675334534924709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/19675334534924709'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2025/08/openvpn-windows-rdc-remote-desktop.html' title='OpenVPN: Windows RDC Remote Desktop Configuration'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEiMD8_nOBTfYqQlf3ADCgT7b_F6Uan1pufU7zbtaHT5llcu2yUbrxGpH-a1bBvq0LsVFOfk5RtOHtdJhCcCOZfvUSblp9iQg8USStuFMYFRnfl-mJPUTbG_p8hz-cYttjetcRQB0PjKYwrXP3gjcNtl0h_uXU97kFGGU0QcRHFF5RduV3GkTlE4cjNDiKqK=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-3585716118059084405</id><published>2025-07-17T11:48:00.001-04:00</published><updated>2025-07-17T11:48:17.029-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux memory tuning"/><title type='text'>Linux: Dynamically/Realtime Changing ulimit for existing process</title><content type='html'>Product: RedHat Enterprise Linux RHEL&lt;div&gt;Version: All&lt;/div&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Overview&lt;/h1&gt;&lt;div&gt;Many UNIX/Linux software requesting to set process&#39; limit using ulimit command.&amp;nbsp; This includes Oracle RDBMS, Apache httpd, Apache Tomcat, any file server, Cognos Analytics, call center servers, media server, Java base server, etc.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;No vendor in any major application explain the objective of setting ulimit, and eventually the daemon/process hang or crash due to hitting such OS limit per user.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For reader who has no idea what is ulimit, the short description is that this is to configure user level&#39;s OS limit for any process run and own by the user.&amp;nbsp; This includes number of active open network connection, number of active open files, max file limit, max process RAM, etc.&amp;nbsp; This is not available in Windows, so anyone who never proper learn UNIX, they will miss this, or even miss this configuration.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Often, may IT personnel don&#39;t follow vendor&#39;s documentation to install the software.&amp;nbsp; Some vendor&#39;s document might even provided low value instead of a formula to properly tune the ulimit.&amp;nbsp; You need to understand that many developers do not understand OS, including UNIX OS, so it is challenging for a someone who don&#39;t understand OS to provide OS tuning parameter and value.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Eventually, this leads to many daemons hanging and even crash.&amp;nbsp; As an OS administrator, or software support personnel, it will be helpful to resolve the hanging, or even prevent it reach that critical state when the daemon start to behaving poorly, if you are able to catch it before it crash.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This post introduce a Linux commands which you can change the ulimit at in real time without restarting the daemon, or OS.&amp;nbsp; This command required to be run as root:&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;RedHat RHEL - prlimit&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Documentation:&amp;nbsp;https://man7.org/linux/man-pages/man1/prlimit.1.html&lt;/li&gt;&lt;li&gt;Documentation: https://linux.die.net/man/2/prlimit&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Ubuntu - chpst&lt;/li&gt;&lt;ul&gt;&lt;li&gt;Documentation:&amp;nbsp;https://manpages.ubuntu.com/manpages/lunar/man8/chpst.8.html&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div&gt;For the rest of the post, I will just refer to RHEL command of prlimit, as most company will use RHEL to run their software.&lt;/div&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Usage&lt;/h2&gt;&lt;div&gt;Command prlimit can be used to change the ulimit for a specific process in real time without shutting it down, or reboot OS.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You need to always specify the process ID, or called PID in &quot;ps&quot; command&#39;s output.&amp;nbsp; So the syntax will always to include &quot;-p &amp;lt;PID&quot; such as &quot;prlimit -p &amp;lt;PID of Oracle&amp;gt;&quot;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Following ulimit configuration can be configure in real time:&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;RAM related&lt;/li&gt;&lt;ul&gt;&lt;li&gt;max data size (RAM) - parameter -d&lt;/li&gt;&lt;li&gt;max resident set size RSS (RAM) - parameter -m&lt;/li&gt;&lt;li&gt;max stack size (RAM &amp;gt; stack) - parameter -s&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Storage related&lt;/li&gt;&lt;ul&gt;&lt;li&gt;max file size (storage) - parameter -f&lt;/li&gt;&lt;li&gt;max number of open files - parameter -n&lt;/li&gt;&lt;li&gt;max number of file locks - parameter -x&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Messaging related&lt;/li&gt;&lt;ul&gt;&lt;li&gt;max number of bytes in POSIX message queue - parameter -q&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;Process&lt;/li&gt;&lt;ul&gt;&lt;li&gt;max number of processes - parameter -u&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div&gt;Each OS resource usage has a different command to check their current utilization, so you can search in Internet to identify how much is the usage before tune up these values.&amp;nbsp; I might write a new blog post if this page is getting sufficient hit, such as more than 50,000 hit.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;By adjusting the ulimit of the active process in real time, you can avoid unplan downtime during business hour, and schedule a proper maintenance window to tune the OS.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/3585716118059084405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/3585716118059084405' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/3585716118059084405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/3585716118059084405'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2025/07/linux-dynamicallyrealtime-changing.html' title='Linux: Dynamically/Realtime Changing ulimit for existing process'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-5659431176814021606</id><published>2025-07-09T13:44:00.004-04:00</published><updated>2025-07-09T13:44:33.623-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SAP Data Services"/><title type='text'>SAP IPS Logs</title><content type='html'>Product: SAP Information Platform Server (IPS, CMS), SAP BusinessObject Data Services (BODS)&lt;div&gt;Version: 4.2.x - 4.3.x&lt;/div&gt;&lt;div&gt;OS: Windows, Linux&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There is no documentation about the log files created by SAP CMS software that bundled with SAP BODS software.&amp;nbsp; This post is mainly covering the log files&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Following are the log files created by SAP CMS software, and they mix together with CMS&#39; Tomcat application server:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;aps_ORDSUPWDS01.AdaptiveProcessingServer_gc.log&lt;/div&gt;&lt;div&gt;aps_ORDSUPWDS01.AdaptiveProcessingServer_ncs.trc&lt;/div&gt;&lt;div&gt;aps_ORDSUPWDS01.AdaptiveProcessingServer_trace.000001.glf&lt;/div&gt;&lt;div&gt;aps_ORDSUPWDS01.EIMAdaptiveProcessingServer_gc.log&lt;/div&gt;&lt;div&gt;aps_ORDSUPWDS01.EIMAdaptiveProcessingServer_ncs.trc&lt;/div&gt;&lt;div&gt;aps_ORDSUPWDS01.EIMAdaptiveProcessingServer_trace.000001.glf&lt;/div&gt;&lt;div&gt;cms_ORDSUPWDS01.CentralManagementServer_ncs.trc&lt;/div&gt;&lt;div&gt;cms_ORDSUPWDS01.CentralManagementServer_trace.000001.glf&lt;/div&gt;&lt;div&gt;DS.AdminService_2025079_7444820959_0.log&lt;/div&gt;&lt;div&gt;DS.AdminService_2025079_7444820959_0.log.lck&lt;/div&gt;&lt;div&gt;DS.JobLauncherService_2025079_7444817762_0.log&lt;/div&gt;&lt;div&gt;DS.JobLauncherService_2025079_7444817762_0.log.lck&lt;/div&gt;&lt;div&gt;DS.RFCService_2025079_7444811058_0.log&lt;/div&gt;&lt;div&gt;DS.RFCService_2025079_7444811058_0.log.lck&lt;/div&gt;&lt;div&gt;fileserver_ORDSUPWDS01.InputFileRepository_ncs.trc&lt;/div&gt;&lt;div&gt;fileserver_ORDSUPWDS01.OutputFileRepository_ncs.trc&lt;/div&gt;&lt;div&gt;ICC.MetadataService_ord-sup-wds01_2025079_74448304_60_0.log&lt;/div&gt;&lt;div&gt;ICC.MetadataService_ord-sup-wds01_2025079_74448304_60_0.log.lck&lt;/div&gt;&lt;div&gt;ICC.ViewdataService_ord-sup-wds01_2025079_74448177_63_0.log&lt;/div&gt;&lt;div&gt;ICC.ViewdataService_ord-sup-wds01_2025079_74448177_63_0.log.lck&lt;/div&gt;&lt;div&gt;jobserver_ORDSUPWDS01.AdaptiveJobServer_ncs.trc&lt;/div&gt;&lt;div&gt;jobserver_ORDSUPWDS01.AdaptiveJobServer_trace.000001.glf&lt;/div&gt;&lt;div&gt;ORDSUPWDS01_gc.log&lt;/div&gt;&lt;div&gt;SIA_ORDSUPWDS01_trace.000001.glf&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Purpose&lt;/div&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;File extension &quot;.lck&quot; is lock file or a flag file which to imply the CMS daemon is running.&amp;nbsp; CMS has following daemons, and each has their own .lck lock file&lt;/li&gt;&lt;ol&gt;&lt;li&gt;DS.AdminService_2025079_7444820959_0.log.lck&lt;/li&gt;&lt;li&gt;DS.JobLauncherService_2025079_7444817762_0.log.lck&lt;/li&gt;&lt;li&gt;DS.RFCService_2025079_7444811058_0.log.lck&lt;/li&gt;&lt;li&gt;ICC.MetadataService_ord-sup-wds01_2025079_74448304_60_0.log.lck&lt;/li&gt;&lt;li&gt;ICC.ViewdataService_ord-sup-wds01_2025079_74448177_63_0.log.lck&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;File suffix &quot;_gc&quot; and extention &quot;.log&quot; (...._gc.log) is Java garbage collection log.&amp;nbsp; CMS daemon has no reason to has high Java memory usage, so these log files can be ignore&lt;/li&gt;&lt;li&gt;The rest of the log files are useful for troubleshoot SAP CMS daemons, and needs to read everyone of them&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/5659431176814021606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/5659431176814021606' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/5659431176814021606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/5659431176814021606'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2025/07/sap-ips-logs.html' title='SAP IPS Logs'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-1177554229168240025</id><published>2025-06-06T11:22:00.002-04:00</published><updated>2025-06-06T11:22:21.042-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SAP Data Services"/><title type='text'>SAP BODS Designer Central Repository Not Showing Up When Adding</title><content type='html'>&lt;p&gt;Product: SAP Data Services&lt;br /&gt;Version: 4.2.x - 4.3.x&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Problem Description&lt;/h1&gt;&lt;p&gt;There are multiple BODS central repositories in the system.&amp;nbsp; Few of the central repositories are &lt;b&gt;cloned &lt;/b&gt;from existing central repositories for following reasons:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Setting up more central repositories in identical BODS versions for current env&lt;/li&gt;&lt;li&gt;Setup another central repositories in identical BODS versions for different env. Issue occurs after 2nd attempt of refresh after DS Designer added the central repositories on 1st attempt&lt;/li&gt;&lt;li&gt;During upgrade, clone into a different DB user (Oracle), or logical database (MS SQL Server), then uses BODS Repository Manager to upgrade it without disrupting older BODS version&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;In DS Designer, menu Tools &amp;gt; Central Repository&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiqQps8CdgqypQAJp0sAat-Q-6RHab5_659e4AAiW87vEuTJP76iostaTeVTArRi3eYeLnTk38Cdf93VgCiVCWpq_6vj6RN7rkGzKYCB4333K9L6CYm1PHUZWroeheB532iRaxYMhZbhsWJeLW3Bi09693Y1y7Mov-CjkRVfXOfZO84Dx0WvadbY_7KwBib&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;293&quot; data-original-width=&quot;652&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiqQps8CdgqypQAJp0sAat-Q-6RHab5_659e4AAiW87vEuTJP76iostaTeVTArRi3eYeLnTk38Cdf93VgCiVCWpq_6vj6RN7rkGzKYCB4333K9L6CYm1PHUZWroeheB532iRaxYMhZbhsWJeLW3Bi09693Y1y7Mov-CjkRVfXOfZO84Dx0WvadbY_7KwBib=s16000&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;After clicked &quot;Add&quot; button, it is either display a screen to add more central repository, or following message:&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhY2PDTFfFDlpEjFfgM_whIqJbGGVR95ZIdVSIWzAfzYKbh2gxCZ7H1l-QuPrvdDiZBI9M-woFlJXpnj-gB2_iAXSIzQKXhpJDlP8KeI3a_E_H328VAkPUJJQ0VsX7qrKV8vN1gfMY4YyM_d-Wc0bJ1JrQqOLSKoHKBn45KzxxRjFwiOiwKT2QLZsDi7vcm&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;146&quot; data-original-width=&quot;376&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhY2PDTFfFDlpEjFfgM_whIqJbGGVR95ZIdVSIWzAfzYKbh2gxCZ7H1l-QuPrvdDiZBI9M-woFlJXpnj-gB2_iAXSIzQKXhpJDlP8KeI3a_E_H328VAkPUJJQ0VsX7qrKV8vN1gfMY4YyM_d-Wc0bJ1JrQqOLSKoHKBn45KzxxRjFwiOiwKT2QLZsDi7vcm=s16000&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Even if it shows a list of central repositories to add, users are not able to see the desired central repository from the list.&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;p style=&quot;text-align: start;&quot;&gt;DSMC central repository user and group setup has been done, even for secured central repository, when login to DS Designer as administrator user account.&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Information to Gather&lt;/h1&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;1. Login to central repository and determine the unique ID for the central repository.&amp;nbsp; This is called GUID, which will be added into local repository when users add it.&amp;nbsp; Run following SQL&lt;/p&gt;&lt;p&gt;select guid from al_version;&lt;/p&gt;&lt;p&gt;2. Repeat above for each of the central repository to get all the GUID&lt;/p&gt;&lt;p&gt;3. Login to local repository which failed to see other central repository&lt;/p&gt;&lt;p&gt;4. Run following SQL to show the central repository name and central repository GUID&lt;/p&gt;&lt;p&gt;select name, guid, object_key, object_type from al_lang where object_type = 5 and object_key in (select parent_objid from al_setoptions where parent_objid = al_lang.object_key and option_name = &#39;datastore_repotype&#39; and option_value = &#39;central&#39;);&lt;/p&gt;&lt;p&gt;Sample output:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhuEhoIXnEH4iILsuXO724zA_e2eWS0WU7PGNcn3FTokaYYHMJw9LxQ69dQRJqwpm3XIlfYiWkWpfOFg_SYVb9h25DMJO-EZ8jPKS0lkUaEI-d88pC95lCyvPQv-IY6wUcLz3kYzKbjO3oBfSAXJbUTf6T77YuUvrP2fn4T8KoFy1VtHhPB1lcBXLl82-SG&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;90&quot; data-original-width=&quot;724&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhuEhoIXnEH4iILsuXO724zA_e2eWS0WU7PGNcn3FTokaYYHMJw9LxQ69dQRJqwpm3XIlfYiWkWpfOFg_SYVb9h25DMJO-EZ8jPKS0lkUaEI-d88pC95lCyvPQv-IY6wUcLz3kYzKbjO3oBfSAXJbUTf6T77YuUvrP2fn4T8KoFy1VtHhPB1lcBXLl82-SG=s16000&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;5. Explanation of above in local repository table AL_LANG&lt;/p&gt;&lt;p&gt;5.1. AL_LANG stores all object entries, including secure and non-secure central repositories&lt;/p&gt;&lt;p&gt;5.2. object_type = 5 is for datastores, secure repositories, non-secure repositories&lt;/p&gt;&lt;p&gt;5.3. al_SetOptions stores more detail for secure and non-secure central repository for Option_Name = datastore_repotype with Option_Value = &#39;central&#39;&lt;/p&gt;&lt;p&gt;5.4. If you want to further filter by secure repository, then filter al_SetOptions by Option_Name =&amp;nbsp;CENTRAL_REPO_SECURE, Option_Value =&amp;nbsp;yes&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Analysis&lt;/h2&gt;&lt;p&gt;1. Compares the GUID from Step 1 with Step 4 for the same central repository name&lt;/p&gt;&lt;p&gt;2. Identify which central repository has the same GUID&lt;/p&gt;&lt;p&gt;3. This should be the central repository which is not visible in DS Designer&#39;s adding central repository screen&lt;/p&gt;&lt;p&gt;4. If you removed the central repository with the same GUID from DS Designer, then the list will be able to show all the central repository, even their GUID are identical&lt;/p&gt;&lt;p&gt;5. However, once you added one of those duplicate GUID into DS Designer, when try to add central repository again, you won&#39;t be able to see the central repository that has duplicate GUID&lt;/p&gt;&lt;p&gt;6. This is a consistent behavior in all local repositories&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Root Cause&lt;/h1&gt;&lt;p&gt;&lt;span style=&quot;background-color: white;&quot;&gt;The AL_Version table was cloned from one central repository to another one, which leads to identical unique ID on column GUID.&amp;nbsp; Local repositories expect each central repository to have a unique GUID, else DS Designer assumes the central repository (with the same GUID) has been added, and will hide it.&lt;/span&gt;&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Resolution&lt;/h1&gt;&lt;p&gt;&lt;span style=&quot;background-color: white;&quot;&gt;The supported approach is to use Repository Manager to re-initialize the central repository (all content will be lost), so that it will assign a new GUID.&amp;nbsp; Due to all central repository&#39;s content will be lost, if you want to keep its existing content, then find a local repository which can be used to check-out all content into it, then check back in to the central repository after it is initialized&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/1177554229168240025/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/1177554229168240025' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/1177554229168240025'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/1177554229168240025'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2025/06/sap-bods-designer-central-repository.html' title='SAP BODS Designer Central Repository Not Showing Up When Adding'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEiqQps8CdgqypQAJp0sAat-Q-6RHab5_659e4AAiW87vEuTJP76iostaTeVTArRi3eYeLnTk38Cdf93VgCiVCWpq_6vj6RN7rkGzKYCB4333K9L6CYm1PHUZWroeheB532iRaxYMhZbhsWJeLW3Bi09693Y1y7Mov-CjkRVfXOfZO84Dx0WvadbY_7KwBib=s72-c" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-712152295228977293</id><published>2024-12-10T17:14:00.003-05:00</published><updated>2024-12-13T09:32:39.045-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jdbc ms sql server jar windows authentication"/><title type='text'>SAP IPS/CMC: MS SQL Server Windows Authentication</title><content type='html'>&lt;p&gt;Product: SAP IPS Information Platform Services (or SAP CMS)&lt;br /&gt;Version: 4.1.x, 4.2.x, 4.3.x&lt;br /&gt;OS: Windows Servers 64-bit&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Overview&lt;/h1&gt;&lt;p&gt;There is relatively limited information on Java web applications using MS SQL Server&#39;s Windows authentication in the internet.&amp;nbsp; Microsoft&#39;s JDBC documentation is relatively incomplete and leaves gaps in its installation, and leads to many wrong information around.&lt;/p&gt;&lt;p&gt;SAP IPS, or also called as SAP CMS, is a web application that is running on Apache Tomcat.&amp;nbsp; It uses SAP Java 8 for many years covering SAP IPS v4.1.x until now (v4.3.x) in 2025.&lt;/p&gt;&lt;p&gt;This post mainly to use SAP IPS as an example of web application server to discuss about the proper installation when needs to use MS SQL Server&#39;s Windows authentication&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Background&lt;/h2&gt;&lt;p&gt;Main MS SQL Server JDBC Driver Homepage:&amp;nbsp;https://learn.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver16&lt;/p&gt;&lt;p&gt;As of today, MS SQL Server JDBC version 12.8 is the current version.&amp;nbsp; It supports Java 8, 11, 17, 21, and 22.&amp;nbsp; Moreover, it bundled with 32-bit and 64-bit DLL to be used when the application supports MS SQL Server&#39;s Windows authentication.&amp;nbsp; This post mainly focus in this DLL, as improper installation will leads to the Java application, and web application failed to use Windows authentication.&lt;/p&gt;&lt;p&gt;Support of 32-bit Java adds another layer of complexity, where a lot of people is not aware of it, and do not know 64-bit Windows in term of 32-bit Java application support.&lt;/p&gt;&lt;p&gt;Both Microsoft JDBC driver page, as well as Java does not clarify the Windows DLL search order, which often leads to many Internet forums to contain mix messages.&amp;nbsp; You need to be a DLL developer in order to know Microsoft has long documented DLL search order, which now is located in following web page:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Title:&amp;nbsp;Dynamic-link library search order&lt;/li&gt;&lt;li&gt;URL: https://learn.microsoft.com/en-ca/windows/win32/dlls/dynamic-link-library-search-order&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;This page&#39;s content is not &quot;formatted&quot; for Java.exe, so anyone who is poor in Windows OS, or never done any Windows programming will easily lost, and most probably think this page is not applicable.&lt;/div&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Preparation&lt;/h2&gt;&lt;p&gt;1. Identify your java.exe is 32-bit or 64-bit.&amp;nbsp; This could be a complicated process, if you install your own Java and forgotten about whether you download 32-bit or 64-bit Java.&amp;nbsp; For SAP IPS, it bundled with its own 64-bit Java, so this can be skipped&lt;/p&gt;&lt;p&gt;2. If you java.exe is 32-bit, seriously consider to switch to use 64-bit java.exe so that you can leverage more than 4GB RAM (virtual or physical).&amp;nbsp; Considering Windows Server 2016 only offers in 64-bit, and no 32-bit, so it is not sustainable to use 32-bit java.exe.&amp;nbsp; For SAP IPS, this can be skipped, as it is using 64-bit java&lt;/p&gt;&lt;p&gt;3. Determine whether the application uses JDBC 2.0 distributed transactions, which its JDBC class will be SQLServerXADataSource.&amp;nbsp; It is also called as extended architecture, or XA for short.&amp;nbsp; Most Java program will not uses this.&amp;nbsp; SAP IPS does not use this as well&lt;/p&gt;&lt;p&gt;4. Download MS SQL Server JDBC Driver in either zip or tar.gz format&lt;/p&gt;&lt;p&gt;3. Unzip it into a working directory instead of C:\Program Files\Microsoft JDBC DRIVER 12.8 for SQL Server indicated in the tar.gz/zip &amp;gt; install.txt.&amp;nbsp; SAP IPS only needs 1 DLL responsible for Windows authentication, but not the rest of the files&lt;/p&gt;&lt;p&gt;3.1. This JDBC zip file contains both 32-bit and 64-bit DLL to used for Windows authentication called below&lt;/p&gt;&lt;p&gt;3.1.1.&amp;nbsp;enu\auth\x64\mssql-jdbc_auth-12.8.1.x64.dll - used for 64-bit Java&lt;/p&gt;&lt;p&gt;3.1.2. enu\auth\x86\mssql-jdbc_auth-12.8.1.x86.dll - used for 32-bit Java&lt;/p&gt;&lt;p&gt;3.1.3. This Windows DLL version does not need to match&amp;nbsp;mssql-jdbc-&amp;lt;JDBC version&amp;gt;.jre&amp;lt;jre ver&amp;gt;.jar&lt;/p&gt;&lt;p&gt;3.2. The zip file contains DLL for Java XA extended architecture in both 32-bit and 64-bit.&amp;nbsp; SAP IPS does not use it, so do not need to install these DLL.&amp;nbsp; I have not see any Java applications that uses MS SQL Server JDBC XA, so not much to say, except following mapping.&amp;nbsp; I will recommend to rename the DLL filename to include x64 or x86, as default name can&#39;t easily tell the different:&lt;/p&gt;&lt;p&gt;3.2.1. enu\xa\x64\sqljdbc_xa.dll - used for 64-bit Java&lt;/p&gt;&lt;div&gt;3.2.2. enu\xa\x86\sqljdbc_xa.dll - used for 32-bit Java&lt;/div&gt;&lt;p&gt;3.3. Determine your Java version.&amp;nbsp; Picks the corresponding JAR file based on your Java version.&amp;nbsp; SAP IPS web application bundled with its own JAR file, so it does not use any of these&amp;nbsp; For other readers who uses Java 8 - 21, see following table mapping based on latest JDBC 12.8.1:&lt;/p&gt;&lt;p&gt;3.3.1. Java 8 - 10: uses mssql-jdbc-12.8.1.jre8.jar&lt;/p&gt;&lt;p&gt;3.3.2. Java 11 and higher: uses mssql-jdbc-12.8.1.jre11.jar&lt;/p&gt;&lt;p&gt;4. Determine how many java.exe is installed and used in the client machine.&amp;nbsp; SAP IPS often only has its own Java, and not using external Java that installed by administrator/developer/user&lt;/p&gt;&lt;p&gt;5. Does the Java application&#39;s JAR file bundled with its own JDBC JAR file.&amp;nbsp; If yes, then just need to focus in mssql-jdbc_auth-12.8.1.x64.dll (64-bit) and mssql-jdbc_auth-12.8.1.x86.dll (32-bit) to match the corresponding java.exe bitness&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Planning and Installation&lt;/h2&gt;&lt;p&gt;1. In the computer that you are setting up, determine how many different version of MS SQL Server daemon/instance your applications, as this related to the JDBC driver, and mssql-jdbc_auth-&amp;lt;version&amp;gt;.&amp;lt;bit&amp;gt;.dll.&amp;nbsp; For SAP IPS, and SAP Data Services, it is often to work with 1-2 version of MS SQL Server.&amp;nbsp; This indirectly implies 1 JDBC driver is required in SAP IPS machine, which often support few MS SQL Server version. SAP IPS does not install this DLL, and administrator needs to manually copy mssql-jdbc_auth-12.8.1.x64.dll (64-bit only).&amp;nbsp; Recommended directory is C:\Windows\system32\ (64-bit only)&lt;/p&gt;&lt;p&gt;2. If the Java applications installed in the same machine required to install multiple different Java JDBC - MS SQL Server JAR file, and different mssql-jdbc_auth.dll, then take note of this&lt;/p&gt;&lt;p&gt;2.1. This implies following files in the same MS SQL Server client machine:&lt;/p&gt;&lt;p&gt;2.1.1. mssql-jdbc-12.8.1.jre8.jar (or jre11) must not resides in jdk\lib\ext\ directory, unless there are multiple Java directory&lt;/p&gt;&lt;p&gt;2.1.2. mssql-jdbc_auth.dll (32-bit and 64-bit) must not resides in C:\Windows\system32\ or C:\Windows\SysWOW64\&lt;/p&gt;&lt;p&gt;3. If multiple Java.exe is used, then decide whether each will has its own JDBC JAR version, and mssql-jdbc_auth-&amp;lt;version&amp;gt;.x64.dll version.&amp;nbsp; I will ignore anyone will use 32-bit java.exe&lt;/p&gt;&lt;p&gt;3.1. If only 1 JDBC client version is required, then copy the JAR file into each of the jdk\lib\ext\, or jre\lib\ext\ directory.&amp;nbsp; This is not required for SAP IPS, or any web application which bundled the JDBC jar file in its WEB-INF\lib\ directory&lt;/p&gt;&lt;p&gt;3.2. If only 1 version of Window authentication DLL is required, then copy the DLL file into C:\Windows&lt;/p&gt;&lt;p&gt;3.2.1. 64-bit: Copy into C:\Windows\system32\mssql-jdbc_auth-12.8.1.x64.dll&lt;/p&gt;&lt;p&gt;3.2.2. 32-bit: Copy into C:\Windows\SysWOW64\mssql-jdbc_auth-12.8.1.x86.dll&lt;/p&gt;&lt;p&gt;4. If you want to keep a separate directory to keep mssql-jdbc_auth-&amp;lt;version&amp;gt;.&amp;lt;bitness&amp;gt;.dll, then edit Windows system environment variable, and set PATH to include this custom directory.&amp;nbsp; I will recommend this as well, but this is a global setup, and will affects all java to use the same DLL in this machine&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Troubleshooting&lt;/h2&gt;&lt;p&gt;Troubleshooting any applications that use MS SQL Server Windows authentication will require to troubleshoot using the specific Window username.&amp;nbsp; This is often a ActiveDirectory domain user account.&amp;nbsp; ActiveDirectory&#39;s user group policy can further configured to prevent the user from login interactively (using Windows login screen).&lt;/p&gt;&lt;p&gt;Due to user group policy could disable interactive login to the Windows machine, troubleshooting will require to ask ActiveDirectory admin to temporary enable/allow interactive login.&amp;nbsp; This page assumes the ActiveDirectory user is able to login to Windows, or uses RunAs command to run CMD to perform troubleshooting.&lt;/p&gt;&lt;p&gt;Starts the troubleshooting using following 2 methods to login as the Windows user who is authorized to login to MS SQL Server (Windows authentication):&lt;/p&gt;&lt;p&gt;1.. In Windows Login screen, login as the Windows user who used to start the Java.&amp;nbsp; In this example, SAP IPS/CMS&lt;/p&gt;&lt;p&gt;2. Login to Windows as your personal username, or other username that allows to login to the SAP IPS machine.&amp;nbsp; In Start menu, type CMD &amp;gt; right-click &amp;gt; Run As Other User &amp;gt; enter the Windows user who used to start Java.&amp;nbsp; You will get Command Prompt, with the username shown as the one you just entered&lt;/p&gt;&lt;p&gt;Once you reached this, the rest of the steps are relatively easy for Java application.&amp;nbsp; I will use the wording &quot;authorized Windows user&quot; to indicate the Windows username authorized to login to MS SQL Server in the rest of the procedure.&lt;/p&gt;&lt;p&gt;1. Download full MS SQL Server JDBC file as zip (Windows) from official homepage of https://learn.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-ver16&lt;/p&gt;&lt;p&gt;2. As of today, JDBC version 12.8.1 is compatible with Java 8 - 21, and MS SQL Server version 2016 - 2022&lt;/p&gt;&lt;p&gt;3. If the Java program needs to connects to MS SQL Server 2014, then download JDBC version 12.6 or older (minimum 3.0)&lt;/p&gt;&lt;p&gt;4. Extract sample Java login program from the zip file&lt;/p&gt;&lt;p&gt;4.1. Directory name: sqljdbc_12.8 &amp;gt; enu &amp;gt; samples &amp;gt; connections &amp;gt; ConnectURL.java&lt;/p&gt;&lt;p&gt;5. Modify ConnectURL.java with the MS SQL Server login, e.g. hostname, port, DB name&lt;/p&gt;&lt;p&gt;5.1. Modify line 30:&amp;nbsp;String connectionUrl = &quot;jdbc:sqlserver://&amp;lt;server&amp;gt;:&amp;lt;port&amp;gt;;databaseName=AdventureWorks;user=&amp;lt;user&amp;gt;;password=&amp;lt;password&amp;gt;&quot;;&lt;/p&gt;&lt;p&gt;5.1.1. Fill in &amp;lt;server&amp;gt; as the MS SQL Server hostname&lt;/p&gt;&lt;p&gt;5.1.2. Fill in &amp;lt;port&amp;gt; as the MS SQL Server port number&lt;/p&gt;&lt;p&gt;5.1.3. Replace AdventureWorks as the MS SQL Server logical database nane.&amp;nbsp; If there is no DB, then master DB will always be there&lt;/p&gt;&lt;p&gt;5.1.4. Removes &quot;;user=&amp;lt;user&amp;gt;;password=&amp;lt;password&amp;gt;&quot;&lt;/p&gt;&lt;p&gt;5.1.5. Append &quot;;integratedSecurity=true&quot; after the databaseName parameter, e.g. &quot;jabc:sqlserver://......databaseName=master;integratedSecurity=true;trustServerCertificate=true&quot;&lt;/p&gt;&lt;p&gt;5.1.6. The parameter &quot;trustServerCertificate=true&quot; is optional, but many DBA has configured to force SSL, as well as used self-sign SSL certificate.&amp;nbsp; More description can be found in Learn.Microsoft.com:&amp;nbsp;https://learn.microsoft.com/en-us/sql/connect/jdbc/connecting-with-ssl-encryption?view=sql-server-ver16&lt;/p&gt;&lt;p&gt;6. Compile the Java program. Let&#39;s keep the filename as ConnectURL.java.&amp;nbsp; For SAP IPS, please uses Java 8. e.g. AdoptOpenJDK, Oracle Java, Amazon Java 8&lt;/p&gt;&lt;p&gt;6.1.&amp;lt;JAVA JRE 8 PATH&amp;gt;\bin\javac ConnectURL.java.&amp;nbsp; You can use either 64-bit or 32-bit as this is a small program that won&#39;t use up 4GB RAM&lt;/p&gt;&lt;p&gt;6.2. You will see new file ConnectURL.class in the current directory&lt;/p&gt;&lt;p&gt;7. Run the ConnectURL.class program with debug mode.&amp;nbsp; This step will provides more helpful information in troubleshooting the login issue&lt;/p&gt;&lt;p&gt;7.1. Copy the MS SQL Server JDBC JAR file into the same directory as ConnectURL.class&lt;/p&gt;&lt;p&gt;7.2. Copy&amp;nbsp;mssql-jdbc_auth-12.6.2.x64.dll into the same directory as ConnectURL.class.&amp;nbsp; SAP BODS 4.2SP3PL2 bundled with JDBC MS SQL Server v12.6.2, so I will use this version.&amp;nbsp; You will download and test based on the version you use&lt;/p&gt;&lt;p&gt;7.3. Runs Java.exe v8 64-bit to run the program.&amp;nbsp; Uses following syntax:&lt;/p&gt;&lt;p&gt;7.3.1. Command: java -Djavax.net.debug=ssl&amp;nbsp; --classpath&amp;nbsp;mssql-jdbc-12.6.2.jre8.jar:. ConnectURL&lt;/p&gt;&lt;p&gt;7.4. If you failed, you can test with different scenarios like below:&lt;/p&gt;&lt;p&gt;7.4.1. java.exe 32-bit or 64-bit&lt;/p&gt;&lt;p&gt;7.4.2. java.exe on different version, e.g. 8, 9, 10, 11, all the way to 21&lt;/p&gt;&lt;p&gt;7.4.3. different JDBC JAR file for mssql-jdbc-&amp;lt;JDBC version&amp;gt;.jre8.jar&lt;/p&gt;&lt;p&gt;7.4.4. different javax.net.debug, such as only shows SSL handshake - &quot;java -Djavax.net.debug=ssl:handshake&amp;nbsp; --classpath&amp;nbsp;mssql-jdbc-12.6.2.jre8.jar:. ConnectURL&quot;&lt;/p&gt;&lt;p&gt;7.4.5. has multiple copy of ConnectURL.class which compiled with different Java.exe version&lt;/p&gt;&lt;p&gt;7.5. Tries different combination so that you fully understand the issue is in&lt;/p&gt;&lt;p&gt;7.5.1. java.exe - 64-bit, distribution of the java.exe, e.g. SAP Java, IBM Java, Oracle Java, AdoptOpenJDK Java, Amazon AWS Java, RedHat Java&lt;/p&gt;&lt;p&gt;7.5.2. mssql-jdbc-&amp;lt;version&amp;gt;.jre8.jar - could be different JDBC version, jre8.jar or jre11.jar&lt;/p&gt;&lt;p&gt;7.5.3. mssql-jdbc_auth-&amp;lt;version&amp;gt;.x64.dll - Microsoft never say whether the DLL version must match JDBC JAR, so you can try different version that bundled with 3rd party software, e.g. SAP BODS 4.3SP3PL3 bundled with mssql-jdbc_auth-12.6.0.x64.dll with mssql-jdbc-12.6.2.jre8.jar (different version)&lt;/p&gt;&lt;p&gt;7.5.4. OS, machine - easy to copy this to any machine, laptop, server, gateway so that you can repeat this test easily&lt;/p&gt;&lt;p&gt;7.5.5. Copy mssql-jdbc_auth-&amp;lt;version&amp;gt;.x64.dll into a dedicated directory, e.g. D:\ReportServer\JDBC\MSSQLServer12.6.2\, and modify PATH to include this directory (must change PATH to points to the directory where this DLL located)&lt;/p&gt;&lt;p&gt;7.5.6. For above PATH, you can replace it by specifying parameter &quot;-Djava.library.path=D:\ReportServer\JDBC\MSSQLServer12.6.2&quot;&lt;/p&gt;&lt;p&gt;8. mssql-jdbc_auth-&amp;lt;version&amp;gt;.x64.dll - Some recommendations to perform more troubleshooting in this section.&amp;nbsp; Removes mssql-jdbc_auth-&amp;lt;version&amp;gt;.x64.dll from current directory, and place it in different directories based on the application that you work on&lt;/p&gt;&lt;p&gt;8.1. Example #1, SAP IPS/BODS placed it in C:\Windows\system32\ (for 64-bit DLL) and C:\Windows\SysWOW64\ (for 32-bit DLL)&lt;/p&gt;&lt;p&gt;8.2. Example #2, &amp;lt;java JRE&amp;gt;\lib\ext\ directory, which is the recommended directory to store external JAR.&amp;nbsp; Some developers or 3rd party vendors recommend to put into the application&#39;s JAR file, while I recommend to put into dedicated Java directory in its lib\ext for ease of security patching, and upgrade by isolating the Java application from popupar vendor, like MS SQL Server&lt;/p&gt;&lt;p&gt;8.3. Example #3, put it in your own Java JAR&#39;s WEB-INF\lib\ directory&lt;/p&gt;&lt;p&gt;8.4. Do not place 32-bit of DLL, e.g. mssql-jdbc_auth-12.8.1.x86.dll into C:\Windows\SysWOW64\.&amp;nbsp; Window&#39;s directory architecture design for this directory is for 32-bit application in 64-bit Windows (in other word, in 32-bit Windows 10, SysWOW64 directory doesn&#39;t exists, and you need to put the 32-bit DLL into C:\Windows\system32\ directory).&amp;nbsp; Java 64-bit application will work with this DLL in SysWOW64, as it is ignoring DLL in 32-bit SysWOW64 directory, even it exits&lt;/p&gt;&lt;p&gt;8.5. Do not place 64-bit of DLL, .g. mssql-jdbc_auth-12.8.1.x64.dll into C:\Windows\system32\ for Windows 64-bit.&amp;nbsp; This will leads to Java 64-bit failed to work in its Windows authentication, and you will required an OS&amp;nbsp;&lt;/p&gt;&lt;p&gt;9. By now, you will know the relationship of mssql-jdbc_auth-&amp;lt;version&amp;gt;.x64.dll, 32-bit Java, 64-bit Java, JDBC JAR version, SSL handshake, C:\Windows\system32\ for DLL (if using 64-bit Java.exe), and&amp;nbsp;C:\Windows\SysWOW64\mssql-jdbc_auth-&amp;lt;version&amp;gt;.x86.dll (if using 32-bit Java.exe)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/712152295228977293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/712152295228977293' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/712152295228977293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/712152295228977293'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2024/12/sap-ipscmc-ms-sql-server-windows.html' title='SAP IPS/CMC: MS SQL Server Windows Authentication'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-3323531441402725687</id><published>2024-11-08T15:07:00.001-05:00</published><updated>2024-11-08T15:07:13.419-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="sap ips v4.3 upgrade path"/><title type='text'>SAP IPS v4.3 - Upgrade from IPV v4.2</title><content type='html'>Product: SAP Data Services (BODS), Information Platform (IPS)&lt;br /&gt;&lt;div&gt;Version: 4.3&lt;/div&gt;&lt;div&gt;Related Product: SAP Data Services v4.3.x&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Overview&lt;/h1&gt;&lt;div&gt;This is another cycle of IPS v4.2 -&amp;gt; 4.3 upgrade again, and the same issues happened last time 10+ year ago for IPS v4.1 -&amp;gt; 4.2 is happening again this time.&amp;nbsp; This is due to no SAP IPS v4.3 upgrade document, and it is based on SAP KB that only those who have paid SAP Support account can see it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This post is to highlight all the known issues which SAP IPS team think this is the &quot;normal&quot; process that customer should aware of.&amp;nbsp; My objective is to address the frustration in both IPS v4.3 and Data Services v4.3 upgrade.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Issues Highlight&lt;/h1&gt;&lt;div&gt;1. SAP IPS v4.3 fresh installation does not required to enter license key by using InstallIPS.exe (Windows) or InstallIPS (Linux(, but if you perform in-place upgrade, then you need to enter IPS v4.3 license key which SAP document doesn&#39;t say (there is no IPS upgrade doc)&lt;/div&gt;&lt;div&gt;2. When doing IPS v4.2 -&amp;gt; v4.3 in-place upgrade, both InstallIPS.exe and setup.exe will not pass the IPS v4.3 license key into the IPS v4.2.&amp;nbsp; So you must enter SAP IPS v4.3 license key into it after completed IPS v4.3 upgrade&lt;/div&gt;&lt;div&gt;3. SAP KB title will use the word &quot;BIP 4.3&quot; instead of &quot;IPS 4.3&quot; so it is not easy to find SAP KB to tell you that you need to use their license request page to generate IPS v4.3 license key (SAP&#39;s desire process)&lt;/div&gt;&lt;div&gt;4. SAP admin who has SAP Support access is not able to see the IPS product in the license key request page in SAP Support homepage (which in another SAP KB for IPS v4.1 to tell you to raise SAP ticket)&lt;/div&gt;&lt;div&gt;5. To leverage the bundled IPS v4.3 license key, you need to fully uninstall IPS v4.2&lt;/div&gt;&lt;div&gt;6. For those who plan to uninstall IPS&lt;/div&gt;&lt;div&gt;6.1 if you have multiple IPS v4.2 patches installed in the machine (Windows only), the Windows uninstall method might break the IPS v4.2 before you fully uninstall all IPS product patches.&amp;nbsp; So the Windows machine will not be able to completely uninstall IPS v4.2&lt;/div&gt;&lt;div&gt;6.2. if you didn&#39;t select &quot;Reset database&quot; during IPS installation, and reuse your IPS v4.2 DB, then InstallIPS.exe installer still won&#39;t register the IPS v4.3 license kehy&lt;/div&gt;&lt;div&gt;7. SAP Support actually recommends fresh IPS and BODS installation instead of in-place upgrade. Any in-place upgrade issues will get their recommendation to perform fresh IPS &amp;amp; BODS installation&lt;/div&gt;&lt;div&gt;8. IPS v4.3 license key should be entered in CMC &amp;gt; License Key screen immediately after IPS v4.3 installation.&amp;nbsp; Some people proceeds with SAP BODS v4.3 installation without entering IPS v4.3 key, and causes IPS 4.3 and BODS 4.3 to be broken&lt;/div&gt;&lt;div&gt;9. After BODS v4.3 is broken, entering IPS v4.3 license key will not automatically fix it.&amp;nbsp; It only allows IPS daemons to be able to start&lt;/div&gt;&lt;div&gt;10. SAP BODS v4.2 and v4.3&#39;s ATL file is not compatible, but SAP DS Designer v4.2 will allow to import v4.3 ATL file.&amp;nbsp; For Designer v4.3, it will display a warning of incompatibility, but allows user to proceed to import atl&lt;/div&gt;&lt;div&gt;11.. SAP Data Services v4.2 will get a false login failed message when trying to login to BODS v4.3, which often confuse admin and developer that the credential is wrong, or there is a network issue&lt;/div&gt;&lt;div&gt;12. If developers are doing development in BODS v4.2 and v4.3, then it is a length process to clone BODS v4.2 repo to another DB, runs repoman (Linux) to upgrade it, and finally register into CMC v4.3.&amp;nbsp; This has to repeat many times until all developers moved to v4.3&lt;/div&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Manually Getting IPS v4.3 License Key&lt;/h2&gt;&lt;div&gt;1. InstallIPS.exe or InstallIPS contains the IPS v4.3 license key even you can&#39;t open the executable file&lt;/div&gt;&lt;div&gt;2. Uses Linux to remove all binary data: strings InstallIPS.exe &amp;gt; /tmp/installips_key.txt&lt;/div&gt;&lt;div&gt;3. Uses Linux to display the IPS v4.3 license key: grep &quot;ProductKey&quot; /tmp/installips_key.txt&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Reminder:&lt;/div&gt;&lt;div&gt;1. If you IPS v4.2 is currently not healthy, upgrading to v4.3 won&#39;t automatic fix a broken IPS&lt;/div&gt;&lt;div&gt;2. If you installed SAP BODS v4.3 over IPS v4.3 without license key, entering IPS v4.3 license key later might not make BODS fully functional.&amp;nbsp; This is version specific, so I can&#39;t tell for all the IPS and BODS patches&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Recommendation for Upgrade&lt;/h1&gt;&lt;div&gt;Performs fresh IPS and BODS v4.3 installation instead of in-place upgrade.&amp;nbsp; Takes the opportunity to upgrade your Windows OS, or RHEL OS, MS SQL Server, Oracle, DB drivers.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Recommended procedure:&lt;/div&gt;&lt;div&gt;1. Backup your both IPS v4.2 and BODS v4.2 repositories&lt;/div&gt;&lt;div&gt;2. Creates a new empty BODS repositories to be used for v4.3&lt;/div&gt;&lt;div&gt;3. You can reuse IPS v4.2 repositories, but BODS v4.2 repositories can be re-use (manually register into SAP CMC &amp;gt; Data Services)&lt;/div&gt;&lt;div&gt;4. Perform fresh IPS v4.3 installation using either old or new IPS DB&lt;/div&gt;&lt;div&gt;5. If you are re-using IPS v4.2 DB, then enable checklist &quot;Reset database&quot; in the installer wizard&lt;/div&gt;&lt;div&gt;6. After installation (~ 1 hr), login to CMC, and ensures License Key screen show the license is valid&lt;/div&gt;&lt;div&gt;7. Proceeds with SAP BODS v4.3 installation, but uses the newly created BODS repository DB&lt;/div&gt;&lt;div&gt;8. After SAP BODS v4.3 installation completed, checks in CMC &amp;gt; Data Services to ensure you are seeing 1 repository&lt;/div&gt;&lt;div&gt;9. Run &quot;Repository Manager&quot; (Windows) or repoman (Linux) and choose &quot;Upgrade&quot; option to upgrade each of the BODS v4.2 repositories.&amp;nbsp; You need to do this multiple round, as you can only specify 1 DB to upgrade its table content v4.2 -&amp;gt; v4.3&lt;/div&gt;&lt;div&gt;10. Login to CMC v4.3 to register each of the BODS v4.2 (upgraded to v4.3 now).&amp;nbsp; You should not get version conflict&lt;/div&gt;&lt;div&gt;11. Run Server Manager (Windows) or svrcfg (Linux), and register each of the BODS repositories you added to CMC just now&lt;/div&gt;&lt;div&gt;12. Login to SAP DSMC, and generate new password files&lt;/div&gt;&lt;div&gt;13. In SAP DSMC, create new schedules&lt;/div&gt;&lt;div&gt;14. In SAP DSMC (Linux only), create Excel adapter, if you leverage xls file operations in Dataflow&lt;/div&gt;&lt;div&gt;15. In SAP CMC, configures user/group permission, such as allow user to retrieve BODS repositories credential (DS Designer won&#39;t show add&#39;l prompt to ask for BODS repository password)&lt;/div&gt;&lt;div&gt;&amp;nbsp;16. For Windows, if you want to start the Windows service with specific account (service account), then configures Windows Services startup properties&lt;/div&gt;&lt;div&gt;17. If you enable SSL, then repeat the SSL configuration for DB, IPS, Tomcat, BODS, DS Designer&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/3323531441402725687/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/3323531441402725687' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/3323531441402725687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/3323531441402725687'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2024/11/sap-ips-v43-upgrade-from-ipv-v42.html' title='SAP IPS v4.3 - Upgrade from IPV v4.2'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-6296016856960998129</id><published>2024-09-22T14:21:00.006-04:00</published><updated>2024-09-22T14:21:56.149-04:00</updated><title type='text'>Windows: Installer/Uninstaller error code 2203 when trying to install iTunes</title><content type='html'>&lt;p&gt;Product: Windows&lt;br /&gt;Version: 10&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Overview&lt;/h1&gt;&lt;p&gt;When trying to uninstall many software in Windows 10, the uninstallation failed with following error&lt;/p&gt;&lt;p&gt;&quot;The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2203.&quot;&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Procedure&lt;/h2&gt;&lt;p&gt;1. Get more detail error message from Event Viewer&lt;/p&gt;&lt;p&gt;1.1. Press Windows key, and type &quot;Event Viewer&quot; to run &quot;Event Viewer&quot;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgQ-XHlE1vlImYgPChI_3ZNGp8xD3gezRRhP3vf6F9973sXIOERBTk7fN6Lr07Fg5bM_feDPYyZcPptgzVpl6wi2z03bm1b0UTZd4FYZgEkgGtUhqH4kUMpEdik3w6stLxPgWMHhgT_Q4s8ETkgS85rIOg3NJa7G_hvPsD_lHB-xKrCbNCaXp1mBhrFauUF&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;185&quot; data-original-width=&quot;336&quot; height=&quot;176&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgQ-XHlE1vlImYgPChI_3ZNGp8xD3gezRRhP3vf6F9973sXIOERBTk7fN6Lr07Fg5bM_feDPYyZcPptgzVpl6wi2z03bm1b0UTZd4FYZgEkgGtUhqH4kUMpEdik3w6stLxPgWMHhgT_Q4s8ETkgS85rIOg3NJa7G_hvPsD_lHB-xKrCbNCaXp1mBhrFauUF&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;1.2. On left panel, navigates to Windows Logs &amp;gt; Application&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhCjPUO06ksCmXM2tlI0f4f_yu_R15AnJyiW9jiM_jEFaBlgj6sh2loHKKX4-Tj5XIkQq4mJZx_5anIAM7kRxnu6_0jeVQmbUFU7UrfUdcgTk2AmAFsE6Ax-lRyeAKu8hceuXl7t6D8SAdiQ-6zSdk5V5YDaue4oov7pRxhSNka1HO3-PUmVhLhPHD1zk4z&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;243&quot; data-original-width=&quot;735&quot; height=&quot;106&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhCjPUO06ksCmXM2tlI0f4f_yu_R15AnJyiW9jiM_jEFaBlgj6sh2loHKKX4-Tj5XIkQq4mJZx_5anIAM7kRxnu6_0jeVQmbUFU7UrfUdcgTk2AmAFsE6Ax-lRyeAKu8hceuXl7t6D8SAdiQ-6zSdk5V5YDaue4oov7pRxhSNka1HO3-PUmVhLhPHD1zk4z&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;1.3. Checks right panel, and focus in Source = MSInstaller&lt;/p&gt;&lt;p&gt;1.4. In lower right panel, check under General tab for msiexecdetail message.&amp;nbsp; In this example, iTunes failed during uninstallation with error code 2203&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhqEwM2b_NCHhnZC_iTP85W8vXhe6FtaA-uBQQO_eikeR-WtNZ5KVN_YCcVES07A4YIHQpVXLQNP5JkJu_R8zchUUi9eIiHfRIzHYoiWZf9NddkQt082DoiDqGqZcmMqC9Ghm_MII_DK6ZW04u0qLXXufOmdep7iwbmNHd6sKJf1k8N9Dt3NROt2EFrPyi_&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;599&quot; data-original-width=&quot;681&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhqEwM2b_NCHhnZC_iTP85W8vXhe6FtaA-uBQQO_eikeR-WtNZ5KVN_YCcVES07A4YIHQpVXLQNP5JkJu_R8zchUUi9eIiHfRIzHYoiWZf9NddkQt082DoiDqGqZcmMqC9Ghm_MII_DK6ZW04u0qLXXufOmdep7iwbmNHd6sKJf1k8N9Dt3NROt2EFrPyi_&quot; width=&quot;273&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;1.5. Following is displayed in General tab:&lt;p&gt;&lt;/p&gt;&lt;p&gt;Product: iTunes -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is &lt;b&gt;2203&lt;/b&gt;. The arguments are: C:\windows\Installer\&lt;b&gt;inprogressinstallinfo.ipi&lt;/b&gt;, -2147286788,&amp;nbsp;&lt;/p&gt;&lt;p&gt;1.6. Clicks on Details tab to see more detail, which will contain the product ID that we need for iTune software&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiK6aVps3h0Fl7F1JIdm1Nl4Q7d_eYy4iq902r770PCzT8VMwLvvTqt9C0Hda0V5fDhXA4MRyWdOheUYiqChTBPG8-aYSt9iLpVzT8d-te7oy-e4l28QCIevPWtFokgRZdXSHC0LInK1ZGC-eQP51YyZDnPDmoaABvWdTwXvE4ZX5z50nHcc4LuDfBa-8dz&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;533&quot; data-original-width=&quot;464&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiK6aVps3h0Fl7F1JIdm1Nl4Q7d_eYy4iq902r770PCzT8VMwLvvTqt9C0Hda0V5fDhXA4MRyWdOheUYiqChTBPG8-aYSt9iLpVzT8d-te7oy-e4l28QCIevPWtFokgRZdXSHC0LInK1ZGC-eQP51YyZDnPDmoaABvWdTwXvE4ZX5z50nHcc4LuDfBa-8dz&quot; width=&quot;209&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;1.7. Scrolls down to section &quot;In Bytes&quot; and take note of the hex code, which is iTune product ID.&amp;nbsp; In this screenshot, the Product ID is&amp;nbsp;{E42D1B4D-78C2-4144-8E4D-FA82C53B68A4}&lt;p&gt;&lt;/p&gt;&lt;p&gt;2. Explanation of above error:&lt;/p&gt;&lt;p&gt;2.1. The MS Windows installer/uninstall called program&amp;nbsp;msiexec.exe at the background with product ID&amp;nbsp;{E42D1B4D-78C2-4144-8E4D-FA82C53B68A4}&lt;/p&gt;&lt;p&gt;2.2. The actual command executed was &quot;msiexec.exe&amp;nbsp; /uninstall {E42D1B4D-78C2-4144-8E4D-FA82C53B68A4}&quot;&lt;/p&gt;&lt;p&gt;2.3.&amp;nbsp;msiexec.exe will write temporary files to %LOCALAPPDATA%\temp\ of current login user, e.g. administrator&lt;/p&gt;&lt;p&gt;2.3.1. If current login user cannot create any files in directory&amp;nbsp;%LOCALAPPDATA%\temp, then the installer will failed with this error.&amp;nbsp; So, test create a dummy file or directory in&amp;nbsp;%LOCALAPPDATA%\temp\ using &quot;cmd&quot; prompt&lt;/p&gt;&lt;p&gt;2.4. msiexec.exe will write temporary files to %TEMP% as system user.&amp;nbsp; The value will be from system environment variable, under section &quot;System variables&quot;&lt;/p&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj-mSYcJ4KsDxRPmOaiBblIjT4x2nxpNRZegHAu93Bigw6BFW963ckLYNyOPTRNRflP01ZRJx-CqxD4qVGq2xcQuIJ7mJetpiXgBx74swT0xMjbdkvbVMSOQ0RTRtthteXlZRsmEaCD6W0A45hlBT3EAB-8gC-ofndmMdZsD-ePhT4T3F9-f37eCe6GkptO&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;194&quot; data-original-width=&quot;340&quot; height=&quot;183&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj-mSYcJ4KsDxRPmOaiBblIjT4x2nxpNRZegHAu93Bigw6BFW963ckLYNyOPTRNRflP01ZRJx-CqxD4qVGq2xcQuIJ7mJetpiXgBx74swT0xMjbdkvbVMSOQ0RTRtthteXlZRsmEaCD6W0A45hlBT3EAB-8gC-ofndmMdZsD-ePhT4T3F9-f37eCe6GkptO&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;2.4.1. Even you have TEMP variable defined under &quot;User variables,&quot; system user will only use TEMP value under &quot;System variables&quot;&lt;/div&gt;&lt;div&gt;2.4.2. You can monitor above TEMP directory while running uninstaller/installer to see whether it is creating any temporary file&lt;/div&gt;&lt;div&gt;2.4.3. You cannot run &quot;cmd&quot; as administrator, and type &quot;set&quot; command to display the value of TEMP, because that will still cause TEMP value inherits from current login user&lt;/div&gt;&lt;div&gt;2.4.4. Ensures that the permission for &quot;SYSTEM&quot; in folder properties has Full Control&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh8NecLlSWVELbEilKuRxKddqffPSl8bhTgQlGgX-V-Pj2QshEX5Q6qXvA2yNU30whB_W3VT8Zi-XCT2K1t2dhLbiR06uH4J8cwkDMyNeaKzWDXoBgcfIVbS11FPBv4Y-MYucOdA-Y_txDFABTykUq_rd2IdpvLSryZBdADlhB0qr9LMwATJyayIvHB0HVq&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;481&quot; data-original-width=&quot;363&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEh8NecLlSWVELbEilKuRxKddqffPSl8bhTgQlGgX-V-Pj2QshEX5Q6qXvA2yNU30whB_W3VT8Zi-XCT2K1t2dhLbiR06uH4J8cwkDMyNeaKzWDXoBgcfIVbS11FPBv4Y-MYucOdA-Y_txDFABTykUq_rd2IdpvLSryZBdADlhB0qr9LMwATJyayIvHB0HVq&quot; width=&quot;181&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;2.5. msiexec.exe will creates a temporary file in&amp;nbsp;C:\windows\Installer\inprogressinstallinfo.ipi&lt;/div&gt;&lt;div&gt;2.5.1. Monitor directory &quot;C:\windows\Installer\&quot; in real time during uninstallation.and ensures file inprogressinstallinfo.ipi get created&lt;/div&gt;&lt;div&gt;2.5.2. The file will get deleted when the uninstaller failed&lt;/div&gt;&lt;div&gt;2.5.3. You can try to create a text file in above directory to test you can create file using cmd (run as administrator) to ensure there is no permission issue.&amp;nbsp; If you do, ensures the SYSTEM user has Full Control permission&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2.6. You could find in Internet to suggest to disable Windows Virus Defender temporary.&amp;nbsp; This is assume the utility created temporary files which Windows Defender automatically deleted the temporary files by assuming it is a virus.&amp;nbsp; If you are working on common software, such as iTune, Acrobat, Notepad++, then you can ignore those suggestion, as it is not related&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3. Manually construct the uninstallation command yourself, and enable debug log&lt;/div&gt;&lt;div&gt;3.1. Run notepad.exe to prepare a command to run later which will create a debug log to show us more info&lt;/div&gt;&lt;div&gt;3.2. Type:&amp;nbsp;msiexec.exe&amp;nbsp; /uninstall {product ID} /l*v &amp;lt;log file location&amp;gt;&lt;/div&gt;&lt;div&gt;3.3. For my iTune, the product ID that we found in Event Viewer is E42D1B4D-78C2-4144-8E4D-FA82C53B68A4}&lt;/div&gt;&lt;div&gt;3.4. I would like to create the new log file in&amp;nbsp;i:\temp\itune_uninstall.txt&lt;/div&gt;&lt;div&gt;3.5. So the final command is:&amp;nbsp;C:\windows\system32\msiexec.exe&amp;nbsp; /uninstall {E42D1B4D-78C2-4144-8E4D-FA82C53B68A4} /l*v i:\temp\itune_uninstall.txt&lt;/div&gt;&lt;div&gt;3.6. Run cmd.exe as administrator&lt;/div&gt;&lt;div&gt;3.7. Copy-paste the final msiexec.exe command in cmd to start uninstaller for iTune, and create debug log in log file i:\temp\itune_uninstall.txt&lt;/div&gt;&lt;div&gt;3.8. Let the uninstallation failed with error 2203&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;4. Gets the detail error message for error 2203&lt;/div&gt;&lt;div&gt;4.1. Open debug log created in above step&lt;/div&gt;&lt;div&gt;4.2. In this example, it is&amp;nbsp;i:\temp\itune_uninstall.txt&lt;/div&gt;&lt;div&gt;4.3. Open the log file in Notepad, or Notepad++&lt;/div&gt;&lt;div&gt;4.4. Search for &quot;DEBUG: Error&quot;&lt;/div&gt;&lt;div&gt;4.5. In this iTune example, the error is below&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;MSI (s) (68:78) [10:15:46:439]: BeginTransaction: Locking Server&lt;/div&gt;&lt;div&gt;MSI (s) (68:78) [10:15:46:440]: Note: 1: 2203 2: C:\windows\Installer\inprogressinstallinfo.ipi 3: -2147287038&amp;nbsp;&lt;/div&gt;&lt;div&gt;MSI (s) (68:78) [10:15:46:440]: Note: 1: 2203 2: C:\windows\Installer\inprogressinstallinfo.ipi 3: -2147287038&amp;nbsp;&lt;/div&gt;&lt;div&gt;MSI (s) (68:78) [10:15:46:440]: Server not locked: locking for product {E42D1B4D-78C2-4144-8E4D-FA82C53B68A4}&lt;/div&gt;&lt;div&gt;MSI (s) (68:78) [10:15:46:441]: Note: 1: 2203 2: C:\windows\Installer\inprogressinstallinfo.ipi 3: -2147286788&amp;nbsp;&lt;/div&gt;&lt;div&gt;Action start 10:15:46: InstallInitialize.&lt;/div&gt;&lt;div&gt;DEBUG: Error 2203:&amp;nbsp; Database: C:\windows\Installer\inprogressinstallinfo.ipi. Cannot open database file. System error -2147286788&lt;/div&gt;&lt;div&gt;MSI (s) (68:78) [10:15:48:055]: Product: iTunes -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2203. The arguments are: C:\windows\Installer\inprogressinstallinfo.ipi, -2147286788,&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;MSI (c) (84:8C) [10:15:46:447]: Font created.&amp;nbsp; Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2203. The arguments are: C:\windows\Installer\inprogressinstallinfo.ipi, -2147286788,&amp;nbsp;&lt;/div&gt;&lt;div&gt;Action ended 10:15:48: InstallInitialize. Return value 3.&lt;/div&gt;&lt;div&gt;Action ended 10:15:48: INSTALL. Return value 3.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;4.6. This error message is longer that the one you see in Event Viewer, or Control Panel &amp;gt; Uninstall software&lt;/div&gt;&lt;div&gt;4.7. The line to focus on will be below:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;DEBUG: Error 2203:&amp;nbsp; Database: C:\windows\Installer\inprogressinstallinfo.ipi. Cannot open database file. System error -2147286788&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;4.8. If you review other log entries, you will see no entry is referring to TEMP dir, which in my case, it is &quot;I:\TEMP\Windows&quot;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;5. This post does not cover Windows 10 system files minor corruption&lt;/div&gt;&lt;div&gt;6. If your Windows 10 has minor corruption, then fix them using following steps:&lt;/div&gt;&lt;div&gt;6.1. Run cmd as administrator&lt;/div&gt;&lt;div&gt;6.2. Run: DISM.exe /Online /Cleanup-image /Scanhealth&lt;/div&gt;&lt;div&gt;6.3. Run: DISM.exe /Online /Cleanup-image /Restorehealth&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;7. A quick workaround will be to change System environment variables below:&lt;/div&gt;&lt;div&gt;7.1. TEMP=C:\temp&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;8. If you are stuck, repeat the installer/uninstaller while monitor following dir to ensure it has the permission.&amp;nbsp; Don&#39;t simply follows many suggestions in Internet to modify directories permission, if you see it is able to create temporary files&lt;/div&gt;&lt;div&gt;8.1. %LOCALAPPDATA%\temp - this is the value of users environment variable&lt;/div&gt;&lt;div&gt;8.2. %temp% - this is the value of the global environment variable, not users environment variable&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/6296016856960998129/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/6296016856960998129' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/6296016856960998129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/6296016856960998129'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2024/09/windows-installeruninstaller-error-code.html' title='Windows: Installer/Uninstaller error code 2203 when trying to install iTunes'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEgQ-XHlE1vlImYgPChI_3ZNGp8xD3gezRRhP3vf6F9973sXIOERBTk7fN6Lr07Fg5bM_feDPYyZcPptgzVpl6wi2z03bm1b0UTZd4FYZgEkgGtUhqH4kUMpEdik3w6stLxPgWMHhgT_Q4s8ETkgS85rIOg3NJa7G_hvPsD_lHB-xKrCbNCaXp1mBhrFauUF=s72-c" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-3076434918019758660</id><published>2024-09-12T12:36:00.001-04:00</published><updated>2024-09-12T12:36:21.846-04:00</updated><title type='text'>Oracle RDBMS: Manual Archive Log Clean Up with FAST_RECOVERY_AREA</title><content type='html'>&lt;p&gt;Product: Oracle RDBMS&lt;/p&gt;&lt;p&gt;Version: 11.1.0 - 21c (19.3.x)&lt;/p&gt;&lt;p&gt;OS: Windows, Linux, HP-UX, AIX&lt;/p&gt;&lt;p&gt;The introduction of FAST_RECOVERY_AREA has been more than 10 years, which automatically housekeep archive logs.&amp;nbsp; This allow DBA to indirectly delete physical archive log files resides in the OS, even they do not have physical OS access.&lt;/p&gt;&lt;p&gt;However, for those DBA or SA who have access to the OS, or managed the storage and DB, it is often required to cleanup archive log files in OS first, then in Oracle&#39;s&amp;nbsp;FAST_RECOVERY_AREA later.&lt;/p&gt;&lt;p&gt;This post show how to perform the manual clean up of it&lt;/p&gt;&lt;p&gt;1. Verify the usage of&amp;nbsp;FAST_RECOVERY_AREA to get a breakdown what used up all the storage&lt;/p&gt;&lt;p&gt;col file_type format a40&lt;br /&gt;set pagesize 50&lt;br /&gt;set line 110&lt;/p&gt;&lt;p&gt;select * from v$recovery_area_usage;&lt;/p&gt;&lt;p&gt;2. For the purpose of this post, this is covering scenario where FILE_TYPE=ARCHIVED LOG.&amp;nbsp; So the SQL will be&lt;/p&gt;&lt;p&gt;select * from v$recovery_area_usage where FILE_TYPE=&#39;ARCHIVED LOG&#39;;&lt;/p&gt;&lt;p&gt;3. If archive log have not backup, and you want to backup the archive log to disk, then use following RMAN command to backup to disk, and delete from the disk&lt;/p&gt;&lt;p&gt;RMAN target /&lt;/p&gt;&lt;p&gt;backup archivelog all delete input;&lt;/p&gt;&lt;p&gt;4. If archive log already been deleted, then you need to sync up the status with Oracle DB.&amp;nbsp; Uses this RMAN command to sync up the status of all the archive log files&lt;/p&gt;&lt;p&gt;RMAN target /&lt;/p&gt;&lt;p&gt;crosscheck archivelog all;&lt;/p&gt;&lt;p&gt;5. After FAST_RECOVERY_AREA detected the archive log files are deleted, then you can run RMAN command to delete it from FAST_RECOVERY_AREA&#39;s internal table,&amp;nbsp; This does not delete archive log which present (no deleted) in&amp;nbsp;FAST_RECOVERY_AREA&lt;/p&gt;&lt;p&gt;RMAN target /&lt;/p&gt;&lt;p&gt;delete noprompt expired archivelog all;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/3076434918019758660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/3076434918019758660' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/3076434918019758660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/3076434918019758660'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2024/09/oracle-rdbms-manual-archive-log-clean.html' title='Oracle RDBMS: Manual Archive Log Clean Up with FAST_RECOVERY_AREA'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-7339777828120426327</id><published>2024-07-14T11:07:00.010-04:00</published><updated>2024-07-15T12:48:57.402-04:00</updated><title type='text'>Fresh Tomato Custom Router Firmware: Blocks Incoming Hacker IP</title><content type='html'>Product: Fresh Tomato Custom Router Firmware&lt;div&gt;Version:&amp;nbsp;Firmware 2024.2 K26MIPSR2_RTAC USB AIO-64K&lt;/div&gt;&lt;div&gt;Router Model: ASUS RT-AC66U&lt;/div&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Overview&lt;/h2&gt;&lt;div&gt;Testing out custom firmware in ASUS router above using build-in NGINX web server on custom http port.&amp;nbsp; Trying to figure out how this custom firmware can blocks incoming hacker by their IP.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Web server log is able to log visitors&#39; IP, and the URL request URI.&amp;nbsp; So I can figure out the attackers&#39; IP, which I considered as hacker.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This gives me an idea how aggressive hacker community and search engine will send valid and invalid attacks to a random web site.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I am leveraging build-in software firewall which configures using command iptables, configuration file /etc/iptables, web GUI called &quot;Access Restriction&quot; that stores in NVRAM (access using command &quot;nvram get rrule0&quot; and &quot;nvram set rrule0&quot;).&amp;nbsp; Research of iptables chains and rules found that the menu &quot;Access Restriction&quot; is only restrict WAN to LAN, and doesn&#39;t restrict build-in NGINX web server, which is not consider in the LAN subnet.&amp;nbsp; So this post document how to configure it to leverage &quot;Access Restriction.&quot;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Initially, I uses following methods to configures the software firewall to block hackers&#39; IP, but it is not persistent:&lt;/div&gt;&lt;div&gt;1. /etc/iptables configuration file, with scheduler&lt;/div&gt;&lt;div&gt;2. Using iptables command, with scheduler&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Every few hours, Fresh Tomato seems to replace the above 2 files and configuration with the value in web GUI, which later found the setting is stored in NVRAM.&amp;nbsp; So I lost all my firewall setting, and hacker can attack my NGINX web server again.&amp;nbsp; It took me few days to figure out the web GUI menu called &quot;Access Restriction&quot; will configures iptables, and its setting is permanently stores in NVRAM in addition of above 2 files/configuration, even after reboot or power cycle.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Google search is not returning any info about blocking hacking using Fresh Tomato on build-in NGINX web server, but finally I found following Fresh Tomato documentation that gives me a clue how to configure NVRAM (so that I can blocked hacker by using NGINX access.log file):&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;https://wiki.freshtomato.org/doku.php/access_restrictions&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;Web GUI&#39;s &quot;Access Restriction&quot; configuration resides in NVRAM, and needs to set using &quot;nvram set [internal rule name]&quot; command.&amp;nbsp; Its current configuration can be retrieve using command &quot;nvram get [internal rule name]&quot; command.&amp;nbsp; The internal rule name starts with rrule0, follows by rrule1, rrule2, and each can be enabled and disabled separately.&amp;nbsp; Moreover, you can set the time start/end for every day, and the router will automatically trigger iptables command by the schedule.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In this post, I will assume there is no rule set, so I will use rrule0.&amp;nbsp; This indirectly will create iptables chain name &quot;rdev00.&quot;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Every time the &quot;Access Restriction&quot; configuration is changed, it will reload the configurations from NVRAM, as well as certain network related configurations in the router.&amp;nbsp; I need to adds custom iptables command into &quot;Scripts&quot; section called &quot;Firewall&quot; as well to modify OOTB iptables chain to apply &quot;Access Restriction&quot; configuration in addition of LAN traffic.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Procedure&lt;/h2&gt;&lt;div&gt;1. Creates rule #1 with:&lt;/div&gt;&lt;div&gt;1.1. Rule name: Blocks Hacker 2024-07&lt;/div&gt;&lt;div&gt;1.2. Blocks IP:&amp;nbsp;103.246.195.85,&amp;nbsp;5.183.103.248,&amp;nbsp;118.123.105.93&lt;/div&gt;&lt;div&gt;2. Connects to the LAN port using cable, or WiFi&lt;/div&gt;&lt;div&gt;3. Assumes WiFi router&#39;s IP is 192.168.100.1, then uses ssh utility such as PuTTY to ssh to port 192.168.100.1&lt;/div&gt;&lt;div&gt;4. Login as root user&lt;/div&gt;&lt;div&gt;5. At the &quot;#&quot; shell prompt, creates a new rule 1 with internal rule name rrule0&lt;/div&gt;&lt;div&gt;5.1. &lt;b&gt;nvram set rrule0=&quot;1|-1|-1|127|104.37.174.65&amp;gt;117.146.152.81&amp;gt;118.123.105.93|||0|Blocks Hacker 2024-07&quot;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;5.2. Expect output:&lt;/div&gt;&lt;div&gt;&lt;div&gt;root@rt-ac66u:~# &lt;b&gt;nvram set &lt;/b&gt;rrule0=&quot;1|-1|-1|127|104.37.174.65&amp;gt;117.146.152.81&amp;gt;118.123.105.93|||0|Blocks Hacker 2024-07&quot;&lt;/div&gt;&lt;div&gt;root@rt-ac66u:~#&lt;/div&gt;&lt;/div&gt;&lt;div&gt;6. Login to WiFi routner&#39;s web GUI to check. URL: http://192.168.100.1&lt;/div&gt;&lt;div&gt;7. On left menu, lick on menu item &quot;Access Restriction&quot; to display all the rules&lt;/div&gt;&lt;div&gt;8. You will see the first rule call &quot;Blocks Hacker 2024-07&quot; on the right panel, and as the 1st rule in the list&lt;/div&gt;&lt;div&gt;9. Following is the expected output&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEi8UL_DFaqyPO0ZYx-18dIGDkPadIe7ayIyjyB1osX9bnCziIiUObqzeg22h2ThqtDAQ0s4xHGC-0QXgVb8cpWJT82tY1wHkzI1kmXBaGVrStIqetx5-36CcpuWnS2o7b2VZIltbmwV952yU11dqlSVszNKQlMHxkcLFBhXxA9Era2H5IYeX2tCrvqJepH2&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;600&quot; data-original-width=&quot;533&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEi8UL_DFaqyPO0ZYx-18dIGDkPadIe7ayIyjyB1osX9bnCziIiUObqzeg22h2ThqtDAQ0s4xHGC-0QXgVb8cpWJT82tY1wHkzI1kmXBaGVrStIqetx5-36CcpuWnS2o7b2VZIltbmwV952yU11dqlSVszNKQlMHxkcLFBhXxA9Era2H5IYeX2tCrvqJepH2=s16000&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;10. The current &quot;Access Restriction&quot; are:&lt;/div&gt;&lt;div&gt;10.1. Only in configuration of NVRAM, but not saved yet&lt;/div&gt;&lt;div&gt;10.2. Current setting will lost after reboot, or power lost&lt;/div&gt;&lt;div&gt;10.3. Router has not run iptables to activate the setting.&amp;nbsp; There is delay of about 1 hr&lt;/div&gt;&lt;div&gt;11. To make this setting permanent after reboot, enter: # &lt;b&gt;nvram commit&lt;/b&gt;&lt;/div&gt;&lt;div&gt;12. Waits for about 1 hr, and checks firewall to see the IP are blacklisted.&amp;nbsp; Command: &lt;b&gt;iptables -L rdev00 -n&lt;/b&gt;&lt;/div&gt;&lt;div&gt;13. Expected output:&lt;/div&gt;&lt;div&gt;&lt;div&gt;Chain rdev00 (1 references)&lt;/div&gt;&lt;div&gt;target&amp;nbsp; &amp;nbsp; &amp;nbsp;prot opt source&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;destination&lt;/div&gt;&lt;div&gt;DROP&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;all&amp;nbsp; --&amp;nbsp; 104.37.174.65&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.0.0.0/0&lt;/div&gt;&lt;div&gt;DROP&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;all&amp;nbsp; --&amp;nbsp; 117.146.152.81&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.0.0.0/0&lt;/div&gt;&lt;div&gt;DROP&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;all&amp;nbsp; --&amp;nbsp; 118.123.105.93&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.0.0.0/0&lt;/div&gt;&lt;/div&gt;&lt;div&gt;14. If you want to force the setting to activate immediately, runs these 2 commands:&lt;/div&gt;&lt;div&gt;#&amp;nbsp;&lt;b&gt;nvram set action_service=restrict-restart&lt;/b&gt;&lt;br /&gt;# &lt;b&gt;kill -USR1 1&lt;/b&gt;&lt;/div&gt;&lt;div&gt;15. You will see following in /var/log/messages:&lt;/div&gt;&lt;div&gt;# tail /var/log/messages | grep &quot;Activating rule&quot;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Jul 14 11:23:31 rt-ac66u user.info rcheck[1867]: Activating rule 0&lt;/div&gt;&lt;/div&gt;&lt;div&gt;16. Lastly, modify iptables firewall&#39;s INPUT chain to make web server port from the web GUI&lt;/div&gt;&lt;div&gt;16.1. In router&#39;s web GUI, on left panel, navigates to Administration &amp;gt; Scripts&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiy7WMmzIH6Xl1DSJ3Ifbmc4EpfWC730IcuFaa4ageeG7QrEOYIgJc4jKegkqzbGD7gI0C7v98nMypfJzdReCjSgcpmUmkQI7O2q0idl0fzo1qm94TlSYex8ENRXesQVZbd_-MT-14KbGoSy75nnEAqtuSxRTGbwYkASOBeL1wxEgILUZiz3P2Nyslnowju&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;353&quot; data-original-width=&quot;188&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEiy7WMmzIH6Xl1DSJ3Ifbmc4EpfWC730IcuFaa4ageeG7QrEOYIgJc4jKegkqzbGD7gI0C7v98nMypfJzdReCjSgcpmUmkQI7O2q0idl0fzo1qm94TlSYex8ENRXesQVZbd_-MT-14KbGoSy75nnEAqtuSxRTGbwYkASOBeL1wxEgILUZiz3P2Nyslnowju&quot; width=&quot;128&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;16.2. Click on tab Firewall&lt;/div&gt;&lt;div&gt;16.3. Enter following command to create a new custom chained called &quot;hacker&quot; and replaces exiting rule for NGINX TCP port 85 to this custom chain:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;logger &quot;webUI-Scripts-Firewall Configures NGINX to follow Access Restriction&quot;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;iptables -N hacker&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;iptables -A hacker -j restrict&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;iptables -A hacker -j logaccept ||&amp;nbsp;&lt;/b&gt;&lt;b&gt;iptables -A hacker -j ACCEPT&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;iptables -R INPUT 15 -p tcp -m tcp --dport 85 -j hacker&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;16.4. Sample screenshot&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgNBraZOpUMBgvuJBsex-n7prTK3XTz4ZYWm41fFc2RfP8zwt2CPxKfc3Xd-NH4_GcZTTJBKPQ5sAOaWv6p0DqxMNZGVMDEtcfpazyAmDxndaQtkVsOYqQrOee38j1SQLSHvIt4EvzS9BSURpCCiSfkn1RWtiN-quBG6FFH18dgVW52kL72GUNMaNboXGyg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;217&quot; data-original-width=&quot;849&quot; height=&quot;165&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEgNBraZOpUMBgvuJBsex-n7prTK3XTz4ZYWm41fFc2RfP8zwt2CPxKfc3Xd-NH4_GcZTTJBKPQ5sAOaWv6p0DqxMNZGVMDEtcfpazyAmDxndaQtkVsOYqQrOee38j1SQLSHvIt4EvzS9BSURpCCiSfkn1RWtiN-quBG6FFH18dgVW52kL72GUNMaNboXGyg=w640-h165&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Maintenance&lt;/h2&gt;&lt;div&gt;You might to perform other maintenance of the firewall.&lt;/div&gt;&lt;div&gt;1. Removes/delete the rule, e.g. removes rule 10:&amp;nbsp;&lt;b&gt;nvram unset rrule10&lt;/b&gt;&lt;/div&gt;&lt;div&gt;2. Delete firewall rule 10 (rdev09):&lt;/div&gt;&lt;div&gt;2.1.&amp;nbsp;&lt;b&gt;iptables -D restrict -j rdev09&lt;/b&gt;&lt;/div&gt;&lt;div&gt;2.2 .&lt;b&gt;iptables --flush&amp;nbsp;rdev09&lt;/b&gt;&lt;/div&gt;&lt;div&gt;2.3.&amp;nbsp;&lt;b&gt;iptables -X rdev09&lt;/b&gt;&lt;/div&gt;&lt;div&gt;3. Checks current actively blocked IP for rule 1 (chain name rdev00) in memory: &lt;b&gt;iptables -L rdev00 -n&lt;/b&gt;&lt;/div&gt;&lt;div&gt;4. Checks current block IP for rule 1 in /etc/iptables configuration file:&amp;nbsp;&lt;b&gt;grep rdev00 /etc/iptables&lt;/b&gt;&lt;/div&gt;&lt;div&gt;5. Forces Access Restriction to activate now:&lt;/div&gt;&lt;div&gt;5.1. Command #1:&amp;nbsp;&lt;b&gt;nvram set action_service=restrict-restart&lt;/b&gt;&lt;/div&gt;5.2. Command #2:&amp;nbsp;&lt;b&gt;kill -USR1 1&lt;/b&gt;&amp;nbsp;(after above completed)&lt;div&gt;5.3. Command #3:&amp;nbsp;nvram get action_service (if completed, command will not return any value. If not completed, then returns &quot;restricgt-restart&quot;)&lt;/div&gt;&lt;div&gt;6. Uses &quot;top&quot; Linux command to monitor the CPU usage with the new firewall rule. You will need to reduces number of blocked IP, if encountered CPU contention, or buy a faster/newer WiFi router&lt;/div&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Known Limitation&lt;/h2&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;strike&gt;Web GUI&#39;s menu Administration &amp;gt; Logging &amp;gt; Syslog &amp;gt; Connection Logging to control following won&#39;t always going to capture above traffic:&lt;/strike&gt;&lt;/li&gt;&lt;ol&gt;&lt;li&gt;&lt;strike&gt;Inbound: If blocked by Firewall&lt;/strike&gt;&lt;/li&gt;&lt;li&gt;&lt;strike&gt;Outbound: If blocked by Firewall&lt;/strike&gt;&lt;/li&gt;&lt;li&gt;&lt;strike&gt;Reason: above logic/commands need to modify to use iptables chain &quot;logaccept&quot; and &quot;logdrop&quot; which will make it longer to write&lt;/strike&gt; (updated to allows logging to syslog /var/log/messages)&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;iptables firewall configuration is based on my configuration of Fresh Tomato on ASUS RT-AC66U, version&amp;nbsp;2024.2.&amp;nbsp; It might needs further modification&lt;/li&gt;&lt;li&gt;When number of blocked IP is getting long (more than 100), the web GUI&#39;s menu &quot;Access Restriction&quot; won&#39;t be able to delete or modify rule #1, and will consistently prompt to delete IPs (then it will work)&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Fresh Tomato firmware seems to enforce a restriction to limit the number of entries inside the rule&lt;/li&gt;&lt;li&gt;This error can be ignore, and doesn&#39;t affect the IP blocking&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/7339777828120426327/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/7339777828120426327' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/7339777828120426327'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/7339777828120426327'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2024/07/fresh-tomato-custom-router-firmware.html' title='Fresh Tomato Custom Router Firmware: Blocks Incoming Hacker IP'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEi8UL_DFaqyPO0ZYx-18dIGDkPadIe7ayIyjyB1osX9bnCziIiUObqzeg22h2ThqtDAQ0s4xHGC-0QXgVb8cpWJT82tY1wHkzI1kmXBaGVrStIqetx5-36CcpuWnS2o7b2VZIltbmwV952yU11dqlSVszNKQlMHxkcLFBhXxA9Era2H5IYeX2tCrvqJepH2=s72-c" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-3876311707539417891</id><published>2024-06-28T09:40:00.002-04:00</published><updated>2024-06-28T09:40:18.311-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="FreshTomato"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><title type='text'>Linux: How to get Parent Process (PPID)?</title><content type='html'>&lt;p&gt;Product: Linux&lt;br /&gt;Version: All&lt;br /&gt;CPU: All&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Overview&lt;/h1&gt;&lt;div&gt;Many Linux forum and documentation often base on full Linux distribution, such as RedHat, Fedora, Ubuntu, SuSE, MacOS, and left out Linux installed in single box computer (SBC) such as WiFi router, smartphone, tablet, Raspberry Pi, Nano Pi, car&#39;s head unit, webcam, etc.&amp;nbsp; This leads to some standard UNIX design and operation slowly forgotten and replaces with newer commands.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;During day-to-day troubleshooting, sometimes in addition of process ID (PID), it is required to check parent process ID (PPID) as well.&amp;nbsp; For example, what spawn the process, does the parent process terminated, etc.&amp;nbsp;&lt;/div&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Procedure&lt;/h2&gt;&lt;div&gt;Most Linux installed in SBC has a reduced version of Linux, such as BusyBox which is ~ 600KB used in DD-WRT and FreshTomoto firmware used in WiFi router.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;These smaller footprint of Linux often bundled with &quot;ps&quot; command which can display limited info of a process PID.&amp;nbsp; For example, it does not display parent PID (PPID).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can use following command to get the PPID using /proc virtual directory.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;For example, assumes the PID is 2914:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;root@rt-ac66u:/tmp/home/root# ls -l /proc/2914/status&lt;/div&gt;&lt;div&gt;-r--r--r--&amp;nbsp; &amp;nbsp; 1 root&amp;nbsp; &amp;nbsp; &amp;nbsp;root&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 Jun 28 09:20 /proc/2914/status&lt;/div&gt;&lt;div&gt;root@rt-ac66u:/tmp/home/root# cat /proc/2914/status&lt;/div&gt;&lt;div&gt;Name:&amp;nbsp; &amp;nbsp;dropbear&lt;/div&gt;&lt;div&gt;State:&amp;nbsp; S (sleeping)&lt;/div&gt;&lt;div&gt;SleepAVG:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;95%&lt;/div&gt;&lt;div&gt;Tgid:&amp;nbsp; &amp;nbsp;2914&lt;/div&gt;&lt;div&gt;&lt;b&gt;Pid:&amp;nbsp; &amp;nbsp; 2914&lt;/b&gt;&lt;/div&gt;&lt;div&gt;PPid:&amp;nbsp; &amp;nbsp;1&lt;/div&gt;&lt;div&gt;TracerPid:&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/div&gt;&lt;div&gt;Uid:&amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/div&gt;&lt;div&gt;Gid:&amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/div&gt;&lt;div&gt;FDSize: 32&lt;/div&gt;&lt;div&gt;Groups:&lt;/div&gt;&lt;div&gt;VmPeak:&amp;nbsp; &amp;nbsp; &amp;nbsp;1156 kB&lt;/div&gt;&lt;div&gt;VmSize:&amp;nbsp; &amp;nbsp; &amp;nbsp;1156 kB&lt;/div&gt;&lt;div&gt;VmLck:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 kB&lt;/div&gt;&lt;div&gt;VmHWM:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;256 kB&lt;/div&gt;&lt;div&gt;VmRSS:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;256 kB&lt;/div&gt;&lt;div&gt;VmData:&amp;nbsp; &amp;nbsp; &amp;nbsp; 348 kB&lt;/div&gt;&lt;div&gt;VmStk:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 84 kB&lt;/div&gt;&lt;div&gt;VmExe:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;304 kB&lt;/div&gt;&lt;div&gt;VmLib:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;384 kB&lt;/div&gt;&lt;div&gt;VmPTE:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 12 kB&lt;/div&gt;&lt;div&gt;Threads:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/div&gt;&lt;div&gt;SigQ:&amp;nbsp; &amp;nbsp;0/2047&lt;/div&gt;&lt;div&gt;SigPnd: 00000000000000000000000000000000&lt;/div&gt;&lt;div&gt;ShdPnd: 00000000000000000000000000000000&lt;/div&gt;&lt;div&gt;SigBlk: 00000000000000000000000000000000&lt;/div&gt;&lt;div&gt;SigIgn: 00000000000000000000000000001000&lt;/div&gt;&lt;div&gt;SigCgt: 00000000000000000000000000024402&lt;/div&gt;&lt;div&gt;CapInh: 0000000000000000&lt;/div&gt;&lt;div&gt;CapPrm: 00000000fffffeff&lt;/div&gt;&lt;div&gt;CapEff: 00000000fffffeff&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;To display the PPID alone, then uses following command:&lt;/div&gt;&lt;div&gt;&lt;div&gt;root@rt-ac66u:/tmp/home/root# grep PPid /proc/2914/status&lt;/div&gt;&lt;div&gt;PPid:&amp;nbsp; &amp;nbsp;1&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Virtual directory /proc exists as very basic design of UNIX, so it always available in all UNIX, while &quot;ps&quot; command might has stripped off functionality.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Above example is captured from FreshTomato firmware in WiFi router&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/3876311707539417891/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/3876311707539417891' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/3876311707539417891'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/3876311707539417891'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2024/06/linux-how-to-get-parent-process-ppid.html' title='Linux: How to get Parent Process (PPID)?'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-5866260840952071593</id><published>2024-05-21T14:11:00.005-04:00</published><updated>2024-05-21T14:11:59.839-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="jdbc tuninh"/><category scheme="http://www.blogger.com/atom/ns#" term="sql tuning"/><title type='text'>Java SQL Programming - Tuning SELECT Statement Performance, JDBC Performance Tuning</title><content type='html'>&lt;p&gt;Product: Java Programming&lt;br /&gt;Version: 0.1 - current&lt;br /&gt;OS: Any operating system, Windows, Linux, UNIX, AIX, Solaris, HP-UX&lt;br /&gt;Related Product: Any programming language that uses SELECT in the world&lt;br /&gt;Java API, Java class, Java method:&amp;nbsp;java.sql.Statement,&amp;nbsp;java.sql.PreparedStatement&lt;br /&gt;Java method: java.sql.PreparedStatement.setFetchSize, java.sql.Statement.setFetchSize&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Overview&lt;/h2&gt;&lt;p&gt;Any programming that can work with databases will offer an API to write SELECT statement.&amp;nbsp; In term of Java, they are following Java classes:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;java.sql.Statement&lt;/li&gt;&lt;li&gt;java.sql.PreparedStatement&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Certainly there are more way to run a SELECT statement without using above, but this post will focus in these 2, as they are indirectly called by any SELECT statement execution by any programming languages in the world.&amp;nbsp; This has been since the 1980 when a database programming was introduces, and many programmer today has no clue how this begin, especially why this is required.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This post is going to explain how to use Java programming language to tune a SELECT statement for a very specific use case:&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;SELECT statement is returning a lots of data, such as 1000 rows and above&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;The tuning will be to tune either of following Java JDBC class:&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;java.sql.Statement&lt;/li&gt;&lt;li&gt;java.sql.PreparedStatement&lt;/li&gt;&lt;li&gt;java.sql.ResultSet&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Architecture&lt;/h2&gt;&lt;div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;In order to explains the tuning of these 2 JDBC class, first I need to explain how SELECT statement work in low level.&amp;nbsp; I will use programmer&#39;s perspective to explain, and skip many low level database execution, and pick Oracle DB as an example.&amp;nbsp; This is mainly I worked more in Oracle, and Oracle KB and blogs are sharing more of its internal architecture than MS SQL Server, for example.&lt;/p&gt;&lt;p&gt;A SELECT statement execution goes through following process:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Crafts a SELECT statement&lt;/li&gt;&lt;ol&gt;&lt;li&gt;In Java programming, this often be stored as a String variable, or many SELECT statements in many String variables&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Creates a String variable to store above SELECT statement&lt;/li&gt;&lt;li&gt;Create a new variable of JDBC class java.sql.PreparedStatement by using above String (or SELECT statement) to that it becomes an object that is parsed (Oracle&#39;s keyword), and in programmer&#39;s terminology, it means compiled by DB&lt;/li&gt;&lt;ol&gt;&lt;li&gt;PreparedStatement or DB SQL parsing is always required to run any SQL, including SELECT, INSERT, DELETE, CREATE, DROP, TRUNCATE, function call, store procedure call.&amp;nbsp; Let&#39;s call these DDL (data definition) and DML (data manipulation)&lt;/li&gt;&lt;li&gt;PreparedStatement will indirectly getting call by any JDBC if the program doesn&#39;t defined/specify/create this object when executing any SQL&lt;/li&gt;&lt;li&gt;There is no way to bypass SQL parsing (Java PrepareStatement) when executing any DDL and DML&lt;/li&gt;&lt;li&gt;The object in Java takes up very little memory (Java called heap memory)&lt;/li&gt;&lt;ol&gt;&lt;li&gt;In Java documentation, you often read this will allocate some memory, but the document was written when max desktop RAM was 512MB&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;The object in Oracle takes up very little memory&lt;/li&gt;&lt;ol&gt;&lt;li&gt;In Oracle documentation, you often read this will allocate some memory, but the document was written when max&amp;nbsp;desktop RAM was 2GB&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;The variable will auto set its row fetch size of 10 rows, i.e. PreparedStatement.setFetchSize(10).&amp;nbsp; It will download 10 rows on every ResultSet..next() method. You can call PreparedStatement.getFetchSize() to display its row fetch size&lt;/li&gt;&lt;li&gt;This PreparedStatement variable is ready to run by calling&amp;nbsp; PreparedStatement.executeQuery()&lt;/li&gt;&lt;li&gt;The FetchSize doesn&#39;t take up memory in object PreparedStatement&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Creates a commonly used variable for JDBC class of java.sql.Statement that either&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Uses above PreparedStatement&amp;nbsp;variable&lt;/li&gt;&lt;li&gt;Runs above String variable contains a SELECT statement&lt;/li&gt;&lt;li&gt;Runs a a SELECT statement, typically used to get current timestamp&lt;/li&gt;&lt;li&gt;The variable will auto set its row fetch size of 10 rows, i.e. Statement.setFetchSize(10).&amp;nbsp; It will download 10 rows on every ResultSet..next() method. You can call Statement.getFetchSize() to display its row fetch size&lt;/li&gt;&lt;li&gt;Oracle DB will indirectly performs SQL parsing inside the DB, which takes up a little memory in Oracle DB server&lt;/li&gt;&lt;li&gt;The FetchSize doesn&#39;t take up memory in object Statement&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Run the SQL by calling either&amp;nbsp;following JDBC method:&lt;/li&gt;&lt;ol&gt;&lt;li&gt;PreparedStatement.executeQuery()&lt;/li&gt;&lt;li&gt;Statement.executeQuery()&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Oracle DB will takes time to execution the SQL statement.&amp;nbsp; It will take longer time if Oracle DB has poor SQL execution plan, or high data volumes that DB takes time to load the data from hard disk, or joins them using CPU.&amp;nbsp; Java program doesn&#39;t do any processing, and no data is available for the Java program to download.&amp;nbsp; In other word, Java program will stop and wait until DB finished execute the SQL, and ready to return the data. executeQuery() will wait as long as the Oracle DB takes to run the SELECT statement.&amp;nbsp; If the SELECT&amp;nbsp;takes 50 hr to execute, then executeQuery() will&amp;nbsp;wait for 50 hr&lt;/li&gt;&lt;li&gt;After Oracle completed executing the SELECT statement, fetch/download the rows into Java using JDBC class ResultSet&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Creates a new variable of JDBC class ResultSet&lt;/li&gt;&lt;li&gt;Download 10 rows (record) of records using ResultSet.next() method&lt;/li&gt;&lt;li&gt;If you set FetchSize to be higher using setFetchSize(), then ResultSet.next()&amp;nbsp;will download more rows from the DB server&lt;/li&gt;&lt;li&gt;ResultSet.next() method will pause longer the higher the FetchSize set to.&amp;nbsp; Imagine you are downloading files from Internet with bigger size.&amp;nbsp; The bigger the file, the longer it takes to download&lt;/li&gt;&lt;li&gt;The more columns the SELECT statement indicates, the bigger the data volume and longer it takes to run next() method&lt;/li&gt;&lt;li&gt;So total time to fetch 10 rows (or FetchSize if set to diff value) depends on (excludes time waiting for DB to run SELECT statement):&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Number of columns defined in SELECT statement&lt;/li&gt;&lt;li&gt;Number of columns with data. If no data, then no impact&lt;/li&gt;&lt;li&gt;Data size for each column&lt;/li&gt;&lt;li&gt;Number of rows to fetch that defined by setFetchSize. Default is 10 rows&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;FetchSize can be modify in real time JDBC method ResultSet.setFetchSize(new_value) anytime&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;SELECT Statement Tuning&lt;/h2&gt;&lt;p&gt;After lengthy explanation of the SELECT statement architecture, let&#39;s get into SELECT statement tuning.&lt;/p&gt;&lt;p&gt;We will not discuss about tuning of following as some are business requirement, and some are SQL tuning beyond Java programming tuning:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;slow running SELECT statement that DB takes time to process&lt;/li&gt;&lt;li&gt;poorly written SELECT statement&lt;/li&gt;&lt;li&gt;SELECT statement is joining plus expecting to retrieve all data from very large tables, such as 10GB - 300TB&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;The performance tuning in Java program is for following Java JDBC class in their FetchSize:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;java.sql.Statement&lt;/li&gt;&lt;li&gt;java.sql.PreparedStatement&lt;/li&gt;&lt;li&gt;java.sql.ResultSet&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;To further elaborate, performance tuning in Java program is increase number of rows to download from Oracle DB each time by calling following Java JDBC method:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;java.sql.Statement.setFetchSize()&lt;/li&gt;&lt;li&gt;java.sql.PreparedStatement.setFetchSize()&lt;/li&gt;&lt;li&gt;java.sql.ResultSet.setFetchSize()&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Why Tune Default Row Fetch Size&amp;nbsp;&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Default of 10 rows (FetchSize) is too small by today&#39;s standard.&amp;nbsp; A desktop computer often comes with 1Gbps network card, while servers are using 10Gbps network card.&amp;nbsp; Back to 30 years ago, network card was running at 10Mbps.&amp;nbsp; Many residential internet are between 50Mbps and 1Gbps.&lt;/li&gt;&lt;li&gt;Data size are significantly bigger, such as storing image, video, audio.&lt;/li&gt;&lt;li&gt;Max column size has increased. Oracle LONG column type is changed to CLOB (character) and BLOG (binary) which can hold 8TB - 128TB for 1 column.&lt;/li&gt;&lt;li&gt;Business users have valid usage to display 1000 rows per screen, such as viewing reports, YouTube video, X tweets, so 10 rows is too little, and anonying&lt;/li&gt;&lt;li&gt;Too frequent pause when calling next() after it finished process/display 10 rows due to network latency&lt;/li&gt;&lt;li&gt;It is safe to set a proper FetchSize, such as 1000 rows when the SELECT returns 1 row.&amp;nbsp; It doesn&#39;t take longer to download 1 row, when FetchSize=1000&lt;/li&gt;&lt;/ol&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Tuning Consideration&lt;/h3&gt;&lt;div&gt;Fully study following when considering tuning FetchSize:&lt;/div&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Does users/application really needs to retrieve so many columns in the SELECT statement?&lt;/li&gt;&lt;li&gt;How big (in bytes) the column size in the SELECT statement?&lt;/li&gt;&lt;li&gt;How big (in bytes) the total size of all columns in the SELECT statement?&lt;/li&gt;&lt;li&gt;How many records it will return by the SELECT statement?&lt;/li&gt;&lt;li&gt;Can user adjust the FetchSize from the application?&lt;/li&gt;&lt;/ol&gt;&lt;h4 style=&quot;text-align: left;&quot;&gt;Scenario 1: Showing number, strings, and time&lt;/h4&gt;&lt;/div&gt;&lt;div&gt;90% of regular applications design often returns these column types in their SELECT statement, and their max size in Oracle as non-Unicode (byte):&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;number - 40 bytes&lt;/li&gt;&lt;li&gt;varchar2 - 32 KB&lt;/li&gt;&lt;li&gt;datetime - 16 bytes&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Let&#39;s assume SELECT statement is returning so many number of column types, with total of 10 columns:&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;number - 3&lt;/li&gt;&lt;li&gt;varchar2 - 5&lt;/li&gt;&lt;li&gt;datetime - 2&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;So total max bytes that the next() will download from the DB server is&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Max row size in byte = 3 * 40 + 5 * 32KB + 2 * 16&lt;/div&gt;&lt;div&gt;= 120 bytes + 160 KB + 32 bytes&lt;/div&gt;&lt;div&gt;=&amp;nbsp;163992 bytes&lt;/div&gt;&lt;div&gt;= 160.1484375 KB&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Assumes that business users is able to accept 1 sec pause to display the data (download 10 columns from the Oracle DB server), then following is the size of data download size for different network speed of 1 sec:&lt;/div&gt;&lt;div&gt;1 sec for 1Mbps = 1 sec * 1,000,000 bit/s = 122.070 KB&lt;/div&gt;&lt;div&gt;1 sec for 10Mbps = 1 sec * 10,000,000 bit/s = 1220.703 KB&lt;/div&gt;&lt;div&gt;1 sec for 1Gbps = 1 sec * 1,000,000,000 bit/s = 119.209 MB&lt;/div&gt;&lt;div&gt;1 sec for 2Gbps = 1 sec * 2,000,000,000&amp;nbsp;bit/s = 237.418 MB&lt;/div&gt;&lt;div&gt;1 sec for 10Gbps = 1 sec * 10,000,000,000&amp;nbsp;bit/s = 1192.093 MB&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Uses above data download size for 10 columns (160.1484375 KB max per row size) and determine the acceptable FetchSize:&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;1Mbps: FetchSize=1&lt;/li&gt;&lt;li&gt;10Mbps: FetchSize=7&lt;/li&gt;&lt;li&gt;1Gbps: FetchSize=762&lt;/li&gt;&lt;li&gt;2Gbps: FetchSize=1524&lt;/li&gt;&lt;li&gt;10Gbps: FetchSize=7622&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;If business users said even the varchar2 column type can hold 32KB of data, but 99% of the data is below 2 KB, then max column size in bytes (keeping other columns type as their max size):&lt;/div&gt;&lt;div&gt;&lt;div&gt;Max row size in byte = 3 * 40 + 2 * 2KB + 2 * 16&lt;/div&gt;&lt;div&gt;= 120 bytes + 4 KB + 32 bytes&lt;/div&gt;&lt;div&gt;=&amp;nbsp;4248 bytes&lt;/div&gt;&lt;div&gt;= 4.148 KB&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then the acceptable FetchSize for different network download speeds are below:&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;1Mbps: FetchSize=29&lt;/li&gt;&lt;li&gt;10Mbps: FetchSize=294&lt;/li&gt;&lt;li&gt;&lt;b&gt;1Gbps&lt;/b&gt;: FetchSize=29425&lt;/li&gt;&lt;li&gt;2Gbps: FetchSize=58851&lt;/li&gt;&lt;li&gt;&lt;b&gt;10Gbps&lt;/b&gt;: FetchSize=294256&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Default FetchSize of 10 rows is too small for business servers which often uses 1Gbps between Oracle server and Java application.&lt;/div&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Over Tune Warning&lt;/h2&gt;&lt;div&gt;Be aware about maximum column size (in bytes) in the SELECT statement&amp;nbsp;when adjusting FetchSize:&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;varchar2 - 32KB max&lt;/li&gt;&lt;li&gt;LONG - 2GB max&lt;/li&gt;&lt;li&gt;BLOB - 8 - 128TB max&lt;/li&gt;&lt;li&gt;CLOB&amp;nbsp;- 8 - 128TB max&lt;/li&gt;&lt;li&gt;BFILE - 4GB max&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Not all SELECT statement are identical, so don&#39;t simply reuse a very high FetchSize value that used by another SELECT statement.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Following are bad example of over tune FetchSize:&lt;/div&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Business users often enter 4000 or more characters for a Note column inside a table.&amp;nbsp; The application set to display 1000 rows (FetchSize=1000) which easily download 4MB of data into Java application/servlet.. The Java application is used by 2000 concurrent users.&amp;nbsp; Programmer designed above screen in a frequently used home screen, which has 2000 concurrent users (4MB * 2000 ~ 8GB)&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Business users should consider fetching the first 100 characters from the Note column instead of displaying entire Note.&amp;nbsp; If business users need to read specific Note, then click and display the specific Note&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Business users want to auto download monthly pdf when click on the &quot;Download Monthly Check Deposit&quot; button, similar to an invoice screen that the application has (FetchSize=50).&amp;nbsp; However, business users didn&#39;t consider that the pdf in this screen often contains images of checks that are taken with cellphone, and each are 2MB easily.&amp;nbsp; This screen is used by business customers who deposit max 100 of check daily, and the screen suppose to display 1 months of records.&amp;nbsp; This means the button will download 100 checks * 31 days = 3,100 rows of checks in pdf file.&amp;nbsp; When JDBC FetchSize was set to 100 rows in this check deposit screen, it will download 302GB of data for the entire month per business customer&lt;/li&gt;&lt;ol&gt;&lt;li&gt;This functionality to download entire month&#39;s check should not be offered unless end-to-end network speed is 10Gbps (this still takes ~ 30 sec to download the data into Java application)&lt;/li&gt;&lt;/ol&gt;&lt;li&gt;Reporting users designed a simple monthly operation reports which are showing 5,000 columns from few tables with big data volume, and high transactions volume daily. When setFetchSize to a high value, the report always crash the Java application (run out of heap memory)&lt;/li&gt;&lt;ol&gt;&lt;li&gt;setFetchSize should set to a lower value&lt;/li&gt;&lt;li&gt;Java heap memory needs to increase&lt;/li&gt;&lt;li&gt;Controls number of rows to display the output to the screen&lt;/li&gt;&lt;li&gt;Encourage users to save to file&lt;/li&gt;&lt;li&gt;Offers pagination in the screen, and set setFetchSize&amp;nbsp;to match the number of rows display on the screen, or 1/5 (so next() will indirectly download 5 times from the DB server) of the total rows. Uses following Java code to determine number of rows (not all DB type supports last())&lt;/li&gt;&lt;ol&gt;&lt;li&gt;ResultSet rs = stmt.executeQuery(sql);&lt;/li&gt;&lt;li&gt;int rowCount = rs.last() ? rs.getRow() : 0;&lt;/li&gt;&lt;li&gt;rs.beforeFirst();&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/5866260840952071593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/5866260840952071593' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/5866260840952071593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/5866260840952071593'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2024/05/java-sql-programming-tuning-select.html' title='Java SQL Programming - Tuning SELECT Statement Performance, JDBC Performance Tuning'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-723094242601948273</id><published>2024-04-22T13:20:00.006-04:00</published><updated>2024-04-22T13:20:41.247-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SAP Data Services"/><title type='text'>SAP BODS JobServer: Enabling IPv6</title><content type='html'>&lt;p&gt;Product: SAP Data Services&lt;/p&gt;&lt;p&gt;Version: 4.2.x&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Overview&lt;/h1&gt;&lt;p&gt;SAP BODS product bundled with following 2 software:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;IPS&lt;/li&gt;&lt;li&gt;Data Services JobServer - I will refer to it as JobServer&lt;/li&gt;&lt;li&gt;Tomcat&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Following are the default ports each listening on&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;IPS - TCP port 6400&lt;/li&gt;&lt;li&gt;JobServer - TCP port 3500&lt;/li&gt;&lt;li&gt;Tomcat - TCP port 8080&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;This post mainly write about IPv6, as certain people might have IPv6 setup, and would like to use it.&amp;nbsp; I won&#39;t discuss about Tomcat, as its IPv4 &amp;amp; IPv6 network configuration follows Apache Tomcat&#39;s documentation.&lt;/p&gt;&lt;p&gt;IPS has both IPv4 and IPv6 enabled during installation.&amp;nbsp; However, JobServer only enable IPv4, and the product document does not show how to enable IPv6.&amp;nbsp; The confusing part is that their product document, and SAP KB have several places that indicate IPv6 is supported, yet no documentation how to enable it.&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Enabling IPv6 for JobServer&lt;/h1&gt;&lt;p&gt;Follow these steps to enable IPv6 (and keeps IPv4) for JobServer&lt;/p&gt;&lt;p&gt;1. cd $LINK_DIR/bin&lt;/p&gt;&lt;p&gt;2. Append SAP_IPv6_ACTIVE=Y into al_env.sh: echo &quot;export SAP_IPv6_ACTIVE=Y &amp;gt;&amp;gt; al_env.sh&quot;&lt;/p&gt;&lt;p&gt;3. Restart JobServer: svrcfg&lt;/p&gt;&lt;p&gt;3.1. In the menu, choose stop JobServer, then start JobServer&lt;/p&gt;&lt;h1 style=&quot;text-align: left;&quot;&gt;Verify IPv6 enabled for JobServer&lt;/h1&gt;&lt;div&gt;When I raised SAP support ticket, SAP keeps saying IPv6 is enabled, so I have to provide proof that it is not.&amp;nbsp; You can use this command to verify that IPv6 is enable&lt;/div&gt;&lt;div&gt;1. Linux: netstat -an | grep 3500 | grep LISTEN&lt;/div&gt;&lt;div&gt;2. Windows: Run cmd as Administrator&lt;/div&gt;&lt;div&gt;2..1. netstat -an | findstr &quot;3500&quot; | findstr &quot;LISTEN&quot;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Sample output that shows IPv6 works in port 3500&lt;/div&gt;&lt;div&gt;tcp&amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; 0 0.0.0.0:3500&amp;nbsp; &amp;nbsp; 0.0.0.0:*&amp;nbsp; &amp;nbsp; LISTEN&lt;/div&gt;&lt;div&gt;&lt;div&gt;tcp6&amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; 0 0.0.0.0:3500&amp;nbsp; &amp;nbsp; 0.0.0.0:*&amp;nbsp; &amp;nbsp; LISTEN&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;The first column, &quot;tcp6&quot;means it is for IPv6, while &quot;tcp&quot; means it is for IPv4&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/723094242601948273/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/723094242601948273' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/723094242601948273'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/723094242601948273'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2024/04/sap-bods-jobserver-enabling-ipv6.html' title='SAP BODS JobServer: Enabling IPv6'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-4316358179367432926</id><published>2024-04-16T16:24:00.000-04:00</published><updated>2024-04-16T16:24:03.094-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cognos"/><title type='text'>IBM Cognos Analytics: Content Store JDBC Configuration for Oracle</title><content type='html'>&lt;p&gt;Product:&amp;nbsp;IBM Cognos Analytics&lt;/p&gt;&lt;p&gt;Version: 10.2.1 - 12.0.0&lt;/p&gt;&lt;p&gt;OS: Windows, Linux&lt;/p&gt;&lt;p&gt;IBM Cognos Analytics documentation about Content Store&#39;s configuration using Oracle database is very limited.&lt;/p&gt;&lt;p&gt;This post will list down several configurations&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Option 1: Using TNS from tnsnames.ora. Most Recommended&lt;/h3&gt;&lt;p&gt;Using TNS name is the most preferred method for following reasons:&lt;/p&gt;&lt;p&gt;1. Changing of Oracle hostname doesn&#39;t need to change Cognos configuration, and can be done in real time&lt;/p&gt;&lt;p&gt;2. You can leverage Oracle scan listener functionality in tnsnames.ora&lt;/p&gt;&lt;p&gt;3. You can leverage fail-over Oracle functionality in tnsnames.ora&lt;/p&gt;&lt;p&gt;4. You can leverage standby fail-over Oracle functionality in tnsnames.ora&lt;/p&gt;&lt;p&gt;5. You can troubleshoot Cognos content store connectivity to Oracle DB using tnsping [TNS name] command&lt;/p&gt;&lt;p&gt;6. Supports Oracle RAC through tnsnames.ora&lt;/p&gt;&lt;p&gt;Steps:&lt;/p&gt;&lt;p&gt;1. Delete all entries under Data Access &amp;gt; Content Manager&lt;/p&gt;&lt;p&gt;2. Create new Content Store, and pick &quot;Oracle database (Advanced)&quot;&lt;/p&gt;&lt;p&gt;3. Enter the pre-configured Oracle TNS name from tnsnames.ora under &quot;Database specifier&quot;&lt;/p&gt;&lt;p&gt;4. In this example, &quot;ora21c&quot; is the TNS name entry that already configured in tnsnames.ora&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhi_W8TvgWgKdJxrznDL-Uomgec35Q0c_53GqdLQe5GOfRcWwLPhUQq4pOBC_lGWsWfYDIhF0IOxSP--I8x1mFdlWhDyOAYbeLIK4WaKZqSpC8b8fNg1xJh7v5U_27olqnCB9DFkPtPQlIS4dlsaH3rMhN1vuDHVUdq_S61hgWutN4bFmRDU_G0oMkWoJ04&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;118&quot; data-original-width=&quot;503&quot; height=&quot;75&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEhi_W8TvgWgKdJxrznDL-Uomgec35Q0c_53GqdLQe5GOfRcWwLPhUQq4pOBC_lGWsWfYDIhF0IOxSP--I8x1mFdlWhDyOAYbeLIK4WaKZqSpC8b8fNg1xJh7v5U_27olqnCB9DFkPtPQlIS4dlsaH3rMhN1vuDHVUdq_S61hgWutN4bFmRDU_G0oMkWoJ04&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Option 2: Uses URL syntax&lt;/h3&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Uses a JDBC URL syntax of //[hostname]:[port]/[service name] will leverage Oracle Service functionality, as well as making the entry easy to maintain.&lt;/p&gt;&lt;p&gt;There is not much advantage to this approach compare to above, so I will only list down disadvantage:&lt;/p&gt;&lt;p&gt;1. Changing of Oracle hostname, port, service name will required to shutdown Cognos daemon&lt;/p&gt;&lt;p&gt;2. Not possible to perform connectivity test using exact URL&lt;/p&gt;&lt;p&gt;3. Doesn&#39;t support Oracle RAC&lt;/p&gt;&lt;p&gt;4. Doesn&#39;t support Oracle standby&lt;/p&gt;&lt;p&gt;5. Doesn&#39;t support Oracle fail-over&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Steps:&lt;/p&gt;&lt;p&gt;1. Delete all entries under Data Access &amp;gt; Content Manager&lt;/p&gt;&lt;p&gt;2. Create new Content Store, and pick &quot;Oracle database (Advanced)&quot;&lt;/p&gt;&lt;p&gt;3. Enter //[hostname]:[port]/[service name]&amp;nbsp;under &quot;Database specifier&quot;&lt;/p&gt;&lt;p&gt;3.1. hostname - Oracle database server&#39;s hostname&lt;/p&gt;&lt;p&gt;3.2. port - Oracle listener&#39;s port. Default is 1521&lt;/p&gt;&lt;p&gt;3.3. service name - Oracle listener&#39;s service name as shown in &quot;lsnrctl status [listener]&quot;&lt;/p&gt;&lt;p&gt;4. In this example, &quot;//ora-db-21c:1521/ora21c.abc.com&quot; will connects to host ora-db-21c on port 1521, with Oracle service name&amp;nbsp; ora21c.abc.com&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjUzHpHTA0sr2RphA6BoUragWXcL8WCylo3xjsfmmBOBU3azEWRW_wM3APLz0L6JBxwSHPVnGIxKuQ_KrNFifWRIuTwP10zcgWEnzjsVIr22ZVuB9g10X-yW7Di4qgZfAUbgVEnUaAVqoC7WsvITJMiKrg4e4iPROvREWzeyOPjPJ3ss7vv7MDGMFapHch0&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;118&quot; data-original-width=&quot;503&quot; height=&quot;75&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEjUzHpHTA0sr2RphA6BoUragWXcL8WCylo3xjsfmmBOBU3azEWRW_wM3APLz0L6JBxwSHPVnGIxKuQ_KrNFifWRIuTwP10zcgWEnzjsVIr22ZVuB9g10X-yW7Di4qgZfAUbgVEnUaAVqoC7WsvITJMiKrg4e4iPROvREWzeyOPjPJ3ss7vv7MDGMFapHch0&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;h3&gt;Option 3: Uses long TNS syntax&lt;/h3&gt;&lt;div&gt;This is an lengthy and poor readability configuration, but it offers some advantages:&lt;/div&gt;&lt;div&gt;1. You can leverage Oracle scan listener functionality in tnsnames.ora&lt;/div&gt;&lt;p&gt;2. You can leverage fail-over Oracle functionality in tnsnames.ora&lt;/p&gt;&lt;p&gt;3. You can leverage standby fail-over Oracle functionality in tnsnames.ora&lt;/p&gt;&lt;p&gt;4. You can troubleshoot Cognos content store connectivity to Oracle DB using tnsping [TNS name] command&lt;/p&gt;&lt;p&gt;5. Supports Oracle RAC through tnsnames.ora&lt;/p&gt;&lt;p&gt;Disadvantage:&lt;/p&gt;&lt;p&gt;1. Length to type, and potentially make mistake&lt;/p&gt;&lt;p&gt;2. Difficult and time consuming to modify&lt;/p&gt;&lt;p&gt;3. Modification of hostname, port, service name will require to restart Cognos daemon&lt;/p&gt;&lt;p&gt;4. using tnsping to perform connectivity test is challenging for those who doesn&#39;t know the syntax that has been long forgotten&lt;/p&gt;&lt;p&gt;Steps:&lt;/p&gt;&lt;p&gt;1. Delete all entries under Data Access &amp;gt; Content Manager&lt;/p&gt;&lt;p&gt;2. Create new Content Store, and pick &quot;Oracle database (Advanced)&quot;&lt;/p&gt;&lt;p&gt;3. Under &quot;Database specifier,&quot; enter &quot;(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = ora-db-21c)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = ora21c.abc.com)))&quot;&lt;/p&gt;&lt;p&gt;3.1. HOST&amp;nbsp;- Oracle database server&#39;s hostname&lt;/p&gt;&lt;p&gt;3.2. PORT&amp;nbsp;- Oracle listener&#39;s port. Default is 1521&lt;/p&gt;&lt;p&gt;3.3. SERVICE_NAME&amp;nbsp;- Oracle listener&#39;s service name as shown in &quot;lsnrctl status [listener]&quot;&lt;/p&gt;&lt;h3&gt;Option 4: Uses SID&lt;/h3&gt;&lt;div&gt;This is the least recommended approach, but remains in Cognos product documentation for the longest time.&amp;nbsp; The main reason is that Oracle documentation has recommended not to use SID to login for any application since late 1990s.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The syntax is hostname:port:SID, which is very similar to URL syntax above, but it uses &quot;:&quot; instead of &quot;/&quot;&lt;/div&gt;&lt;div&gt;&lt;p&gt;There is not much advantage to this approach compare to above, so I will only list down disadvantage:&lt;/p&gt;&lt;p&gt;1. Changing of Oracle hostname, port, service name will required to shutdown Cognos daemon&lt;/p&gt;&lt;p&gt;2. Not possible to perform connectivity test using exact URL&lt;/p&gt;&lt;p&gt;3. Doesn&#39;t support Oracle RAC&lt;/p&gt;&lt;p&gt;4. Doesn&#39;t support Oracle standby&lt;/p&gt;&lt;p&gt;5. Doesn&#39;t support Oracle fail-over&lt;/p&gt;&lt;p&gt;6. SID might be different than service name that Oracle DBA is familiar, and might cause communication gap, and confusion during connectivity troubleshooting&lt;/p&gt;&lt;/div&gt;&lt;p&gt;Steps:&lt;/p&gt;&lt;p&gt;1. Delete all entries under Data Access &amp;gt; Content Manager&lt;/p&gt;&lt;p&gt;2. Create new Content Store, and pick &quot;Oracle database (Advanced)&quot;&lt;/p&gt;&lt;p&gt;3. Under &quot;Database specifier,&quot; enter &quot;[hostname]:[port]:[SID]&quot;&lt;/p&gt;&lt;p&gt;3.1. hostname- Oracle database server&#39;s hostname&lt;/p&gt;&lt;p&gt;3.2. port- Oracle listener&#39;s port. Default is 1521&lt;/p&gt;&lt;p&gt;3.3. SID - Oracle DB&#39;s SID, but not service name&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj2mj45YDsy_HjG6oI4FLCWfr1KBKivUBh19GOBA2o9kgmoM3BthRVzbAoY6qYD7yD7YDCRdJvjeXaqRSNLA_bIFqyBfy_lbZEpA7qmj7pUs5QrZXd7_HmRIcYTnmI1Hyb617sOeddvsMEuHZu8flGB9qdDkboDIrowzlujqnBLQlDhtlFyql6hYMGc0_BL&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;118&quot; data-original-width=&quot;503&quot; height=&quot;75&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEj2mj45YDsy_HjG6oI4FLCWfr1KBKivUBh19GOBA2o9kgmoM3BthRVzbAoY6qYD7yD7YDCRdJvjeXaqRSNLA_bIFqyBfy_lbZEpA7qmj7pUs5QrZXd7_HmRIcYTnmI1Hyb617sOeddvsMEuHZu8flGB9qdDkboDIrowzlujqnBLQlDhtlFyql6hYMGc0_BL&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/4316358179367432926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/4316358179367432926' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/4316358179367432926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/4316358179367432926'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2024/04/ibm-cognos-analytics-content-store-jdbc.html' title='IBM Cognos Analytics: Content Store JDBC Configuration for Oracle'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEhi_W8TvgWgKdJxrznDL-Uomgec35Q0c_53GqdLQe5GOfRcWwLPhUQq4pOBC_lGWsWfYDIhF0IOxSP--I8x1mFdlWhDyOAYbeLIK4WaKZqSpC8b8fNg1xJh7v5U_27olqnCB9DFkPtPQlIS4dlsaH3rMhN1vuDHVUdq_S61hgWutN4bFmRDU_G0oMkWoJ04=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-5223784814844030724</id><published>2024-02-05T13:01:00.006-05:00</published><updated>2024-02-05T13:01:50.248-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Oracle"/><title type='text'>Oracle sqlplus Login Failure Handling in Shell Script</title><content type='html'>&lt;p&gt;&amp;nbsp;Product: Oracle RDBS&lt;/p&gt;&lt;p&gt;Command: sqlplus, shell script&lt;/p&gt;&lt;h2&gt;Overview&lt;/h2&gt;&lt;p&gt;I would like to document how to create a shell script that will report whether the username credential that stores in a file can successfully login to Oracle DB, or filed.&lt;/p&gt;&lt;p&gt;Without specifying any sqlplus parameter, sqlplus will always return exit code of 0 to the shell script.&amp;nbsp; I have seen people uses text processing utility to search for the login failure command to detect login failure, but they should use parameter &quot;/l&quot; to do that.&lt;/p&gt;&lt;p&gt;Moreover, in a shell script, I will suggest to turn off the login banner to make the output less verbose by using parameter &quot;/s&quot;&lt;/p&gt;&lt;h2&gt;Instruction&lt;/h2&gt;&lt;p&gt;Suggested command is &quot;sqlplus /s /l username@TNS&quot;&lt;/p&gt;&lt;p&gt;To automate the password, my suggested command is &quot;echo [password] | sqlplus /s /l username@TNS&quot;&lt;/p&gt;&lt;p&gt;Later, the shell script can uses the OS return code&#39;s build-in parameter $? with following meaning:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;0 - login successful&lt;/li&gt;&lt;li&gt;1 - login failed&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/5223784814844030724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/5223784814844030724' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/5223784814844030724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/5223784814844030724'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2024/02/oracle-sqlplus-login-failure-handling.html' title='Oracle sqlplus Login Failure Handling in Shell Script'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total><georss:featurename>Canada</georss:featurename><georss:point>56.130366 -106.346771</georss:point><georss:box>27.820132163821157 -141.503021 84.440599836178848 -71.190521</georss:box></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-6212375275711650188</id><published>2023-10-20T12:51:00.005-04:00</published><updated>2023-10-23T10:55:56.301-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cognos SSL"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="ssl"/><title type='text'>SSL Setup - Java https, smtp, MS SQL Server</title><content type='html'>&lt;p&gt;Technology: Java using SSL Certificate, or TLS1.2 - 1.3 encryption&lt;/p&gt;&lt;p&gt;Product: web server (https), SMTP email, force encryption MS SQL Server&lt;/p&gt;&lt;p&gt;There are several steps involve in setup SSL for various servers besides following standard&lt;/p&gt;&lt;p&gt;1. Create new SSL certificate for the virtual hostname used by the applications&lt;/p&gt;&lt;p&gt;2. Import the SSL certificate to the application servers&lt;/p&gt;&lt;p&gt;2.1. For Java, you need to import into Java keystore. For OpenJDK or Oracle Java (JRE), it is located in [java_jre_home]\lib\security, or [java_&lt;b&gt;jdk&lt;/b&gt;_home\jre\lib\security.&lt;/p&gt;&lt;p&gt;2.2. For Linux or Windows binary programs, you need to import into OS. For RHEL, the SSL certificate file will be&amp;nbsp;/etc/ssl/certs&lt;/p&gt;&lt;p&gt;3. Configures the application server to enable SSL, and indirectly specified the SSL certificate to use&lt;/p&gt;&lt;p&gt;4. Configures the application client to enable SSL, and optionally&lt;/p&gt;&lt;p&gt;4.1. Java - optionally specifies SSL keystore if not using default&lt;/p&gt;&lt;p&gt;Now, let&#39;s pick an application that leverages multiple technologies, and gives real picture what needs to be configured to enable SSL&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Cognos Analytics report server&lt;/h2&gt;&lt;p&gt;This reporting server has following functionality (typical, but could be more) that will has SSL encryption:&lt;/p&gt;&lt;p&gt;1. Web server - it is severing the report in html, so it is a web server&lt;/p&gt;&lt;p&gt;2. Web client - it is able to forward its traffic to a customer facing web server (IIS, Apache httpd, IBM httpd), so for this communication, it is a web client&lt;/p&gt;&lt;p&gt;3. SMTP email client - its interactive report and scheduled report can be sent out as email attachment (pdf, html)&lt;/p&gt;&lt;p&gt;4. DB client - it needs a &quot;Content Store&quot; DB to stores user credential and report template. It can has additional audit DB to store additional application data for audit functionality.&amp;nbsp; Any DB that it is querying to display the reports are all act as a DB client&lt;/p&gt;&lt;p&gt;5. Authentication client - OOTB LDAP (Windows only) server, custom LDAP, Okta, IBM OpenConnect, etc authentication that it supports, it is acting as client&lt;/p&gt;&lt;p&gt;Therefore, for above 5 typical server &amp;amp; client functionality, SSL can be enabled and encrypts the traffic between remote servers and clients.&lt;/p&gt;&lt;p&gt;For all the above functionality, you need to understand that the product is a pure Java J2EE application.&amp;nbsp; Therefore, all the SSL configuration will follow Java (standard) and IBM documentation (application specific).&lt;/p&gt;&lt;p&gt;Several and multiple SSL certificates involve in this encryption setup:&lt;/p&gt;&lt;p&gt;1. Java keystore located in [cognos_home]\configuration\certs\CAMKeystore (default password NoPassWordSet)&lt;/p&gt;&lt;p&gt;1.1. CAMKeystore&amp;nbsp;keeps the SSL cert for web/&lt;b&gt;https&amp;nbsp;&lt;/b&gt;access for Cognos Analytics server. If there are multiple virtual hostname (such as internal access, intranet access, internet access), then there are multiple SSL certs (unless the SSL cert contains multiple virtual hostname)&lt;br /&gt;1.2. CAMKeystore&amp;nbsp;keeps the SSL cert for Cognos Analytics server&#39;s databases access, e.g. Content DB, audit DB, data store DB. Example is MS SQL Server force encryption. Each remote DB server uses different SSL cert, and CA root&lt;br /&gt;1.3. CAMKeystore&amp;nbsp;keeps the SSL cert for SMTP server, which used for email of report, or email notification functionality. Example is smtp protocol with STARTTLS that enforce SSL, or smtps protocol. Typically only 1 SMTP server, so only 1 SSL cert&lt;br /&gt;1.4. CAMKeystore&amp;nbsp;keeps the SSL cert for client side https with remote customer users facing web server&lt;br /&gt;1.5. CAMKeystore&amp;nbsp;keeps the SSL cert for remote authentication server, e.g. LDAP , ActiveDirectory, and SSO. Each authentication server has its own SSL cert&lt;/p&gt;&lt;p&gt;Procedure:&lt;/p&gt;&lt;p&gt;1. Determine the root certificate for all 5 components above.&amp;nbsp; Each server will have its own SSL cert, and might not use the same CA root certificate&lt;/p&gt;&lt;p&gt;2. Verify in [cognos_home]\configuration\certs\CAMKeystore that the CA root certificate is already there, and will be recognize&lt;/p&gt;&lt;p&gt;2.1. Follows Cognos Analytics doc:&amp;nbsp;&lt;span style=&quot;background-color: white; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px;&quot;&gt;DLS_SSL_CertImportTool.bat (Windows), or sh (Linux) -&amp;nbsp;&lt;/span&gt;https://www.ibm.com/docs/en/cognos-analytics/11.2.0?topic=server-enabling-secure-tls-connection-your-email&lt;/p&gt;&lt;p&gt;3. Even if it is in CAMKeystore, verify that it is not expired&lt;/p&gt;&lt;p&gt;4. If not there, or expired, then export the CA root cert from remote server&lt;/p&gt;&lt;p&gt;5. Import into CAMKeystore, which is the IBM Java keystore&lt;/p&gt;&lt;p&gt;6. For DB used in data store, import the SSL cert into [cognos_home]\ibm-jre\jre\lib\security\&lt;b&gt;cacerts&lt;/b&gt;&lt;/p&gt;&lt;p&gt;6. Follows various IBM Cognos Analytics document to enable SSL encryption&lt;/p&gt;&lt;p&gt;6.1. For Cognos Analytics 12.0.0 SMTP -&amp;nbsp;https://www.ibm.com/docs/en/cognos-analytics/12.0.0?topic=server-enabling-secure-tls-connection-your-email&lt;/p&gt;&lt;p&gt;6.2. For Cognos Analytics 11.2.0 Content DB, audit DB, logging DB as database client -&amp;nbsp;https://www.ibm.com/docs/en/cognos-analytics/11.2.0?topic=communications-enabling-ssl-db2-informix-databases&lt;/p&gt;&lt;p&gt;6.3. For data store as DB client -&amp;nbsp;https://www.ibm.com/docs/en/cognos-analytics/11.2.0?topic=communications-enabling-ssl-db2-informix-databases&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Tools&lt;/h2&gt;&lt;p&gt;There are various DOS utilities that can troubleshoot SSL communication, but none for Java.&amp;nbsp; Some sample Java programs are available, but you have to compile, as well as familiar with SSL logging parameters that you have to manually specify.&lt;/p&gt;&lt;p&gt;Tools for&lt;/p&gt;&lt;p&gt;1. Windows: openssl&lt;/p&gt;&lt;p&gt;2. UNIX, Linux - openssl, curl&lt;/p&gt;&lt;p&gt;3. Java SMTP - Oracle&amp;nbsp;javamail-samples.zip that based on Oracle javax.mail.jar library that you need to download. It contains sample SMTP with STARTTLS sample code that you need to modify the Java program to specify SMTP port (default port 25)&lt;/p&gt;&lt;p&gt;4. Java MS SQL Server client - Microsoft provided sample https://learn.microsoft.com/en-us/sql/connect/jdbc/connection-url-sample?view=sql-server-ver16&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Tool - opemnssl for SMTP&lt;/h3&gt;&lt;p&gt;For SMTP that uses STARTTLS to enable encryption, uses following command to troubleshoot SSL issue&lt;/p&gt;&lt;p&gt;openssl s_client -starttls smtp -crlf -connect [remote email server hostname]:[smtp port]&lt;/p&gt;&lt;p&gt;This relies on OS SSL certificate store, so not applicable for Java SMTP troubleshooting&lt;/p&gt;&lt;h3&gt;Tool - opemnssl for SMTPS&lt;/h3&gt;&lt;div&gt;Same as above, but uses SMTPS SSL encryption, not SMTP + STARTTLS&lt;/div&gt;&lt;div&gt;&lt;p&gt;openssl s_client&amp;nbsp; smtps -crlf -connect [remote email server hostname]:[smtp port]&lt;/p&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Tool - curl for SMTP&lt;/h3&gt;&lt;p&gt;curl is preinstalled in Linux.&amp;nbsp; It can login to SMTP email server, and send out email.&amp;nbsp; Therefore, it is useful to ensure the remote SMTP server is properly configured to allow your application server to send out email. This uses SMTP + STARTTLS protocol&lt;/p&gt;&lt;p&gt;curl -v&amp;nbsp; smtp://email-smtp.us-east-1.amazonaws.com:587&amp;nbsp; --user &quot;login-user-name:password-to-be-filled&quot; --mail-from &quot;[username that allow to be used to send out&quot; --mail-rcpt &quot;email addr to receive the email&quot;&amp;nbsp; -T emailcontent.txt --ssl&lt;/p&gt;&lt;div&gt;&lt;h3&gt;Tool - curl for SMTPS&lt;/h3&gt;&lt;p&gt;Same as above, but uses SMTPS instead of SMTP + STARTTLS&lt;/p&gt;&lt;p&gt;curl -v&amp;nbsp; smtps://email-smtp.us-east-1.amazonaws.com:587&amp;nbsp; --user &quot;login-user-name:password-to-be-filled&quot; --mail-from &quot;[username that allow to be used to send out&quot; --mail-rcpt &quot;email addr to receive the email&quot;&amp;nbsp; -T emailcontent.txt&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Tool - Test-NetConnection&lt;/h3&gt;&lt;/div&gt;&lt;p&gt;PowerShell Test-NetConnection can be used to verify the application server machine can reach remote SMTP/DB/LDAP/Okta/SSO/web server.&amp;nbsp; This will give you a quick indication that the firewall, router, DNS, AWS Security Group, etc are configured to allow them to talk before you perform application side of testing, such as openssl, or curl above&lt;/p&gt;&lt;p&gt;test-netconnection [remote server hostname] -port [remote server port]&lt;/p&gt;&lt;p&gt;Example for MS SQL Server: test-netconnection [remote MS SQL Server virtual hostname] -port 1433&lt;/p&gt;&lt;p&gt;Example for web server: test-netconnection [remote web server virtual hostname] -port 443&lt;/p&gt;&lt;p&gt;Example for Oracle DB: test-netconnection [remote Oracle virtual hostname] -port 1521&lt;/p&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;Tool - Java&lt;/h3&gt;&lt;p&gt;Enable following SSL debug parameter when running sample MS SQL Server, Oracle sample JavaMail program, etc&lt;/p&gt;&lt;p&gt;Example for using Oracle JavaMail sample called smtpsend.java:&amp;nbsp;java&amp;nbsp; -cp .;..\javax.mail.jar;..\javax.activation-api-1.2.0.jar&amp;nbsp; &lt;b&gt;-Djavax.net.debug=ssl:handshake&lt;/b&gt; smtpsend&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/6212375275711650188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/6212375275711650188' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/6212375275711650188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/6212375275711650188'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2023/10/ssl-troubleshooting-java-https-smtp-ms.html' title='SSL Setup - Java https, smtp, MS SQL Server'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-5508872027022379052</id><published>2023-05-26T17:07:00.003-04:00</published><updated>2023-05-26T17:07:52.964-04:00</updated><title type='text'>SAP IPS - setup.exe doesn&#39;t recognize Product Key</title><content type='html'>&lt;p&gt;Product: SAP IPS&lt;br /&gt;Version: 4.1 - 4.2&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Symptom&lt;/h2&gt;&lt;p&gt;Run setup.exe, and enter a valid product key. Installer returns following error&lt;/p&gt;&lt;p&gt;Error&lt;br /&gt;An error has occurred.&lt;/p&gt;&lt;p&gt;The product key is not valid. INS00140&lt;/p&gt;&lt;p&gt;Checked installer log in /tmp/yyyy.mm.dd.hh24.mi.ss/setupengine.log for key validation failure. It is showing following&lt;/p&gt;&lt;p&gt;20:58:18.743 RawArgFormatter - property not set yet: shared.library.keycode.props-4.0-core$ProductKey&lt;/p&gt;&lt;p&gt;20:58:25.692 [validate_ProductKey]argument:&amp;nbsp; -keycode ********&amp;nbsp; -version 142 -property BOE.EnableBOE&lt;/p&gt;&lt;p&gt;20:58:26.056 [run_external_executable] cmdLine: cd &quot;/opt/download/sap/bods42sp14pl21/ips42sp9pl7/dunit/product.minibip-4.0-core-32/actions/&quot;; /opt/download/sap/bods42sp14pl21/ips42sp9pl7/dunit/product.minibip-4.0-core-32/actions//isKeycodeValid&amp;nbsp; -keycode ********&amp;nbsp; -version 142 -property BOE.EnableBOE&lt;/p&gt;&lt;p&gt;20:58:26.056 [validate_ProductKey]keyTypes [BOE.EnableBOE:142] is bad&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Solution&lt;/h2&gt;&lt;div&gt;For for full path of program &quot;isKeycodeValid&quot; shown in above log, then run following&lt;/div&gt;&lt;div&gt;chmod u+x &amp;lt;full path from log above&amp;gt;/isKeycodeValid&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You should be able to manually test this is success&lt;/div&gt;&lt;div&gt;cd &quot;/opt/download/sap/bods42sp14pl21/ips42sp9pl7/dunit/product.minibip-4.0-core-32/actions/&quot;&lt;/div&gt;&lt;div&gt;isKeycodeValid&amp;nbsp; -keycode &amp;lt;non case sensitive product key&amp;gt;&amp;nbsp; -version 142 -property BOE.EnableBOE&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/5508872027022379052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/5508872027022379052' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/5508872027022379052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/5508872027022379052'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2023/05/sap-ips-setupexe-doesnt-recognize.html' title='SAP IPS - setup.exe doesn&#39;t recognize Product Key'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-6519760574528968443</id><published>2023-05-16T14:26:00.002-04:00</published><updated>2023-05-16T14:26:13.368-04:00</updated><title type='text'>Cognos Analytics 11.1.x - 11.2.x - Installer failed with JRE libraries missing or not compatible</title><content type='html'>&lt;p&gt;Product: IBM Cognos Analytics&lt;br /&gt;Version: 11.1.0 - 11.2.2&lt;br /&gt;OS: Linux, AIX, PowerPC, all UNIX distributions&lt;br /&gt;Related IBM KB:&amp;nbsp;https://www.ibm.com/support/pages/jre-libraries-are-missing-or-not-compatible&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Problem&lt;/h2&gt;&lt;div style=&quot;background-color: white; border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;When executing&amp;nbsp; the Cognos installer on a Linux,Aix server the installer fails to run the following error:&lt;/div&gt;&lt;div style=&quot;background-color: white; border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; border: 0px; box-sizing: border-box; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;p style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: inherit; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1rem; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-variation-settings: inherit; letter-spacing: 0px; line-height: 1.625rem; margin: 0px; padding: 0px 0px 15px; vertical-align: baseline;&quot;&gt;Preparing to install...&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;Extracting the JRE from the installer archive...&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;Unpacking the JRE...&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;Extracting the installation resources from the installer archive...&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;Configuring the installer for this system&#39;s environment...&lt;/p&gt;&lt;p style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: inherit; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1rem; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-variation-settings: inherit; letter-spacing: 0px; line-height: 1.625rem; margin: 0px; padding: 0px 0px 15px; vertical-align: baseline;&quot;&gt;Launching installer...&lt;/p&gt;&lt;p style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: inherit; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1rem; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-variation-settings: inherit; letter-spacing: 0px; line-height: 1.625rem; margin: 0px; padding: 0px 0px 15px; vertical-align: baseline;&quot;&gt;JRE libraries are missing or not compatible....&lt;br style=&quot;box-sizing: border-box;&quot; /&gt;Exiting....&quot;&lt;/p&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;&lt;h2 class=&quot;ibm-h4 ibm-bold ibm-northstart-documentation-information-label&quot; style=&quot;border: 0px; box-sizing: border-box; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 1.25rem; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0px; line-height: 1.5625rem; margin: 0px; padding: 0px 0px 15px; vertical-align: baseline;&quot;&gt;Symptom&lt;/h2&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;The installer consistently fail to run with below false alarm:&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;ul style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px; text-align: left;&quot;&gt;&lt;li&gt;JRE libraries are missing - not applicable as the installer is downloaded many times from IBM as a valid zip file, as well as across many different version of Cognos from 11.1.0 - 11.2.2&lt;/li&gt;&lt;li&gt;JRE not compatible - not possible, as the installer bundled IBM Java in /tmp/install.dir.[nnnnn]/Linux/resource/jre/bin&lt;/li&gt;&lt;/ul&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;(login as UNIX cognos user that created to own the application)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;$ echo $TMP&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;[empty]&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;$ grep noexec /etc/fstab&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #323232; font-family: IBM Plex Sans, IBM Plex Mono;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;UUID=c7aac85c-4dfd-4e40-bd6c-bf57c8284c0c&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xfs&amp;nbsp; &amp;nbsp; &amp;nbsp;defaults,noexec&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #323232; font-family: IBM Plex Sans, IBM Plex Mono;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;$ echo &quot;echo 012345&quot; &amp;gt; /tmp/test_exec.sh&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #323232; font-family: IBM Plex Sans, IBM Plex Mono;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;$ sh /tmp/tst_exec.sh&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #323232; font-family: IBM Plex Sans, IBM Plex Mono;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;/tmp/tst_exec.sh: Permission denied&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #323232; font-family: IBM Plex Sans, IBM Plex Mono;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;$&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;/tmp/install.dir.[nnnnn]/Linux/resource/jre/bin/java -version&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;/tmp/install.dir.[nnnnn]/Linux/resource/jre/bin/java:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; letter-spacing: 0.16px;&quot;&gt;: Permission denied&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;h2 style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; text-align: left; vertical-align: baseline;&quot;&gt;Cause #1&lt;/h2&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/tmp mount point is mounted without execute permission for security reason (checks /etc/fstab with value noexec).&lt;/div&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;It is confirmed by tst_exec.sh that created above that it failed to run&lt;/div&gt;&lt;h2 style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; text-align: left; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h2&gt;&lt;h2 style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; text-align: left; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;Cause #2&lt;/span&gt;&lt;/h2&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;A wrong installer for other OS is downloaded.&amp;nbsp; For Intel Linux, you should expect following output&lt;/div&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$ file analytics-installer-3.6.46-linuxx86.bin&lt;/div&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;analytics-installer-3.6.46-linuxx86.bin: data&lt;/div&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Following is expected for Intel x86 64-bit Linux&lt;/div&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-size: medium; letter-spacing: 0.16px;&quot;&gt;$&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-size: medium; letter-spacing: 0.16px;&quot;&gt;file /tmp/install.dir.*/Linux/resource/jre/bin/java&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-size: medium; letter-spacing: 0.16px;&quot;&gt;/tmp/install.dir.15939/Linux/resource/jre/bin/java&lt;/span&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;: ELF 64-bit LSB shared object, &lt;b&gt;x86-64&lt;/b&gt;, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-size: medium; letter-spacing: 0.16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;border: 0px; box-sizing: border-box; color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-feature-settings: inherit; font-kerning: inherit; font-optical-sizing: inherit; font-size: 16px; font-stretch: inherit; font-variant-alternates: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; font-variation-settings: inherit; letter-spacing: 0.16px; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Following is for PowerPC Linux, not Intel x86&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #323232; font-family: IBM Plex Sans, IBM Plex Mono;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;$&amp;nbsp;file /tmp/install.dir.*/Linux/resource/jre/bin/java&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #323232; font-family: IBM Plex Sans, IBM Plex Mono;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;/tmp/install.dir.15939/Linux/resource/jre/bin/java: ELF 64-bit LSB executable, 64-bit &lt;b&gt;PowerPC &lt;/b&gt;or cisco 7500, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=c07e00748dd7b5ca30b6feb0e2d7c911cec024d7, not stripped&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #323232; font-family: IBM Plex Sans, IBM Plex Mono;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: #323232; font-family: IBM Plex Sans, IBM Plex Mono;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;h2 style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px; text-align: left;&quot;&gt;Resolving the Problem&lt;/h2&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;Option #1: Identify a directory that user is allow to run the installer program, i.e. java.&amp;nbsp; Specify Cognos installer OS environment variable IATEMPDIR to that location before execute the installer&lt;/div&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;$ export IATEMPDIR=~/tmp&lt;/div&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;$&amp;nbsp;analytics-installer-3.6.46-linuxx86.bin&lt;/div&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;Option #2: Coordinate with Linux SA to remove &quot;noexec&quot; from /etc/fstab, or provides another mount point that doesn&#39;t contain &quot;noexec&quot; security option. Assumes the mount point is called /tmp2, then set&amp;nbsp;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;Cognos installer OS environment variable IATEMPDIR to that mount point before execute the installer&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;&lt;span style=&quot;letter-spacing: 0.16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #323232; font-family: &amp;quot;IBM Plex Sans&amp;quot;, &amp;quot;IBM Plex Mono&amp;quot;; font-size: 16px; letter-spacing: 0.16px;&quot;&gt;&lt;div style=&quot;letter-spacing: 0.16px;&quot;&gt;$ export IATEMPDIR=/tmp2&lt;/div&gt;&lt;div style=&quot;letter-spacing: 0.16px;&quot;&gt;$&amp;nbsp;analytics-installer-3.6.46-linuxx86.bin&lt;/div&gt;&lt;div style=&quot;letter-spacing: 0.16px;&quot;&gt;&lt;br style=&quot;letter-spacing: 0.16px;&quot; /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/6519760574528968443/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/6519760574528968443' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/6519760574528968443'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/6519760574528968443'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2023/05/cognos-analytics-111x-112x-installer.html' title='Cognos Analytics 11.1.x - 11.2.x - Installer failed with JRE libraries missing or not compatible'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-5685458871331229651</id><published>2023-02-27T09:18:00.007-05:00</published><updated>2023-02-27T10:07:07.408-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Oracle"/><title type='text'>Oracle Timezone: Clarification of 2 Timezone Setting</title><content type='html'>&lt;p&gt;Product: Oracle Database&lt;br /&gt;Version: All&lt;br /&gt;OS: All&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;History&lt;/h2&gt;&lt;p&gt;Many years ago, Oracle database relies on OS clock, as well as no date column type that can store timezone setting (similar to MS SQL Server today).&lt;/p&gt;&lt;p&gt;Timezone aware column type, TIMESTAMP WITH TIME ZONE, introduced much later, but many DBA and developers don&#39;t have a good knowledge about OS timezone.&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Date DB Function&lt;/h2&gt;&lt;div&gt;In Oracle 12c to 21c, DB has following 4 date functions, which has different behavior on timezone&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;sysdate - Uses OS timezone&lt;/li&gt;&lt;ul&gt;&lt;li&gt;E.g. select sysdate from dual;&lt;/li&gt;&lt;li&gt;E.g. insert into [user table] values (sysdate);&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;systimestamp - Uses OS timezone&lt;/li&gt;&lt;ul&gt;&lt;li&gt;E.g. select systimestamp from dual;&lt;/li&gt;&lt;li&gt;E.g. insert into [user table] values (systimestamp);&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;current_date - uses DB session timezone, similar to sysdate&lt;/li&gt;&lt;ul&gt;&lt;li&gt;E.g. select sessiontimezone&amp;nbsp;from dual;&lt;/li&gt;&lt;li&gt;E.g. insert into [user table] values (sessiontimezone);&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;LOCALTIMESTAMP&lt;/li&gt;&lt;li&gt;&amp;nbsp;- uses DB session timezone, similar to systimestamp&lt;/li&gt;&lt;ul&gt;&lt;li&gt;E.g. select sessiontimezone&amp;nbsp;from dual;&lt;/li&gt;&lt;li&gt;E.g. insert into [user table] values (sessiontimezone);&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Timezone Configuration At DB Level&lt;/h2&gt;&lt;div&gt;I won&#39;t discuss OS timezone configuration, as this post is mainly clarifying DB level timezone setting that confused many DBA or developers.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;In above DB functions, the DB session&#39;s timezone depends on sessiontimezone. Default is DB timezone, which set by following:&lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;ALTER DATABASE SET TIME_ZONE = &#39;US/New_York&#39;;&lt;/li&gt;&lt;li&gt;CREATE DATABASE ..... TIME_ZONE = &#39;US/New_York&#39;;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;At user level, you can configure it using&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;/li&gt;&lt;li&gt;ALTER SESSION SET TIME_ZONE=&#39;US/Eastern&#39;;&lt;/li&gt;&lt;/ul&gt;You can check its current value by using:&lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;sessiontimezone - uses DB session timezone, similar to sysdate&lt;/li&gt;&lt;ul&gt;&lt;li&gt;E.g. select sessiontimezone&amp;nbsp;from dual;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Troubleshooting Highlight&lt;/h2&gt;&lt;div&gt;When verifying it, always display the sessiontimezone together with 1 systimestamp, and 1 current_date, e.g.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;select sessiontimezone , sysdate, current_date from dual;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This will ensure that you cover both OS and DB timezone, and displaying DB timezone value&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Note:&amp;nbsp;systimestamp will display OS timezone value&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ref: Oracle 19c DB Time Functions:&amp;nbsp;https://docs.oracle.com/en/database/oracle/oracle-database/19/nlspg/datetime-data-types-and-time-zone-support.html&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/5685458871331229651/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/5685458871331229651' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/5685458871331229651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/5685458871331229651'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2023/02/oracle-timezone-clarification-of-2.html' title='Oracle Timezone: Clarification of 2 Timezone Setting'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-6314445771911054604</id><published>2023-01-27T12:00:00.005-05:00</published><updated>2023-01-27T12:00:51.683-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="oracle database"/><title type='text'>Oracle No more data to read from socket</title><content type='html'>&lt;p&gt;Product: Oracle Database&lt;br /&gt;Version: All&lt;/p&gt;&lt;p&gt;I often found from StackOverflow.com that people are posting following error from their application:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;background-color: white; color: #1d1c1d; font-family: Slack-Lato, Slack-Fractions, appleLogo, sans-serif; font-size: 15px; font-variant-ligatures: common-ligatures;&quot;&gt;No more data to read from socket&lt;/span&gt;&lt;br style=&quot;background-color: white; box-sizing: inherit; color: #1d1c1d; font-family: Slack-Lato, Slack-Fractions, appleLogo, sans-serif; font-size: 15px; font-variant-ligatures: common-ligatures;&quot; /&gt;&lt;/p&gt;&lt;p&gt;The application could be Java, Springframework, etc, and they often blame the application problem, as the error is captures by the application, e.g. Java application/daemon.&lt;/p&gt;&lt;p&gt;Often people will suggest possible cause, or possible resolution.&amp;nbsp; Some people will even suggest not related resolution which confused the entire IT community.&lt;/p&gt;&lt;p&gt;The full Oracle error is below:&lt;/p&gt;&lt;p&gt;ORA-17410 No more data to read from socket&lt;/p&gt;&lt;p&gt;There are several possible causes, but many people don&#39;t put when each is applicable.&amp;nbsp; The issue is 100% not due to the application, but problem with the infrastructure (network) or Oracle database:&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Cause #1: Intermittent Network issue&lt;/h2&gt;&lt;p&gt;Behavior #1: Application will fail with this error intermittently&lt;/p&gt;&lt;p&gt;Behavior #2: Point of failure will be random, and won&#39;t be in the same table/index/SELECT SQL, as network failure is intermittent&lt;/p&gt;&lt;p&gt;Behavior #3: Program should failed when pull data into the application, such as SELECT, but should not fail with CREATE TABLE, CREATE INDEX, DELETE, DROP, ALTER&lt;/p&gt;&lt;p&gt;Behavior #4: Any application will be affected by intermittent network issue, instead of just 1 application&lt;/p&gt;&lt;p&gt;Behavior #5: Perform a few GB size file transfer between the application and remote DB server to simulate intermittent network issue. The duration must be longer than the SQL execution time. E.g. if it is running a SELECT that take 5 min (then failed), then the file transfer time must be more than 5 min, such as 10 min. So the test is not actually based on file size, but file x&#39;fer time that last as long as the failed SQL&lt;/p&gt;&lt;p&gt;Problem Simulation: Simulate a 5 - 30 min long file transfer to confirm the issue is network related. The source and target server used to simulate file transfer must include the application server with the remote DB server&lt;/p&gt;&lt;p&gt;Workaround: Once confirmed, you can move the DB and application into the same machine to eliminate network issue.&amp;nbsp; The network admin can take longer time to provide a permanent workaround&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Cause #2: Intermittent DB Failure&lt;/h2&gt;&lt;p&gt;Behavior #1: Application could fail with this error randomly or consistently&lt;/p&gt;&lt;p&gt;Behavior #2: Oracle alert log will contain more detail error message&lt;/p&gt;&lt;p&gt;Behavior #3: Oracle alert log could throw ORA-00600 that DBA needs to raise ticket with Oracle Support due to DB patch/bug&lt;/p&gt;&lt;p&gt;Behavior #4: Even putting both application and Oracle database into the same machine, this error will continue to exists intermittently&lt;/p&gt;&lt;p&gt;Problem Simulation: Capture the failed SQL, and run it manually using SQL Developer or sqlplus.&amp;nbsp; You might need to create a shell script (PowerShell for Windows) to run it few 1000s time and last for 1 hr to simulate the error&lt;/p&gt;&lt;p&gt;Workaround #1: If it is ORA-00600 Oracle error, then try it with higher or lower Oracle database version as temporary workaround. There are potential Oracle bug that affect specific version and patch.&lt;/p&gt;&lt;p&gt;Workaround #2: There could be other OS issue that affected the Oracle database. Move Oracle database to another different machine (OS)&lt;/p&gt;&lt;p&gt;Workaround #3: Check RAM and storage to ensure no low storage, or extremely high RAM usage when the application hitting the error&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Cause #3: Wrong JDBC driver&lt;/h2&gt;&lt;p&gt;Behavior #1: Java application consistently failed and not intermittent&lt;/p&gt;&lt;p&gt;Problem Simulation: Create a simple Java program and run the same SQL by using the exact JDBC driver.&amp;nbsp; This should consistently failed&lt;/p&gt;&lt;p&gt;Workaround: Replace the Oracle JDBC driver with Oracle&#39;s&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Cause #4: Special data or table structure that is not supported&lt;/h2&gt;&lt;p&gt;Behavior #1: Application is creating table, or inserting data that is more advance, e.g. Spatial.&amp;nbsp; The program will consistently failed for the same SQL&lt;/p&gt;&lt;p&gt;Behavior #2: This is not intermittent.&amp;nbsp; If you think it is intermittent, then capture all the of failed SQL, and look for the pattern.&amp;nbsp; They must use some special data type that is &lt;b&gt;not &lt;/b&gt;varchar2, number, date, long, clob, blob, function, partition&lt;/p&gt;&lt;p&gt;Problem Simulation: Capture the SQL, and create a simple Java program to run the same SQL. The Java program will consistently fail&lt;/p&gt;&lt;p&gt;Workaround #1: Rewrite the Java program on this SQL.&amp;nbsp; It could be wrong Java object that is not compatible&lt;/p&gt;&lt;p&gt;Workaround #2: Very old JDBC driver that doesn&#39;t support that new feature can be another cause.&amp;nbsp; Replace with newer Oracle JDBC driver&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;Cause #5: Firewall Timeout - idle connection clearing&lt;/h2&gt;&lt;div&gt;Behavior #1: Some enterprise firewall can forcefully close idle connection, and leads to long running SQL&#39;s DB connection will dropped by firewall server after it hit its idle timeout value&lt;/div&gt;&lt;div&gt;Behavior #2: Find out the time between connection dropped and SQL is fired.&amp;nbsp; The time is constant, such as 30 sec&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Workaround #1: Network admin to review the firewall rule, and exclude TCP port 1521 connection to &amp;amp; from Oracle database server&lt;/div&gt;&lt;div&gt;&lt;p&gt;Workaround: Replace the Oracle JDBC driver with Oracle&#39;s&lt;/p&gt;&lt;h2&gt;Cause #6: Router Timeout - idle connection clearing&lt;/h2&gt;&lt;div&gt;Behavior #1: Some enterprise router can forcefully close idle connection, and leads to long running SQL&#39;s DB connection will dropped by firewall server after it hit its idle timeout value&lt;/div&gt;&lt;div&gt;Behavior #2: Find out the time between connection dropped and SQL is fired.&amp;nbsp; The time is constant, such as 30 sec&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Workaround #1: Network admin to review the router&amp;nbsp;rule, and exclude TCP port 1521 connection to &amp;amp; from Oracle database server&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/6314445771911054604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/6314445771911054604' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/6314445771911054604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/6314445771911054604'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2023/01/oracle-no-more-data-to-read-from-socket.html' title='Oracle No more data to read from socket'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-630668267578091970</id><published>2022-12-13T10:09:00.003-05:00</published><updated>2022-12-13T10:09:44.955-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Oracle"/><title type='text'>Oracle: ORA-01555: snapshot too old Tuning</title><content type='html'>&lt;p&gt;Product: Oracle Databse&lt;br /&gt;Version: 9.0.0 - 18.0&lt;/p&gt;&lt;p&gt;Since Oracle Database 9i, many DBA have been keeping UNDO_MANAGEMENT=AUTO setting, and developers/support often encountered following UNDO related error on long running SQL&lt;/p&gt;&lt;pre class=&quot;c-mrkdwn__pre&quot; data-stringify-type=&quot;pre&quot; style=&quot;--saf-0: rgba(var(--sk_foreground_low,29,28,29),0.13); border-radius: 4px; border: 1px solid var(--saf-0); box-sizing: inherit; color: #1d1c1d; counter-reset: list-0 0 list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; font-family: Monaco, Menlo, Consolas, &amp;quot;Courier New&amp;quot;, monospace !important; font-size: 12px; font-variant-ligatures: none; line-height: 1.50001; margin-bottom: 4px; margin-top: 4px; overflow-wrap: break-word; padding: 8px; tab-size: 4; white-space: pre-wrap; word-break: normal;&quot;&gt;Oracle &amp;lt;ORCL&amp;gt; error message for operation &amp;lt;OCIStmtExecute&amp;gt;: &amp;lt;ORA-12801: error signaled in parallel query server P07G
ORA-01555: snapshot too old: rollback segment number 271 with name &quot;_SYSSMU271_3009956035$&quot; too small&amp;gt;.&lt;/pre&gt;&lt;p&gt;If DBA don&#39;t study Oracle documentation on &quot;Automatic Tuning of Undo Retention&quot; but simply search Google/Internet for answer, then they often comes to following incorrect workaround:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Increase UNDO_RENTENTION time - no change in the long running SQL&lt;/li&gt;&lt;li&gt;Modify code to split the long running SQL to have several shorter running SQL, e.g. store into intermedia table, then select from the intermedia table&lt;/li&gt;&lt;li&gt;Asks developer to tune the long running SQL to run faster, e.g. create index, don&#39;t select unnecessary columns, filter out unrequired data (more WHERE criteria)&lt;/li&gt;&lt;li&gt;Don&#39;t insert/update/delete on the table that the long running SQL is SELECTing&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;So what does DBA missed in above analysis is he/she only focus in ORA-01555 error without considering the rest of the message.&amp;nbsp; Following are the things that DBA missed:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Parallel query server is enabled&lt;/li&gt;&lt;li&gt;Above PQ number is P07G with starting number as P000&lt;/li&gt;&lt;li&gt;Number of concurrent running SQL that that point of time, without considering Parallel query server (excludes parallel query coordination and slave)&lt;/li&gt;&lt;li&gt;Size of the UNDO tablespace, which could be few TB in size, and bigger than entire DB size&lt;/li&gt;&lt;li&gt;UNDO tablespace&#39;s dbf files are not in auto extend mode&lt;/li&gt;&lt;li&gt;Even if UNDO dbf files are in auto extend mode, it hit max dbf file size&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;As the result, tuning UNDO_RETENTION or even increase the size of UNDO dbf to 300GB larger doesn&#39;t resolve the issue.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The resolution is in fact totally not related to modify UNDO_RETENTION.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Post your comment if you want to know the answer, as I want to know how many visitors are actually reading my blog post&lt;/div&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/630668267578091970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/630668267578091970' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/630668267578091970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/630668267578091970'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2022/12/oracle-ora-01555-snapshot-too-old-tuning.html' title='Oracle: ORA-01555: snapshot too old Tuning'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-8143142514634144415</id><published>2022-05-30T16:44:00.006-04:00</published><updated>2022-05-30T16:44:57.032-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SAP Data Services"/><title type='text'>SAP Data Services Job Server - SSL Configuration</title><content type='html'>&lt;p&gt;Product: SAP Data Services&lt;br /&gt;Component: JobServer&lt;br /&gt;Version: 4.2SP0 - 4.2SP14&lt;br /&gt;OS: Windows&lt;/p&gt;&lt;p&gt;SAP Doc #1:&amp;nbsp;https://help.sap.com/docs/SAP_DATA_SERVICES/2d2abbb0fab34071a4c53b7de873241b/571a69626d6d1014b3fc9283b0e91070.html?locale=en-US&lt;/p&gt;&lt;p&gt;SAP Doc #2:&amp;nbsp;https://help.sap.com/docs/SAP_DATA_SERVICES/e54136ab6a4a43e6a370265bf0a2d744/571dc02c6d6d1014b3fc9283b0e91070.html?locale=en-US&amp;amp;version=4.2.8&lt;/p&gt;&lt;p&gt;SAP Doc #3:&amp;nbsp;https://help.sap.com/docs/SAP_DATA_SERVICES/e54136ab6a4a43e6a370265bf0a2d744/571db2eb6d6d1014b3fc9283b0e91070.html?locale=en-US&amp;amp;version=4.2.8&lt;/p&gt;&lt;p&gt;SAP has a relatively poor documentation about custom SSL certificate setup for BODS Data Services, which is Job Server.&amp;nbsp; They break it into several different chapters and failed to leverage &quot;Related information&quot; section to help customer to bridge the information together.&lt;/p&gt;&lt;p&gt;There are 2 main directories, and 1 tool (Data Services Server Manager in Windows, and svrcfg in Linux) to configure the SSL certificate:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;%LINK_DIR%\ssl\server&lt;/li&gt;&lt;li&gt;%LINK_DIR%\ssl\trusted_certs&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;The most common mistaken about SSL certificate is that administrator failed to read SAP&#39;s doc that their program only recognize PEM format SSL certificate (there are DER, PKCS12 that are common).&lt;/p&gt;&lt;p&gt;Let me list down a list of files and directory of each, which is applicable to both self-signed, or paid SSL cert:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Custom root CA SSL cert &amp;gt; %LINK_DIR%\ssl\trusted_certs&lt;/li&gt;&lt;li&gt;Custom root CA SSL cert private key, password file &amp;gt; not required&lt;/li&gt;&lt;li&gt;Custom intermediate #1 CA SSL cert &amp;gt; %LINK_DIR%\ssl\trusted_certs&lt;/li&gt;&lt;li&gt;Custom intermediate #1 CA SSL cert private key, password file&lt;/li&gt;&lt;li&gt;Custom intermediate #2 CA SSL cert &amp;gt; %LINK_DIR%\ssl\trusted_certs&lt;/li&gt;&lt;li&gt;Custom intermediate #2 CA SSL cert private key, password file&lt;/li&gt;&lt;li&gt;Custom intermediate #3 CA SSL cert &amp;gt; %LINK_DIR%\ssl\trusted_certs&lt;/li&gt;&lt;li&gt;Custom intermediate #3 CA SSL cert private key, password file&lt;/li&gt;&lt;li&gt;Custom BODS server SSL cert &amp;gt; %LINK_DIR%\ssl\server&lt;/li&gt;&lt;li&gt;Custom BODS server SSL cert private key &amp;gt; %LINK_DIR%\ssl\server&lt;/li&gt;&lt;li&gt;Custom BODS server SSL cert password file &amp;gt; %LINK_DIR%\ssl\server&lt;/li&gt;&lt;li&gt;There is no SSL certificate keystore for Job Server configuration&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;There are several catch that SAP document doesn&#39;t cover, as well as misleading info in SAP KB:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;%LINK_DIR%\ssl\trusted_certs can contains additional SSL certs files&lt;/li&gt;&lt;li&gt;%LINK_DIR%\ssl\trusted_certs cannot contains other files that are not SSL cert files, or it will complain error &quot;Unable to load verify locations&quot;&lt;/li&gt;&lt;li&gt;If %LINK_DIR%\ssl\trusted_certs contains private key PEM file, Server Manager will complain error &quot;Unable to load verify locations&quot; as the same reason explained in #2 above&lt;/li&gt;&lt;li&gt;%LINK_DIR%\ssl\trusted_certs can contains unused SSL certs, such as put new self-signed or paid cert files together with OOTB self-signed cert files&lt;/li&gt;&lt;li&gt;SSL cert that is V1 or V3 are both accepted&lt;/li&gt;&lt;li&gt;SSL cert that is RSA 1024-bit or 4096-bit are all accepted&lt;/li&gt;&lt;li&gt;The program is not able to produce meaningful log, and no way to enable debugging log&lt;/li&gt;&lt;li&gt;The openssl command in SAP&#39;s doc implies to generate PEM format certificate, but that command is actually generates &quot;certificate request&quot; file, and not the final certificate&lt;/li&gt;&lt;li&gt;SAP document wrote to put all the signed SSL certs into &quot;%LINK_DIR%\ssl\trusted_certs&quot; but you just need to put the root, intermediate, and parent SSL certs into it (as PEM format)&lt;/li&gt;&lt;li&gt;You can have SSL file extension other than crt: crt, cer, pem&lt;/li&gt;&lt;li&gt;The SSL cert that issue to BODS server should put under %LINK_DIR%\ssl\server directory, which SAP doc failed to mention.&amp;nbsp; This is for consistency of their design, and won&#39;t break application functionality.&amp;nbsp; I recommend to keep existing architecture instead of follow their doc&lt;/li&gt;&lt;li&gt;In Data Services Server Manager &amp;gt; SSL tab, configures&lt;/li&gt;&lt;ol&gt;&lt;li&gt;Server certificate file: Location of the PEM SSL cert file that issued to this BODS server.&amp;nbsp; It should be in&amp;nbsp;&amp;nbsp;%LINK_DIR%\ssl\server directory&lt;/li&gt;&lt;li&gt;Server private key file: Part 2/3 file for above SSL cert. It should be PEM format, and located in same dir as above&lt;/li&gt;&lt;li&gt;Use Server private key password file: Recommends to has a password file for above SSL cert.&amp;nbsp; Recommends to keep in same dir as above&lt;/li&gt;&lt;li&gt;Trusted certificates folder: No need to change, but ensures copy all the root and intermediate cert files into dir %LINK_DIR%\ssl\trusted_certs (default).&amp;nbsp; You do not need to change this location&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;div&gt;You can use both Windows, or bundled openssl utility to convert SSL certificate to PEM format that recognized by BODS.&amp;nbsp; PEM format file is ASCII file, which you can open it up in text editor to confirm that it is not binary file.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Following is openssl command to convert DER format SSL cert file to PEM format:&lt;/div&gt;&lt;div&gt;%LINK_DIR%\bin\&lt;b&gt;openssl &lt;/b&gt;x509 -&lt;b&gt;inform &lt;/b&gt;DER -&lt;b&gt;in &lt;/b&gt;custom.cert1.crt -&lt;b&gt;out &lt;/b&gt;custom.cert1.pem.crt&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;span&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/span&gt;&lt;div&gt;Error: Not able to read the specified certificate file error BODI-320039&lt;/div&gt;&lt;p&gt;SAP Note 2287520 - Not able to read the specified certificate file error BODI-320039&lt;br /&gt;https://launchpad.support.sap.com/#/notes/2287520&lt;br /&gt;Cause: cer file generated by Microsoft CA was not in the format Data Services expects&lt;br /&gt;Resolution: Regenerate the cer file in correct format as per Administrator Guide. Internet Explorer may be able to open the cer file properly but check from application like notepad the correct format expected by DataServices contains &quot;BEGIN CERTIFICATE&quot;&lt;/p&gt;&lt;div&gt;My comment: Data Services only recognize PEM format SSL cert, but not DER or PKCS12 format even the file has cer, crt, or PEM extension.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;span&gt;&lt;!--more--&gt;&lt;/span&gt;&lt;div&gt;Error: Unable to load verify locations&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;SAP Note 2409684 - Error: Unable to load verify locations is prompted when making changes in Data Service Server Manager&lt;/div&gt;&lt;p&gt;URL: https://launchpad.support.sap.com/#/notes/2409684&lt;br /&gt;Cause: You have unnecessary certificates under trusted_certs which are 3rd party products(Coupa and GoDaddy). They were saved into the Data Server SSL folder&lt;br /&gt;Resolution: Move the 3rd party SSL certificates to a different location&lt;/p&gt;&lt;div&gt;My comment: %LINK_DIR%\ssl\trusted_certs can contains any 3rd party SSL certificates, as well as unused, or inactive, or extra, or duplicate, or expired SSL certificates.&amp;nbsp; It can contains non-PEM format SSL as well.&amp;nbsp; Above error is not due to additional SSL certificate.&lt;/div&gt;&lt;div&gt;My resolution: Ensures the directory only contains SSL certificate, but no other files, such as private key, or password file&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/8143142514634144415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/8143142514634144415' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/8143142514634144415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/8143142514634144415'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2022/05/sap-data-services-job-server-ssl.html' title='SAP Data Services Job Server - SSL Configuration'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5829191550601027073.post-5048934773012173694</id><published>2022-02-03T12:52:00.017-05:00</published><updated>2023-05-17T12:41:47.999-04:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><title type='text'>Powershell: List AD Group for Specific User and Domain</title><content type='html'>&lt;p&gt;Product: Windows&lt;br /&gt;Utility: Powershell, ActiveDirectory&lt;/p&gt;&lt;p&gt;Windwos AD domain users who are not administrator of ActiveDirectory users are often getting confusing push back from AD admin when the business users are requesting for access that controlled by AD.&lt;/p&gt;&lt;p&gt;This article is going to show various commands that business users (end users) who are not AD admin, and allows them to find out which AD group they belongs to directly, or indirectly (Windows term if group nesting).&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;CMD&lt;/h2&gt;&lt;p&gt;Following command will display all the nesting group that a user belongs to&lt;/p&gt;&lt;p&gt;1. net user &amp;lt;username&amp;gt; /domain&lt;/p&gt;&lt;p&gt;Limitation #1: You cannot change the domain, if the computer you login to belongs to multiple domain&lt;/p&gt;&lt;p&gt;Limitation #2: Doesn&#39;t show child groups. It will always display direct groups the user belongs to&lt;/p&gt;&lt;p&gt;Limitation #3: Display &quot;Description&quot; name of the group, not the actual group name&lt;/p&gt;&lt;p&gt;Limitation #4: Group name is truncated after 21 characters&lt;/p&gt;&lt;p&gt;2. gpresult /v&lt;/p&gt;&lt;p&gt;Limitation #1: can&#39;t specify which domain if you belongs to multiple AD domain&lt;/p&gt;&lt;p&gt;Limitation #2: Cannot show direct group. It will always display nesting child groups&lt;/p&gt;&lt;p&gt;3. whoami /groups&lt;/p&gt;&lt;p&gt;Limitation #1: can&#39;t specify which domain if you belongs to multiple AD domain&lt;/p&gt;&lt;p&gt;Limitation #2: Cannot show direct group. It will always display nesting child groups&lt;/p&gt;&lt;h2 style=&quot;text-align: left;&quot;&gt;PowerShell&lt;/h2&gt;&lt;div&gt;Note: Windows 10 - 11 required to use Settings &amp;gt; Optional features to add module &quot;RSAT: Active Directory Domain Services and Lightweight Directory Services Tools&quot;&lt;/div&gt;&lt;p&gt;1. Show AD group the current login user directly belongs to:&lt;/p&gt;&lt;p&gt;(Get-ADuser $env:username -server $env:userdomain -Properties memberof).memberof | get-adgroup -server $env:userdomain | select-object -ExpandProperty name&lt;/p&gt;&lt;p&gt;Limitation #1: It cannot show nesting group&lt;/p&gt;&lt;p&gt;1.1. Show AD group of username tester1&lt;/p&gt;&lt;p&gt;(Get-ADuser&amp;nbsp; &lt;b&gt;tester1&lt;/b&gt; -server $env:userdomain -Properties memberof).memberof |&amp;nbsp; get-adgroup -server $env:userdomain | select-object -ExpandProperty name&lt;/p&gt;&lt;p&gt;1.2. Similar to above, but sorted&lt;/p&gt;&lt;p&gt;(Get-ADuser&amp;nbsp;&amp;nbsp;tester1&amp;nbsp;-server $env:userdomain -Properties memberof).memberof |&amp;nbsp; get-adgroup -server $env:userdomain | select-object -ExpandProperty name | &lt;b&gt;sort&lt;/b&gt;&lt;/p&gt;&lt;p&gt;2. Show AD group user in specific domain, e.g. domain GAME-ADM&lt;/p&gt;&lt;p&gt;(Get-ADuser $env:username -server &lt;i&gt;GAME-ADM&lt;/i&gt;&amp;nbsp;-Properties memberof).memberof | get-adgroup -server GAME-ADM&amp;nbsp;| select-object name&lt;/p&gt;&lt;p&gt;3. Show AD group user GAMER1 in domain GAME-ADM&lt;/p&gt;&lt;p&gt;(Get-ADuser &lt;i&gt;GAMER1&amp;nbsp;&lt;/i&gt;-server&amp;nbsp;&lt;i&gt;GAME-ADM&lt;/i&gt;&amp;nbsp;-Properties memberof).memberof | get-adgroup -server &lt;i&gt;GAME-ADM&lt;/i&gt;&amp;nbsp;| select-object -ExpandProperty&amp;nbsp;name&lt;/p&gt;&lt;p&gt;4. Show AD group is &lt;u&gt;managed by who&lt;/u&gt;&lt;/p&gt;&lt;p&gt;General syntax: Get-ADGroup [group name] -server [domain name] -properties ManagedBy&lt;/p&gt;&lt;p&gt;Example: group name GAMEVIPUSR, domain name GAME-ADM, the command will be&lt;/p&gt;&lt;p&gt;Get-ADGroup &lt;i&gt;GAMEVIPUSR &lt;/i&gt;-server &lt;i&gt;GAME-ADM&amp;nbsp;&lt;/i&gt;-properties &lt;b&gt;ManagedBy&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Get-ADGroup&amp;nbsp;&lt;i&gt;GAMEVIPUSR&amp;nbsp;&lt;/i&gt;-server&amp;nbsp;$env:userdomain -properties&amp;nbsp;&lt;b&gt;ManagedBy&lt;/b&gt;&lt;/p&gt;&lt;div&gt;5. Show members belong to AD group SAP-ADMIN&lt;/div&gt;&lt;p&gt;Get-ADGroupMember &lt;b&gt;SAP-Admins&amp;nbsp;&lt;/b&gt; -server $env:userdomain | select-object -ExpandProperty name&lt;/p&gt;&lt;p&gt;6. Similar to #5, but don&#39;t display user. Only display child AD group that belongs to it&lt;/p&gt;&lt;p&gt;Get-ADGroupMember&amp;nbsp;&lt;b&gt;SAP-Admins&amp;nbsp;&lt;/b&gt;&amp;nbsp;-server $env:userdomain | where-object objectClass -ne &quot;user&quot; | select-object -ExpandProperty name&lt;/p&gt;&lt;p&gt;7. Show a child group TESTER-GRP belongs to which parent group&lt;/p&gt;&lt;p&gt;Get-ADPrincipalGroupMembership GWRE-CASE-DataManagement -server $env:userdomain | select-object -ExpandProperty name&lt;/p&gt;&lt;p&gt;8. Show a child group TESTER-GRP belongs to which parent group like &quot;PROD*&quot; and not case-sensitive&lt;/p&gt;&lt;p&gt;Get-ADPrincipalGroupMembership GWRE-CASE-DataManagement -server $env:userdomain | | where name -match &quot;PROD*&quot; | select-object -ExpandProperty name&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://singcheong.blogspot.com/feeds/5048934773012173694/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5829191550601027073/5048934773012173694' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/5048934773012173694'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5829191550601027073/posts/default/5048934773012173694'/><link rel='alternate' type='text/html' href='http://singcheong.blogspot.com/2022/02/powershell-list-ad-group-for-specific.html' title='Powershell: List AD Group for Specific User and Domain'/><author><name>SC</name><uri>http://www.blogger.com/profile/07381143682989190248</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>