looking for a specific record on a Postgres database

The below script will look for a string in every column of the database. To start off with, Log in to postgres and make sure that you have selected the database.

create a function by running the below script. (copy and paste as it is)

CREATE OR REPLACE FUNCTION search_whole_db(_like_pattern text)
  RETURNS TABLE(_tbl regclass, _ctid tid) AS
$func$
BEGIN
   FOR _tbl IN
      SELECT c.oid::regclass
      FROM   pg_class c
      JOIN   pg_namespace n ON n.oid = relnamespace
      WHERE  c.relkind = 'r'                           -- only tables
      AND    n.nspname !~ '^(pg_|information_schema)'  -- exclude system schemas
      ORDER BY n.nspname, c.relname
   LOOP
      RETURN QUERY EXECUTE format(
         'SELECT $1, ctid FROM %s t WHERE t::text ~~ %L'
       , _tbl, '%' || _like_pattern || '%')
      USING _tbl;
   END LOOP;
END
$func$  LANGUAGE plpgsql;

Now, run the below command, replace ‘mypattern’ with the object you are looking for

SELECT * FROM search_whole_db('mypattern');

Here’s an example:

I am looking for a VM named hosting:57669-1:HTM:Cluster1-Web5 in a vCD database. Below is the output from psql

Type "help" for help.

vcd=# CREATE OR REPLACE FUNCTION search_whole_db(_like_pattern text)
vcd-#   RETURNS TABLE(_tbl regclass, _ctid tid) AS
vcd-# $func$
vcd$# BEGIN
vcd$#    FOR _tbl IN
vcd$#       SELECT c.oid::regclass
vcd$#       FROM   pg_class c
vcd$#       JOIN   pg_namespace n ON n.oid = relnamespace
vcd$#       WHERE  c.relkind = 'r'                           -- only tables
vcd$#       AND    n.nspname !~ '^(pg_|information_schema)'  -- exclude system schemas
vcd$#       ORDER BY n.nspname, c.relname
vcd$#    LOOP
vcd$#       RETURN QUERY EXECUTE format(
vcd$#          'SELECT $1, ctid FROM %s t WHERE t::text ~~ %L'
vcd$#        , _tbl, '%' || _like_pattern || '%')
vcd$#       USING _tbl;
vcd$#    END LOOP;
vcd$# END
vcd$# $func$  LANGUAGE plpgsql;
CREATE FUNCTION
vcd=#
vcd=# SELECT * FROM search_whole_db('hosting:57669-1:HTM:Cluster1-Web5');
  _tbl  | _ctid
--------+-------
 vm_inv | (2,8)
(1 row)

Updating the vCenter Service accounts for vRealize products:

LCM(LifeCycle Manager)

  • Update the credentials there. 

vRops: 

  • Log in to vRops as an admin
  • Browse to Administration>  Solutions >Cloud accounts > Click on the vCenter edit
  • Click on the edit icon for the credentials 
  • Update the password in the field

vRA: 

  • Log into the vRA org URL:  https://vraFQDN/vcac/org/ORG_NAME as the tenant admin or the infrastructure administrator. 
  • navigate to Infrastructure > endpoint > Edit the vCenter endpoint.
  • Update the credentials under the username password
  • Note: If integrated credentials check box is enabled, vRA uses the service account  used in IAAS (domain account)

vRO (embeded and/or External):

  • Navigate to  vRO Https://vRo_ip/vCo
  • Click on “START THE ORCHESTRATOR CLIENT”
  • Login with the administrator account.
  • Navigate to Library>Workflow and search for “Update a vCenter Server instance” workflow.
  • Click on “Update the log-in properties”
  • Fill in the update password for user and click on RUN
  • Note: If you have custom vCenter Certificates, you will need to click on the notification icon (on the left top) and allow follow the “waiting for input prompt”

Log Insight:

  • Navigate to the log insight URL, Switch over to the administration page (from the left top)
  • Under integration, click on vSphere, and click on edit and fill in the password
  • Click on test connection and save (on the top) when done.

Prevent VRA from deleting failed VM’s

on the IAAS run the below

cd " C:\Program Files (x86)\VMware\vCAC\Agents\vCenter"
DynamicOps.Vrm.VRMencrypt.exe VRMAgent.exe.config get

DynamicOps.Vrm.VRMencrypt.exe VRMAgent.exe.config set doDeletes FALSE

output

C:\Program Files (x86)\VMware\vCAC\Agents\vCenter>DynamicOps.Vrm.VRMencrypt.exe VRMAgent.exe.config get
  managementEndpointName: vCenter
  doDeletes: FALSE

vRops 8, Exclude Specific host

Login to VRops, Click on Administration>Licencing (under management) > edit the product licensing group.

Click next on the “select license keys tab”,

in the “add members” tab, scroll to the bottom and look for “objects always to exclude”

Expand “vCenter adapter”

Expand “host system” and select the host that you wish to exclude

Note: if you wish to deselect everything under the cluster (cascade) then Click on the down arrow next to “add” and select “selected objects and all its descendants”



Click next and finish to complete wizard

Deploying VRA, Setting up MSSQL server errors out with “MS DTC on the IaaS database server is not configured correctly for network access”

IAAS.ntitta.in (SQL Server: db.ntitta.in)
(10032) The MS DTC on the IaaS database server is not configured correctly for network access. If the servers that host MSDTC have been cloned their CID might not be unique (located in HKEY_CLASSES_ROOT/CID) thus causing this issue. To regenerate its CID values the MSDTC must be reinstalled. Details: The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025) Details: The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)
IAAS.ntitta.in\WEB
(10032) The MS DTC on the IaaS database server is not configured correctly for network access. If the servers that host MSDTC have been cloned their CID might not be unique (located in HKEY_CLASSES_ROOT/CID) thus causing this issue. To regenerate its CID values the MSDTC must be reinstalled. Details: The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025) Details: The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)
IAAS.ntitta.in\Manager Service
(10032) The MS DTC on the IaaS database server is not configured correctly for network access. If the servers that host MSDTC have been cloned their CID might not be unique (located in HKEY_CLASSES_ROOT/CID) thus causing this issue. To regenerate its CID values the MSDTC must be reinstalled. Details: The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025) Details: The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)

Running through the installation and installation of  MSDTC by following the instructions on KB https://kb.vmware.com/s/article/59422 did not help

in order to resolve this, I checked the component services on both IIAS and the DB server

GO to Start and then search for component services



Component services> Computers> My Computer> Distributed Translation Coordinator>

Right click on Local DTC> Select Properties>Click on security

In my instance, the allow inbound connection was disabled on the SQL instance. enable the allow inbound and hit apply, the wizard will automatically restart the DTC and then re-run the wizard.

Note: All the options as seen below must be enabled in order for the workflow to complete successfully

Re-run the validation and it was successfull: