Monday, September 9, 2024

Windows Application not showing up on search

 https://www.lifewire.com/fix-windows-10-search-4176188

Wednesday, August 28, 2024

Oracle Password Complexity function

 CREATE OR REPLACE function SYS.ora_dex_verify_function

 ( username     varchar2,

   password     varchar2,

   old_password varchar2)

 return boolean IS

   differ  integer;

   lang    varchar2(512);

   message varchar2(512);

   ret     number;

   last_change sys.user$.ptime%type; --DAV4635 minimum_age

   minimum_age number :=1;--DAV4635 minimum_age


begin

   -- Get the cur context lang and use utl_lms for messages- Bug 22730089

   lang := sys_context('userenv','lang');

   lang := substr(lang,1,instr(lang,'_')-1);


   if not ora_complexity_check(password, chars => 8, uppercase => 1,

                           lowercase => 1, digit => 1, special => 1) then

      return(false);

   end if;


   -- Check if the password differs from the previous password by at least

   -- 8 characters

   if old_password is not null then

      differ := ora_string_distance(old_password, password);

      if differ < 4 then

         ret := utl_lms.get_message(28211, 'RDBMS', 'ORA', lang, message);

         raise_application_error(-20000, utl_lms.format_message(message, 'four'));

      end if;


   --DAV4635 minimum_age

  select ptime into last_change from sys.user$ where name=username;

   if sysdate - last_change < minimum_age then

raise_application_error(-20010, 'Password changed too soon');

return(false);

   --DAV4635 minimum_age

    end if;

  end if;

   return(true);

end;

/

Tuesday, August 6, 2024

How to increase event log retention on windows

Configuring Security Event Log Size and Retention Settings


Security event log size and retention settings can be configured in each computer or configured via a GPO to all target computers.

Local Configuration

  1. Open Run (Start -> Run), type eventvwr.msc
  2. Right click "Security" log(Event Viewer -> Windows Logs -> Security log) and select "Properties"
  3. Configure "Maximum log size" as defined below in the table
  4. Configure "When maximum event log size is reached" retention method for security log to “Overwrite Events As Needed”

GPO Configuration

  1. Open GPMC
  2. Edit the corresponding GPO (FIM on DomainControllersFIM on Member Servers)
  3. Navigate to Computer Configuration → Policies →  Windows Settings → Security Settings →  Event Log
  4. Configure "Maximum security log" size as defined below
  5. Configure "Retention method for security log" to “Overwrite Events As Needed”

Recommended Security Log Size

Role
OS of the target computer
Log size(MB)
Domain Controller
Windows Server 2003
307
Domain Controller
Windows Server 2008 and above
1048
File Server
Windows Server 2003
307
File Server
Windows Server 2008 and above
4194
Member Server
Windows Server 2003
307
Member Server
Windows Server 2008 and above
1048
Workstation
Window XP
307
Workstation
Windows Vista and above
1048

Tuesday, July 23, 2024

How to list drop schema in databricks

 %sql

SELECT event_time, user_identity.email, action_name, request_params
FROM system.access.audit
where action_name='deleteSchema'
AND event_date = current_date()
ORDER BY event_time DESC
LIMIT 100;

Monday, May 20, 2024

SQL SERVER CANNOT LOGIN

  SELECT sp.[name],sp.type_desc

FROM sys.server_principals sp

INNER JOIN sys.server_permissions PERM ON sp.principal_id = PERM.grantee_principal_id

WHERE PERM.state_desc = 'DENY'

Wednesday, May 8, 2024

SQL SERVER list Masked columns details

 select  princ.name

,       princ.type_desc

,       perm.permission_name

,       perm.class_desc

,       object_name(perm.major_id)

,       m.name as "COLUMN NAME"

,       schem.name as "SCHEMA"

from    sys.database_principals princ

left join

        sys.database_permissions perm

on      perm.grantee_principal_id = princ.principal_id

left join sys.masked_columns m

on   perm.major_id=m.object_id

left join sys.schemas schem

on perm.major_id=schem.schema_id

where perm.permission_name='UNMASK';

Thursday, April 11, 2024

How to Restore a Delta Table in Databricks

Scenario.


We will make some updates and inserts on a table. After that, we restore it to its original form.



SELECT * FROM airline_passenger_csv
WHERE Age > 80



%sql
UPDATE airline_passenger_csv
SET Class="Business"
WHERE Age > 80


%sql
INSERT INTO airline_passenger_csv
VALUES(1234567,'Female','Loyal Customer',88,"Personal Travel","Eco",300,0,0, "satisfied")



%sql
DELETE FROM airline_passenger_csv
WHERE _c0=7547


So far we have updated the Class to business class. Added a user and deleted id 7547
to restore we will check the version from the DESC HISTORY airline_passenger_csv.

Below are a few examples on how to flashback queries DELTA TABLES


%sql
SELECT* FROM airline_passenger_csv
TIMESTAMP AS OF '2024-04-12T01:06:51.000+00:00'
WHERE AGE > 80

%sql
SELECT * FROM airline_passenger_csv@v2
WHERE Age > 80

Now let's say we need to restore to v2 of the table
we type
%sql
RESTORE airline_passenger_csv TO VERSION AS OF 2


Monday, March 18, 2024

How to Network Trace

 Network Trace


Disconnect the dedicated pool.


- Start CMD (Run as Admin)

- Start the process: 

netsh trace start capture=yes packettruncatebytes=512 tracefile=%temp%\%computername%_nettrace.etl maxsize=2048 filemode=circular overwrite=yes report=no

- Reproduce the issue.(Try connecting to dedicated pool through SSMS again)

- Stop the process: netsh trace stop