Skip to content

Instantly share code, notes, and snippets.

View junalmeida's full-sized avatar
🏡
Working from home

Marcos Junior junalmeida

🏡
Working from home
View GitHub Profile
@junalmeida
junalmeida / lightweight-oracle-client-11g.md
Last active March 31, 2021 05:07
Configuring a clean and lightweight Oracle.DataAccess client for .NET applications

This guide aims to help you on how to configure a clean and lightweight Oracle Client with .NET Framework. This guide is intended for legacy applications that are bound with classic Oracle.DataAccess. It is recommended to move on to Oracle.ManagedDataAccess.

Download

32 bits version
http://www.oracle.com/technetwork/database/windows/downloads/utilsoft-087491.html
ODAC 11.2 Release 6 (11.2.0.4.0) [Released January 14, 2014]

64 bits version
http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html

@junalmeida
junalmeida / transfer.sql
Created August 22, 2018 14:38
pl-sql transfer multiple dumps over dblink
BEGIN
FOR loop_counter IN 1 .. 7
LOOP
dbms_output.put_line('EXPDAT' || LPAD(loop_counter, 2, '0') || '.DMP');
DBMS_FILE_TRANSFER.PUT_FILE(
source_directory_object => 'DATA_PUMP_DIR',
source_file_name => 'EXPDAT' || LPAD(loop_counter, 2, '0') || '.DMP',
destination_directory_object => 'DATA_PUMP_DIR',
destination_file_name => 'EXPDAT' || LPAD(loop_counter, 2, '0') || '.DMP',
destination_database => 'to_rds' --dblink
@junalmeida
junalmeida / AdfsProvider.cs
Created July 19, 2018 22:54
ADFS Provider to get Saml and Oauth tokens (.netstandard compatible)
using Microsoft.IdentityModel.Tokens.Saml;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
@junalmeida
junalmeida / mssql-index-defrag.sql
Created July 19, 2018 22:08
MSSQL Index Fragmentation Rebuild
--this will generate only ready-to-run sql statements to rebuild.
select
'ALTER INDEX [' + a.Name + '] ON ' + a.Schema_Name + '.[' + a.[Table_Name] + '] ' +
(CASE when b.AverageFragmentation > 30 then 'REBUILD WITH (ONLINE = ON)' else 'REORGANIZE' end) + ';'
cmd, b.AverageFragmentation,b.[page_count]
FROM
(
SELECT s.name [Schema_Name], tbl.name AS [Table_Name], tbl.object_id, i.name AS [Name], i.index_id, CAST(CASE i.index_id WHEN 1 THEN 1 ELSE 0 END AS bit) AS [IsClustered],
@junalmeida
junalmeida / create-public-synonyms.sql
Created February 26, 2018 00:27
Create Public Synonims (PL-SQL)
set serveroutput on
DECLARE
sql_txt VARCHAR2(300);
CURSOR obj_cur IS
SELECT object_name, owner FROM ALL_OBJECTS where owner IN ('<owner1>', '<owner2>') and object_type in ('TABLE', 'SEQUENCE', 'VIEW');
BEGIN
dbms_output.enable(10000000);
FOR obj IN obj_cur LOOP
sql_txt:='CREATE OR REPLACE PUBLIC SYNONYM ' || obj.object_name || ' FOR ' || obj.owner || '.' || obj.object_name || ';';
dbms_output.put_line(sql_txt);