Monday, November 26, 2018

Power Shell: Remove files, subfolders older than X days

Power Shell: Remove files, subfolders older than X days


1. Power shell script to remove files and subfolders older than 30 days from directory "E:\directory\

Get-ChildItem -path "E:\directory\" -recurse | where-object {$_.LastWriteTime -lt (Get-Date).AddDays(-30)} | Remove-Item -Recurse -Force

2. Schedule script: E:\RemoveFiles.ps1

Action: Start a program
Program: PowerShell.exe
Add arguments (optiona): -ExecutionPolicy Bypass E:\RemoveFiles.ps1

ORACLE RMAN: Delete archivelogs older than X hours batch

ORACLE RMAN: Delete archive logs older than X hours

Oracle, RMAN


1. Create .bat script to start rman script

rman @C:\RMAN_delete.rman


2. Create rman script at location from previous script. Script is deleting archive logs older than hours without prompting.

CONNECT TARGET SYS/SysPassword
RUN
{
DELETE NOPROMPT ARCHIVELOG UNTIL TIME 'sysdate-12/24';
}
EXIT;


3. Schedule .bat script at windows scheduler

4. Additionally setup retention policy at RMAN as below


SAP PU: Delete purchase requisition

SAP PU: Delete purchase requisition

SAP PU ME52


Single requisition

1. Go into ME52
2. Select item and press delete


3. Check deletion at transaction MD04 or SE16N (table: EBAN, deletion indicator not equal to 'X' expample below)



Tuesday, November 20, 2018

SSIS SQL Server Integration Services - convert string to number, replace special characters

SSIS SQL Server Integration Services - convert string to number, replace special characters

Type conversion

    1. Use data conversion component 
    2. Select desired type from data conversion component 

Replace special characters

1. Use delivered column component


2. Use formula expression to replace special charaters f.e REPLACE( [Target qty] , "-","0" )  replaces "-" with 0





SSIS SQL Server Integration Services - limit number of rows

SSIS SQL Server Integration Services - limit number of rows

SSIS Microsoft Sql server

1. Use Row Sampling component from toolbox

2. Double click at Row Sampling component to set number of rows

 3. Set Sampling selected output to redirect selected number of rows

4. Set Sampling unselected output to redirect all rows available




Tuesday, July 24, 2018

Google docs - Google Sheet - Microsoft Excel - remove polish letters from string

Google docs - Google Sheet - remove polish letters from string


Simple formula to remove polish letters from cell.

G.Docs

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Lower(G2);"ą";"a");"ć";"c");"ę";"e");"ł";"l");"ń";"n");"ó";"o");"ś";"s");"ź";"z");"ż";"z")


Excel

=PODSTAW(PODSTAW(PODSTAW(PODSTAW(PODSTAW(PODSTAW(PODSTAW(PODSTAW(PODSTAW(LITERY.MAŁE(G2);"ą";"a");"ć";"c");"ę";"e");"ł";"l");"ń";"n");"ó";"o");"ś";"s");"ź";"z");"ż";"z")

Monday, March 26, 2018

SAP BW - Object requested is currently locked by user

SAP BW - Object requested is currently locked by user


SAP BW, SAP


1. Go to SM12, view list with desired username

2. Select all by CTRL + A

3. Delete locks

Problem with database open ORA-19804, ORA-19809, ORA-03113

1. Try to login to database with SYS AS SYSDBA user. If the instance is idle, run the startup command. 2. If ORA-03113 occured, check the la...